Skip to content

build: name node's arch after the target cpu in every toolchain - #52959

Merged
jkleinsc merged 1 commit into
mainfrom
fix/node-arch-snapshot-toolchain
Aug 18, 2026
Merged

build: name node's arch after the target cpu in every toolchain#52959
jkleinsc merged 1 commit into
mainfrom
fix/node-arch-snapshot-toolchain

Conversation

@codebytere

Copy link
Copy Markdown
Member

Description of Change

Since #52874 the linux-arm (32-bit) build boots its main process from a Node startup snapshot generated in V8's snapshot toolchain, and process.arch in that main process came out as 'ia32' while renderers and service workers reported 'arm' (caught by the webPreferences.sandbox process-API and ServiceWorkerMain startup-data specs on the #52874 backports' arm test legs).

Node's GN build (unofficial.gni) picks NODE_ARCH = "ia32" whenever the compiling toolchain's current_cpu is x86, and target_cpu otherwise. The arm snapshot toolchain is x86-hosted, so the node_mksnapshot built there baked arch: 'ia32' into the process object the arm binary later deserializes. Keying the ia32 spelling off target_cpu gives the right answer in the target toolchain and in every host toolchain that builds node for a snapshot; arm64/x64 cross builds were unaffected because their snapshot toolchains are x64-hosted. One line in build_add_gn_build_files.patch; the other patch files only pick up the new blob hashes.

This needs to ride along with the #52874 backports (folded into those PRs rather than trop'd on its own).

Checklist

Release Notes

Notes: none

Node's GN build set NODE_ARCH to "ia32" whenever the toolchain compiling
it was x86 and to target_cpu otherwise. That is the same thing for a
normal build, but not in V8's snapshot toolchain: the arm (32-bit)
snapshot is produced by an x86-hosted node_mksnapshot, which therefore
carried NODE_ARCH="ia32", and since #52874 the arm build boots its main
process from that snapshot - so process.arch read "ia32" there while
renderers and workers said "arm". Spell the ia32 special case off
target_cpu instead, which is right in the target toolchain and in every
host toolchain that builds node for the snapshot.
@codebytere
codebytere requested a review from a team as a code owner August 18, 2026 14:44
@codebytere codebytere added semver/patch backwards-compatible bug fixes no-backport labels Aug 18, 2026
@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Aug 18, 2026
@codebytere codebytere changed the title fix: name node's arch after the target cpu in every toolchain build: name node's arch after the target cpu in every toolchain Aug 18, 2026
@electron-cation electron-cation Bot removed the new-pr 🌱 PR opened recently label Aug 18, 2026
@jkleinsc
jkleinsc merged commit a32a43b into main Aug 18, 2026
94 of 95 checks passed
@jkleinsc
jkleinsc deleted the fix/node-arch-snapshot-toolchain branch August 18, 2026 21:21
@release-clerk

release-clerk Bot commented Aug 18, 2026

Copy link
Copy Markdown

No Release Notes

@trop trop Bot added merged/44-x-y PR was merged to the "44-x-y" branch. merged/43-x-y PR was merged to the "43-x-y" branch. merged/42-x-y PR was merged to the "42-x-y" branch. labels Aug 19, 2026
nodejs-github-bot pushed a commit to nodejs/node that referenced this pull request Aug 31, 2026
unofficial.gni special-cased ia32 on current_cpu while every other
architecture used target_cpu. When node is also compiled in a host
toolchain of a cross build (for example node_mksnapshot running in
V8's snapshot toolchain, which is x86-hosted for 32-bit arm targets),
current_cpu is the host's, so NODE_ARCH became "ia32" for an
arm-targeted build and process.arch deserialized as 'ia32' on the
device. Key the special case off target_cpu like the rest.

Signed-off-by: Shelley Vohr <[email protected]>
PR-URL: #65491
Refs: electron/electron#52959
Reviewed-By: Filip Skokan <[email protected]>
aduh95 pushed a commit to nodejs/node that referenced this pull request Sep 3, 2026
unofficial.gni special-cased ia32 on current_cpu while every other
architecture used target_cpu. When node is also compiled in a host
toolchain of a cross build (for example node_mksnapshot running in
V8's snapshot toolchain, which is x86-hosted for 32-bit arm targets),
current_cpu is the host's, so NODE_ARCH became "ia32" for an
arm-targeted build and process.arch deserialized as 'ia32' on the
device. Key the special case off target_cpu like the rest.

Signed-off-by: Shelley Vohr <[email protected]>
PR-URL: #65491
Refs: electron/electron#52959
Reviewed-By: Filip Skokan <[email protected]>
R31K4G3 pushed a commit to R31K4G3/node that referenced this pull request Sep 9, 2026
unofficial.gni special-cased ia32 on current_cpu while every other
architecture used target_cpu. When node is also compiled in a host
toolchain of a cross build (for example node_mksnapshot running in
V8's snapshot toolchain, which is x86-hosted for 32-bit arm targets),
current_cpu is the host's, so NODE_ARCH became "ia32" for an
arm-targeted build and process.arch deserialized as 'ia32' on the
device. Key the special case off target_cpu like the rest.

Signed-off-by: Shelley Vohr <[email protected]>
PR-URL: nodejs#65491
Refs: electron/electron#52959
Reviewed-By: Filip Skokan <[email protected]>
aduh95 pushed a commit to nodejs/node that referenced this pull request Sep 9, 2026
unofficial.gni special-cased ia32 on current_cpu while every other
architecture used target_cpu. When node is also compiled in a host
toolchain of a cross build (for example node_mksnapshot running in
V8's snapshot toolchain, which is x86-hosted for 32-bit arm targets),
current_cpu is the host's, so NODE_ARCH became "ia32" for an
arm-targeted build and process.arch deserialized as 'ia32' on the
device. Key the special case off target_cpu like the rest.

Signed-off-by: Shelley Vohr <[email protected]>
PR-URL: #65491
Refs: electron/electron#52959
Reviewed-By: Filip Skokan <[email protected]>
aduh95 pushed a commit to nodejs/node that referenced this pull request Sep 9, 2026
unofficial.gni special-cased ia32 on current_cpu while every other
architecture used target_cpu. When node is also compiled in a host
toolchain of a cross build (for example node_mksnapshot running in
V8's snapshot toolchain, which is x86-hosted for 32-bit arm targets),
current_cpu is the host's, so NODE_ARCH became "ia32" for an
arm-targeted build and process.arch deserialized as 'ia32' on the
device. Key the special case off target_cpu like the rest.

Signed-off-by: Shelley Vohr <[email protected]>
PR-URL: #65491
Refs: electron/electron#52959
Reviewed-By: Filip Skokan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

45-x-y merged/42-x-y PR was merged to the "42-x-y" branch. merged/43-x-y PR was merged to the "43-x-y" branch. merged/44-x-y PR was merged to the "44-x-y" branch. no-backport semver/patch backwards-compatible bug fixes

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

4 participants