Skip to content

Commit 9f291d8

Browse files
committed
Merge branch 'main' into update_libcxx_libcxxabi_19
2 parents 643050f + c35d60a commit 9f291d8

File tree

164 files changed

+3103
-2429
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

164 files changed

+3103
-2429
lines changed

.circleci/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,7 @@ jobs:
799799
EMTEST_SKIP_NODE_CANARY: "1"
800800
EMTEST_SKIP_RUST: "1"
801801
EMTEST_SKIP_WASM64: "1"
802+
EMTEST_SKIP_NEW_CMAKE: "1"
802803
steps:
803804
- install-rust
804805
- run: apt-get install -q -y ninja-build scons ccache

ChangeLog.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ to browse the changes between the tags.
1818

1919
See docs/process.md for more on how version tagging works.
2020

21-
3.1.73 (in development)
21+
3.1.74 (in development)
2222
-----------------------
23+
24+
3.1.73 - 11/28/24
25+
-----------------
2326
- libunwind was updated to LLVM 19.1.4. (#22394)
2427

2528
3.1.72 - 11/19/24

cmake/Modules/Platform/Emscripten.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,10 @@ set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_INCLUDES 1)
279279
set(CMAKE_C_RESPONSE_FILE_LINK_FLAG "@")
280280
set(CMAKE_CXX_RESPONSE_FILE_LINK_FLAG "@")
281281

282+
# Enable $<LINK_LIBRARY:WHOLE_ARCHIVE,static_lib> for CMake 3.24+
283+
set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "-Wl,--whole-archive" "<LINK_ITEM>" "-Wl,--no-whole-archive")
284+
set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED True)
285+
282286
# Set a global EMSCRIPTEN variable that can be used in client CMakeLists.txt to
283287
# detect when building using Emscripten.
284288
set(EMSCRIPTEN 1 CACHE INTERNAL "If true, we are targeting Emscripten output.")

emscripten-version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.1.73-git
1+
3.1.74-git

