From b59cdc0858a18e6ac9b690bee5ffc712af70ba07 Mon Sep 17 00:00:00 2001 From: valadaptive Date: Thu, 4 Jun 2026 08:39:20 -0400 Subject: [PATCH 1/2] Move the fadvise64 stub into C --- src/lib/libsigs.js | 1 - src/lib/libsyscall.js | 3 --- system/lib/libc/emscripten_syscall_stubs.c | 5 +++++ test/codesize/test_codesize_hello_dylink_all.json | 11 +++++------ 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/lib/libsigs.js b/src/lib/libsigs.js index bd55356fb7a35..e33cca1218f5e 100644 --- a/src/lib/libsigs.js +++ b/src/lib/libsigs.js @@ -238,7 +238,6 @@ sigs = { __syscall_dup__sig: 'ii', __syscall_dup3__sig: 'iiii', __syscall_faccessat__sig: 'iipii', - __syscall_fadvise64__sig: 'iijji', __syscall_fallocate__sig: 'iiijj', __syscall_fchdir__sig: 'ii', __syscall_fchmod__sig: 'iii', diff --git a/src/lib/libsyscall.js b/src/lib/libsyscall.js index ed39f4f64d14c..a0105e2a2871f 100644 --- a/src/lib/libsyscall.js +++ b/src/lib/libsyscall.js @@ -832,9 +832,6 @@ var SyscallsLibrary = { SYSCALLS.writeStatFs(buf, FS.statfsStream(stream)); return 0; }, - __syscall_fadvise64__nothrow: true, - __syscall_fadvise64__proxy: 'none', - __syscall_fadvise64: (fd, offset, len, advice) => 0, __syscall_openat__deps: ['$syscallGetVarargI'], __syscall_openat: (dirfd, path, flags, varargs) => { path = SYSCALLS.getStr(path); diff --git a/system/lib/libc/emscripten_syscall_stubs.c b/system/lib/libc/emscripten_syscall_stubs.c index 809027da5a03a..13ec599a8ee45 100644 --- a/system/lib/libc/emscripten_syscall_stubs.c +++ b/system/lib/libc/emscripten_syscall_stubs.c @@ -186,6 +186,11 @@ weak int __syscall_madvise(intptr_t addr, size_t length, int advice) { return 0; } +weak int __syscall_fadvise64(int fd, off_t offset, off_t length, int advice) { + // this is purely advisory, so we don't warn + return 0; +} + weak int __syscall_mlock(intptr_t addr, size_t len) { REPORT(mlock); return 0; diff --git a/test/codesize/test_codesize_hello_dylink_all.json b/test/codesize/test_codesize_hello_dylink_all.json index c7ef6b6852523..5bdd8786206e7 100644 --- a/test/codesize/test_codesize_hello_dylink_all.json +++ b/test/codesize/test_codesize_hello_dylink_all.json @@ -1,7 +1,7 @@ { - "a.out.js": 268175, - "a.out.nodebug.wasm": 587614, - "total": 855789, + "a.out.js": 268126, + "a.out.nodebug.wasm": 587596, + "total": 855722, "sent": [ "IMG_Init", "IMG_Load", @@ -223,7 +223,6 @@ "__syscall_dup", "__syscall_dup3", "__syscall_faccessat", - "__syscall_fadvise64", "__syscall_fallocate", "__syscall_fchdir", "__syscall_fchmod", @@ -1742,7 +1741,6 @@ "env.__syscall_dup", "env.__syscall_dup3", "env.__syscall_faccessat", - "env.__syscall_fadvise64", "env.__syscall_fallocate", "env.__syscall_fchdir", "env.__syscall_fchmod", @@ -2194,6 +2192,7 @@ "__subvti3", "__synccall", "__syscall_acct", + "__syscall_fadvise64", "__syscall_getegid32", "__syscall_geteuid32", "__syscall_getgid32", @@ -4075,6 +4074,7 @@ "$__subvti3", "$__synccall", "$__syscall_acct", + "$__syscall_fadvise64", "$__syscall_getgroups32", "$__syscall_getpid", "$__syscall_getppid", @@ -4906,7 +4906,6 @@ "$pop_arg_long_double", "$popen", "$posix_close", - "$posix_fadvise", "$posix_fallocate", "$posix_getdents", "$posix_openpt", From ee653261f8e498386b611bc8f6be8aee668c2f9a Mon Sep 17 00:00:00 2001 From: valadaptive Date: Thu, 4 Jun 2026 08:39:33 -0400 Subject: [PATCH 2/2] Remove dead _emscripten_default_pthread_stack_size --- system/lib/pthread/threading_internal.h | 1 - 1 file changed, 1 deletion(-) diff --git a/system/lib/pthread/threading_internal.h b/system/lib/pthread/threading_internal.h index a19b6ad564bc5..097595e3ba6b9 100644 --- a/system/lib/pthread/threading_internal.h +++ b/system/lib/pthread/threading_internal.h @@ -110,7 +110,6 @@ void emscripten_conditional_set_current_thread_status(EM_THREAD_STATUS expectedS int __pthread_kill_js(pthread_t t, int sig); int __pthread_create_js(pthread_t thread, const pthread_attr_t *attr, void *(*start_routine) (void *), void *arg); -int _emscripten_default_pthread_stack_size(); void __set_thread_state(pthread_t ptr, int is_main, int is_runtime, int can_block); double _emscripten_receive_on_main_thread_js(int funcIndex, void* emAsmAddr, pthread_t callingThread, int numCallArgs, double* args, void* ctx, void* ctxArgs);