From b44cdd0e6acfa8519214cc7d755bda4cb74fb76c Mon Sep 17 00:00:00 2001 From: Piotr Kubaj Date: Thu, 17 Sep 2026 12:48:37 +0200 Subject: [PATCH] build,src: gate jspi flag on V8_ENABLE_WEBASSEMBLY Since d937c8c6cd ("wasm: enable JSPI") ProcessGlobalArgsInternal() unconditionally appends --experimental-wasm-jspi to the V8 argument list. V8 only defines the experimental_wasm_* flags when it is built with V8_ENABLE_WEBASSEMBLY, and configure --v8-lite-mode sets v8_enable_webassembly=0. V8::SetFlagsFromCommandLine() is called with remove_flags=true, which silently leaves unrecognized flags in argv, so node reports "bad option: --experimental-wasm-jspi" and exits with kInvalidCommandLineArgument. The first binary to run that code is node_mksnapshot, so every --v8-lite-mode build has failed since v24.20.0: bad option: --experimental-wasm-jspi node_mksnapshot failed with exit code 9 Forward v8_enable_webassembly to all targets as V8_ENABLE_WEBASSEMBLY, the same way common.gypi already forwards the other V8 build flags, and only push the JSPI flag when WebAssembly is compiled in. Refs: https://github.com/nodejs/node/pull/59941 Assisted-by: claude:fable-5.1 Signed-off-by: Piotr Kubaj --- common.gypi | 6 ++++++ src/node.cc | 2 ++ 2 files changed, 8 insertions(+) diff --git a/common.gypi b/common.gypi index 1effebe59bd4..62d92323343e 100644 --- a/common.gypi +++ b/common.gypi @@ -75,6 +75,9 @@ # Disable v8 hugepage by default. 'v8_enable_hugepage%': 0, + # Disabled by configure --v8-lite-mode. + 'v8_enable_webassembly%': 1, + # This is more of a V8 dev setting # https://github.com/nodejs/node/pull/22920/files#r222779926 'v8_enable_fast_mksnapshot': 0, @@ -509,6 +512,9 @@ ['v8_enable_v8_checks == 1', { 'defines': ['V8_ENABLE_CHECKS'], }], + ['v8_enable_webassembly == 1', { + 'defines': ['V8_ENABLE_WEBASSEMBLY'], + }], ['v8_enable_pointer_compression == 1', { 'defines': ['V8_COMPRESS_POINTERS'], }], diff --git a/src/node.cc b/src/node.cc index 838106acff8f..06f5d385afc5 100644 --- a/src/node.cc +++ b/src/node.cc @@ -786,8 +786,10 @@ static ExitCode ProcessGlobalArgsInternal(std::vector* args, v8_args.emplace_back("--js-source-phase-imports"); } +#if V8_ENABLE_WEBASSEMBLY // WebAssembly JS Promise Integration v8_args.emplace_back("--experimental-wasm-jspi"); +#endif // V8_ENABLE_WEBASSEMBLY #ifdef __POSIX__ // Block SIGPROF signals when sleeping in epoll_wait/kevent/etc. Avoids the