Skip to content

build,src: gate jspi flag on V8_ENABLE_WEBASSEMBLY - #66082

Open
pkubaj wants to merge 1 commit into
nodejs:v24.x-stagingfrom
pkubaj:jitless-v24-fix
Open

pkubaj wants to merge 1 commit into
nodejs:v24.x-stagingfrom
pkubaj:jitless-v24-fix

Conversation

@pkubaj

@pkubaj pkubaj commented Sep 17, 2026

Copy link
Copy Markdown

Since v24.20.0 (backport of #59941) ProcessGlobalArgsInternal() pushes
--experimental-wasm-jspi unconditionally. With ./configure --v8-lite-mode,
v8_enable_webassembly is 0, V8 is built without V8_ENABLE_WEBASSEMBLY, and
the whole experimental_wasm_* flag block in flag-definitions.h does not
exist. V8::SetFlagsFromCommandLine() is called with remove_flags=true, which
silently leaves unknown flags in argv, so node reports them as bad options and
exits with kInvalidCommandLineArgument. The first binary to run that code is
node_mksnapshot, so every lite-mode build fails:

bad option: --experimental-wasm-jspi
node_mksnapshot failed with exit code 9

This forwards v8_enable_webassembly to all targets as
V8_ENABLE_WEBASSEMBLY, the same way common.gypi already forwards the other
V8 feature defines, adds the % default the file needs for node-gyp, and only
pushes the JSPI flag when WebAssembly is compiled in. V8's public headers do not
reference V8_ENABLE_WEBASSEMBLY, so defining it for node's own sources does
not affect the V8 API.

--v8-lite-mode is not covered by CI, which is why this was not caught.

Verification

  • FreeBSD/amd64, ./configure --v8-lite-mode (the www/node24 port with the
    JIT option off): node_mksnapshot now succeeds and the build completes;
    node -p 'typeof WebAssembly' prints undefined as expected for lite mode.
  • Default configure: unchanged; node -p 'typeof WebAssembly.Suspending'
    still prints function, so JSPI remains enabled.

AI disclosure

The root-cause analysis and the patch were drafted with Claude (Anthropic's
coding agent). I verified the analysis against deps/v8/src/flags/flag-definitions.h,
deps/v8/src/flags/flags.cc, configure.py and tools/v8_gypfiles/features.gypi,
and build-tested both configurations listed above myself.

Refs: #59941

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: nodejs#59941
Assisted-by: claude:fable-5.1
Signed-off-by: Piotr Kubaj <[email protected]>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/gyp
  • @nodejs/startup

@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to Node.js builds or CI infrastructure. c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. v24.x Issues that can be reproduced on v24.x or PRs targeting the v24.x-staging branch. labels Sep 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Welcome to Node.js, and thank you for your first contribution!

Before review, please take a moment to read:

Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal.

Caution

AgentScan found account activity patterns that may be consistent with automation. This is a heuristic, not proof that this pull request was opened by an agent or violates policy. AI-assisted contributions are permitted, but automated tooling must not open pull requests without advance approval, and contributors must personally understand, test, verify, and take responsibility for every submitted change. See the AgentScan analysis, AI use policy, and automation policy for additional context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agentscan:mixed-signals build Issues and PRs related to Node.js builds or CI infrastructure. c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. v24.x Issues that can be reproduced on v24.x or PRs targeting the v24.x-staging branch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants