From 4baeb7b21d66704744edcdac66ea88780bd8fde5 Mon Sep 17 00:00:00 2001 From: Mahdi Sharifi Date: Wed, 24 Apr 2024 10:00:02 +0330 Subject: [PATCH] build: fix arm64 cross-compilation bug on non-arm machines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/52559 Reviewed-By: Richard Lau Reviewed-By: Michaƫl Zasso --- node.gyp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/node.gyp b/node.gyp index 1755c2d6d778eb..484d3ff0329de9 100644 --- a/node.gyp +++ b/node.gyp @@ -482,8 +482,20 @@ }, 'conditions': [ + # Pointer authentication for ARM64. ['target_arch=="arm64"', { - 'cflags': ['-mbranch-protection=standard'], # Pointer authentication. + 'target_conditions': [ + ['_toolset=="host"', { + 'conditions': [ + ['host_arch=="arm64"', { + 'cflags': ['-mbranch-protection=standard'], + }], + ], + }], + ['_toolset=="target"', { + 'cflags': ['-mbranch-protection=standard'], + }], + ], }], ['OS in "aix os400"', { 'ldflags': [