src/cpuprofiler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ var emscriptenCpuProfiler = {
593593
detectWebGLContext() {
594594
if (Module['canvas']?.GLctxObject?.GLctx) return Module['canvas'].GLctxObject.GLctx;
595595
else if (typeof GLctx != 'undefined') return GLctx;
596-
else if (Module.ctx) return Module.ctx;
596+
else if (Module['ctx']) return Module['ctx'];
597597
return null;
598598
},
599599

src/library.js

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2182,25 +2182,19 @@ addToLibrary({
21822182
},
21832183

21842184
$asyncLoad__docs: '/** @param {boolean=} noRunDep */',
2185-
$asyncLoad: (url, onload, onerror, noRunDep) => {
2186-
var dep = !noRunDep ? getUniqueRunDependency(`al ${url}`) : '';
2187-
readAsync(url).then(
2188-
(arrayBuffer) => {
2189-
#if ASSERTIONS
2190-
assert(arrayBuffer, `Loading data file "${url}" failed (no arrayBuffer).`);
2191-
#endif
2192-
onload(new Uint8Array(arrayBuffer));
2193-
if (dep) removeRunDependency(dep);
2194-
},
2195-
(err) => {
2196-
if (onerror) {
2197-
onerror();
2198-
} else {
2199-
throw `Loading data file "${url}" failed.`;
2200-
}
2201-
}
2202-
);
2203-
if (dep) addRunDependency(dep);
2185+
$asyncLoad: (url, noRunDep) => {
2186+
return new Promise((resolve, reject) => {
2187+
var dep = !noRunDep ? getUniqueRunDependency(`al ${url}`) : '';
2188+
if (dep) addRunDependency(dep);
2189+
readAsync(url).then(
2190+
(arrayBuffer) => {
2191+
#if ASSERTIONS
2192+
assert(arrayBuffer, `Loading data file "${url}" failed (no arrayBuffer).`);
2193+
#endif
2194+
resolve(new Uint8Array(arrayBuffer));
2195+
if (dep) removeRunDependency(dep);
2196+
}, reject);
2197+
});
22042198
},
22052199

22062200
$alignMemory: (size, alignment) => {

src/library_async.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,8 @@ addToLibrary({
470470
emscripten_wget_data__async: true,
471471
emscripten_wget_data: (url, pbuffer, pnum, perror) => {
472472
return Asyncify.handleSleep((wakeUp) => {
473-
asyncLoad(UTF8ToString(url), (byteArray) => {
473+
/* no need for run dependency, this is async but will not do any prepare etc. step */
474+
asyncLoad(UTF8ToString(url), /*noRunDep=*/true).then((byteArray) => {
474475
// can only allocate the buffer after the wakeUp, not during an asyncing
475476
var buffer = _malloc(byteArray.length); // must be freed by caller!
476477
HEAPU8.set(byteArray, buffer);
@@ -481,7 +482,7 @@ addToLibrary({
481482
}, () => {
482483
{{{ makeSetValue('perror', 0, '1', 'i32') }}};
483484
wakeUp();
484-
}, true /* no need for run dependency, this is async but will not do any prepare etc. step */ );
485+
});
485486
});
486487
},
487488

src/library_browser.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ var LibraryBrowser = {
192192
},
193193

194194
createContext(/** @type {HTMLCanvasElement} */ canvas, useWebGL, setInModule, webGLContextAttributes) {
195-
if (useWebGL && Module.ctx && canvas == Module['canvas']) return Module.ctx; // no need to recreate GL context if it's already been created for this canvas.
195+
if (useWebGL && Module['ctx'] && canvas == Module['canvas']) return Module['ctx']; // no need to recreate GL context if it's already been created for this canvas.
196196

197197
var ctx;
198198
var contextHandle;
@@ -235,7 +235,7 @@ var LibraryBrowser = {
235235
#if ASSERTIONS
236236
if (!useWebGL) assert(typeof GLctx == 'undefined', 'cannot set in module if GLctx is used, but we are a non-GL context that would replace it');
237237
#endif
238-
Module.ctx = ctx;
238+
Module['ctx'] = ctx;
239239
if (useWebGL) GL.makeContextCurrent(contextHandle);
240240
Browser.useWebGL = useWebGL;
241241
Browser.moduleContextCreatedCallbacks.forEach((callback) => callback());

src/library_dylink.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,7 @@ var LibraryDylink = {
10241024

10251025
var libFile = locateFile(libName);
10261026
if (flags.loadAsync) {
1027-
return new Promise((resolve, reject) => asyncLoad(libFile, resolve, reject));
1027+
return asyncLoad(libFile);
10281028
}
10291029

10301030
// load the binary synchronously

src/library_eventloop.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ LibraryJSEventLoop = {
472472
}
473473

474474
#if ASSERTIONS
475-
if (MainLoop.method === 'timeout' && Module.ctx) {
475+
if (MainLoop.method === 'timeout' && Module['ctx']) {
476476
warnOnce('Looks like you are rendering without using requestAnimationFrame for the main loop. You should use 0 for the frame rate in emscripten_set_main_loop in order to use requestAnimationFrame, as that can greatly improve your frame rates!');
477477
MainLoop.method = ''; // just warn once per call to set main loop
478478
}

src/library_fs.js

Lines changed: 61 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -174,60 +174,46 @@ FS.staticInit();
174174
path = PATH_FS.resolve(path);
175175

176176
if (!path) return { path: '', node: null };
177+
opts.follow_mount ??= true
177178

178-
var defaults = {
179-
follow_mount: true,
180-
recurse_count: 0
181-
};
182-
opts = Object.assign(defaults, opts)
183-
184-
if (opts.recurse_count > 8) { // max recursive lookup of 8
185-
throw new FS.ErrnoError({{{ cDefs.ELOOP }}});
186-
}
187-
188-
// split the absolute path
189-
var parts = path.split('/').filter((p) => !!p);
179+
// limit max consecutive symlinks to 40 (SYMLOOP_MAX).
180+
linkloop: for (var nlinks = 0; nlinks < 40; nlinks++) {
181+
// split the absolute path
182+
var parts = path.split('/').filter((p) => !!p);
190183

191-
// start at the root
192-
var current = FS.root;
193-
var current_path = '/';
184+
// start at the root
185+
var current = FS.root;
186+
var current_path = '/';
194187

195-
for (var i = 0; i < parts.length; i++) {
196-
var islast = (i === parts.length-1);
197-
if (islast && opts.parent) {
198-
// stop resolving
199-
break;
200-
}
188+
for (var i = 0; i < parts.length; i++) {
189+
var islast = (i === parts.length-1);
190+
if (islast && opts.parent) {
191+
// stop resolving
192+
break;
193+
}
201194

202-
current = FS.lookupNode(current, parts[i]);
203-
current_path = PATH.join2(current_path, parts[i]);
195+
current = FS.lookupNode(current, parts[i]);
196+
current_path = PATH.join2(current_path, parts[i]);
204197

205-
// jump to the mount's root node if this is a mountpoint
206-
if (FS.isMountpoint(current)) {
207-
if (!islast || (islast && opts.follow_mount)) {
198+
// jump to the mount's root node if this is a mountpoint
199+
if (FS.isMountpoint(current) && (!islast || opts.follow_mount)) {
208200
current = current.mounted.root;
209201
}
210-
}
211202

212-
// by default, lookupPath will not follow a symlink if it is the final path component.
213-
// setting opts.follow = true will override this behavior.
214-
if (!islast || opts.follow) {
215-
var count = 0;
216-
while (FS.isLink(current.mode)) {
217-
var link = FS.readlink(current_path);
218-
current_path = PATH_FS.resolve(PATH.dirname(current_path), link);
219-
220-
var lookup = FS.lookupPath(current_path, { recurse_count: opts.recurse_count + 1 });
221-
current = lookup.node;
222-
223-
if (count++ > 40) { // limit max consecutive symlinks to 40 (SYMLOOP_MAX).
224-
throw new FS.ErrnoError({{{ cDefs.ELOOP }}});
203+
// by default, lookupPath will not follow a symlink if it is the final path component.
204+
// setting opts.follow = true will override this behavior.
205+
if (FS.isLink(current.mode) && (!islast || opts.follow)) {
206+
if (!current.node_ops.readlink) {
207+
throw new FS.ErrnoError({{{ cDefs.ENOSYS }}});
225208
}
209+
var link = current.node_ops.readlink(current);
210+
path = PATH_FS.resolve(PATH.dirname(current_path), link, ...parts.slice(i + 1));
211+
continue linkloop;
226212
}
227213
}
214+
return { path: current_path, node: current };
228215
}
229-
230-
return { path: current_path, node: current };
216+
throw new FS.ErrnoError({{{ cDefs.ELOOP }}});
231217
},
232218
getPath(node) {
233219
var path;
@@ -372,6 +358,9 @@ FS.staticInit();
372358
return 0;
373359
},
374360
mayCreate(dir, name) {
361+
if (!FS.isDir(dir.mode)) {
362+
return {{{ cDefs.ENOTDIR }}};
363+
}
375364
try {
376365
var node = FS.lookupNode(dir, name);
377366
return {{{ cDefs.EEXIST }}};
@@ -666,15 +655,36 @@ FS.staticInit();
666655
}
667656
return parent.node_ops.mknod(parent, name, mode, dev);
668657
},
658+
statfs(path) {
659+
660+
// NOTE: None of the defaults here are true. We're just returning safe and
661+
// sane values.
662+
var rtn = {
663+
bsize: 4096,
664+
frsize: 4096,
665+
blocks: 1e6,
666+
bfree: 5e5,
667+
bavail: 5e5,
668+
files: FS.nextInode,
669+
ffree: FS.nextInode - 1,
670+
fsid: 42,
671+
flags: 2,
672+
namelen: 255,
673+
};
674+
675+
var parent = FS.lookupPath(path, {follow: true}).node;
676+
if (parent?.node_ops.statfs) {
677+
Object.assign(rtn, parent.node_ops.statfs(parent.mount.opts.root));
678+
}
679+
return rtn;
680+
},
669681
// helpers to create specific types of nodes
670-
create(path, mode) {
671-
mode = mode !== undefined ? mode : 438 /* 0666 */;
682+
create(path, mode = 0o666) {
672683
mode &= {{{ cDefs.S_IALLUGO }}};
673684
mode |= {{{ cDefs.S_IFREG }}};
674685
return FS.mknod(path, mode, 0);
675686
},
676-
mkdir(path, mode) {
677-
mode = mode !== undefined ? mode : 511 /* 0777 */;
687+
mkdir(path, mode = 0o777) {
678688
mode &= {{{ cDefs.S_IRWXUGO }}} | {{{ cDefs.S_ISVTX }}};
679689
mode |= {{{ cDefs.S_IFDIR }}};
680690
#if FS_DEBUG
@@ -701,7 +711,7 @@ FS.staticInit();
701711
mkdev(path, mode, dev) {
702712
if (typeof dev == 'undefined') {
703713
dev = mode;
704-
mode = 438 /* 0666 */;
714+
mode = 0o666;
705715
}
706716
mode |= {{{ cDefs.S_IFCHR }}};
707717
return FS.mknod(path, mode, dev);
@@ -809,7 +819,7 @@ FS.staticInit();
809819
// do the underlying fs rename
810820
try {
811821
old_dir.node_ops.rename(old_node, new_dir, new_name);
812-
// update old node (we do this here to avoid each backend
822+
// update old node (we do this here to avoid each backend
813823
// needing to)
814824
old_node.parent = new_dir;
815825
} catch (e) {
@@ -904,7 +914,7 @@ FS.staticInit();
904914
if (!link.node_ops.readlink) {
905915
throw new FS.ErrnoError({{{ cDefs.EINVAL }}});
906916
}
907-
return PATH_FS.resolve(FS.getPath(link.parent), link.node_ops.readlink(link));
917+
return link.node_ops.readlink(link);
908918
},
909919
stat(path, dontFollow) {
910920
var lookup = FS.lookupPath(path, { follow: !dontFollow });
@@ -1009,13 +1019,12 @@ FS.staticInit();
10091019
timestamp: Math.max(atime, mtime)
10101020
});
10111021
},
1012-
open(path, flags, mode) {
1022+
open(path, flags, mode = 0o666) {
10131023
if (path === "") {
10141024
throw new FS.ErrnoError({{{ cDefs.ENOENT }}});
10151025
}
10161026
flags = typeof flags == 'string' ? FS_modeStringToFlags(flags) : flags;
10171027
if ((flags & {{{ cDefs.O_CREAT }}})) {
1018-
mode = typeof mode == 'undefined' ? 438 /* 0666 */ : mode;
10191028
mode = (mode & {{{ cDefs.S_IALLUGO }}}) | {{{ cDefs.S_IFREG }}};
10201029
} else {
10211030
mode = 0;
@@ -1381,7 +1390,7 @@ FS.staticInit();
13811390
FS.mkdir('/proc/self/fd');
13821391
FS.mount({
13831392
mount() {
1384-
var node = FS.createNode(proc_self, 'fd', {{{ cDefs.S_IFDIR }}} | 511 /* 0777 */, {{{ cDefs.S_IXUGO }}});
1393+
var node = FS.createNode(proc_self, 'fd', {{{ cDefs.S_IFDIR | 0o777 }}}, {{{ cDefs.S_IXUGO }}});
13851394
node.node_ops = {
13861395
lookup(parent, name) {
13871396
var fd = +name;

src/library_fs_shared.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ addToLibrary({
7676
}
7777
addRunDependency(dep);
7878
if (typeof url == 'string') {
79-
asyncLoad(url, processData, onerror);
79+
asyncLoad(url).then(processData, onerror);
8080
} else {
8181
processData(url);
8282
}

src/library_glfw.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,7 +1108,7 @@ var LibraryGLFW = {
11081108
}
11091109

11101110
// If context creation failed, do not return a valid window
1111-
if (!Module.ctx && useWebGL) return 0;
1111+
if (!Module['ctx'] && useWebGL) return 0;
11121112

11131113
// Initializes the framebuffer size from the canvas
11141114
const canvas = Module['canvas'];
@@ -1144,7 +1144,7 @@ var LibraryGLFW = {
11441144
for (var i = 0; i < GLFW.windows.length; i++)
11451145
if (GLFW.windows[i] !== null) return;
11461146

1147-
delete Module.ctx;
1147+
delete Module['ctx'];
11481148
},
11491149

11501150
swapBuffers: (winid) => {

src/library_glut.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ var LibraryGLUT = {
575575
glutDestroyWindow__proxy: 'sync',
576576
glutDestroyWindow__deps: ['$Browser'],
577577
glutDestroyWindow: (name) => {
578-
delete Module.ctx;
578+
delete Module['ctx'];
579579
return 1;
580580
},
581581

src/library_html5_webgl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ var LibraryHtml5WebGL = {
223223
});`,
224224
#endif
225225
_emscripten_proxied_gl_context_activated_from_main_browser_thread: (contextHandle) => {
226-
GLctx = Module.ctx = GL.currentContext = contextHandle;
226+
GLctx = Module['ctx'] = GL.currentContext = contextHandle;
227227
GL.currentContextIsProxied = true;
228228
},
229229
#else

src/library_lz4.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
addToLibrary({
99
$LZ4__deps: ['$FS', '$preloadPlugins'],
1010
$LZ4: {
11-
DIR_MODE: {{{ cDefs.S_IFDIR }}} | 511 /* 0777 */,
12-
FILE_MODE: {{{ cDefs.S_IFREG }}} | 511 /* 0777 */,
11+
DIR_MODE: {{{ cDefs.S_IFDIR | 0o777 }}},
12+
FILE_MODE: {{{ cDefs.S_IFREG | 0o777 }}},
1313
CHUNK_SIZE: -1,
1414
codec: null,
1515
init() {

0 commit comments

Comments
 (0)