Skip to content

Commit b44cdd0

Browse files
committed
build,src: gate jspi flag on V8_ENABLE_WEBASSEMBLY
Since d937c8c ("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: #59941 Assisted-by: claude:fable-5.1 Signed-off-by: Piotr Kubaj <pkubaj@FreeBSD.org>
1 parent e711d3f commit b44cdd0

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

‎common.gypi‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@
7575
# Disable v8 hugepage by default.
7676
'v8_enable_hugepage%': 0,
7777

78+
# Disabled by configure --v8-lite-mode.
79+
'v8_enable_webassembly%': 1,
80+
7881
# This is more of a V8 dev setting
7982
# https://github.com/nodejs/node/pull/22920/files#r222779926
8083
'v8_enable_fast_mksnapshot': 0,
@@ -509,6 +512,9 @@
509512
['v8_enable_v8_checks == 1', {
510513
'defines': ['V8_ENABLE_CHECKS'],
511514
}],
515+
['v8_enable_webassembly == 1', {
516+
'defines': ['V8_ENABLE_WEBASSEMBLY'],
517+
}],
512518
['v8_enable_pointer_compression == 1', {
513519
'defines': ['V8_COMPRESS_POINTERS'],
514520
}],

‎src/node.cc‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,8 +786,10 @@ static ExitCode ProcessGlobalArgsInternal(std::vector<std::string>* args,
786786
v8_args.emplace_back("--js-source-phase-imports");
787787
}
788788

789+
#if V8_ENABLE_WEBASSEMBLY
789790
// WebAssembly JS Promise Integration
790791
v8_args.emplace_back("--experimental-wasm-jspi");
792+
#endif // V8_ENABLE_WEBASSEMBLY
791793

792794
#ifdef __POSIX__
793795
// Block SIGPROF signals when sleeping in epoll_wait/kevent/etc. Avoids the

0 commit comments

Comments
 (0)