build: derive NODE_ARCH from target_cpu in the GN build

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 <shelley.vohr@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/65491
Refs: https://github.com/electron/electron/pull/52959
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
This commit is contained in:
Shelley Vohr authored and GitHub committed 2026-08-31 13:07:22 +00:00
1 parent 104285afee
commit fc452effb6
1 file changed
+1 -1
+1 -1
View File
@@ -105,7 +105,7 @@ template("node_gn_build") {
"-Wno-unused-function",
]
if (current_cpu == "x86") {
if (target_cpu == "x86") {
node_arch = "ia32"
} else {
node_arch = target_cpu