From 566d10b64fdec610a39ea1838fbbbbf9a42e0d91 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Tue, 20 Oct 2026 13:39:23 -0700 Subject: [PATCH] Fix false-positive `$SYSCALLS` dependency in `wrapSyscallFunction`. NFC In `src/lib/libcore.js`, check `t.includes('SYSCALLS.')` instead of `t.includes('SYSCALLS')` in `wrapSyscallFunction` so comments and strings mentioning `SYSCALLS_REQUIRE_FILESYSTEM` (such as in `fd_write`) do not pull in `$SYSCALLS` and `$UTF8ToString` when `SYSCALLS_REQUIRE_FILESYSTEM=0`. Split out from #27995 --- src/lib/libcore.js | 2 +- test/codesize/test_codesize_hello_O0.json | 4 ++-- test/codesize/test_unoptimized_code_size.json | 16 ++++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/lib/libcore.js b/src/lib/libcore.js index d280836d8a75b..f382ce245dcdd 100644 --- a/src/lib/libcore.js +++ b/src/lib/libcore.js @@ -2683,7 +2683,7 @@ function wrapSyscallFunction(x, library, isWasi) { library[x] = t; // Automatically add dependency on `$SYSCALLS` - if (!WASMFS && t.includes('SYSCALLS')) { + if (!WASMFS && t.includes('SYSCALLS.')) { library[x + '__deps'].push('$SYSCALLS'); } #if PTHREADS diff --git a/test/codesize/test_codesize_hello_O0.json b/test/codesize/test_codesize_hello_O0.json index 854681ba3614b..dde5f96b62506 100644 --- a/test/codesize/test_codesize_hello_O0.json +++ b/test/codesize/test_codesize_hello_O0.json @@ -1,10 +1,10 @@ { "a.out.js": 23533, - "a.out.js.gz": 8550, + "a.out.js.gz": 8547, "a.out.nodebug.wasm": 14279, "a.out.nodebug.wasm.gz": 7101, "total": 37812, - "total_gz": 15651, + "total_gz": 15648, "sent": [ "fd_write" ], diff --git a/test/codesize/test_unoptimized_code_size.json b/test/codesize/test_unoptimized_code_size.json index d43a5f3f27caa..8f74b13390efc 100644 --- a/test/codesize/test_unoptimized_code_size.json +++ b/test/codesize/test_unoptimized_code_size.json @@ -1,16 +1,16 @@ { - "hello_world.js": 54111, - "hello_world.js.gz": 17152, + "hello_world.js": 53049, + "hello_world.js.gz": 16879, "hello_world.wasm": 14279, "hello_world.wasm.gz": 7101, - "no_asserts.js": 23077, - "no_asserts.js.gz": 8099, + "no_asserts.js": 22107, + "no_asserts.js.gz": 7869, "no_asserts.wasm": 11393, "no_asserts.wasm.gz": 5646, - "strict.js": 51239, - "strict.js.gz": 16135, + "strict.js": 50177, + "strict.js.gz": 15887, "strict.wasm": 14279, "strict.wasm.gz": 7098, - "total": 168378, - "total_gz": 61231 + "total": 165284, + "total_gz": 60480 }