From 6826bbf26755b144a478e51fd0a7dc83aa0c65b8 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 d4716cada1db50..4c7909d071eeb1 100644 --- a/node.gyp +++ b/node.gyp @@ -466,8 +466,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': [