From ef3829aa09e4296a8f5ab5f90b289dc8a8afdacd Mon Sep 17 00:00:00 2001 From: Mahdi Sharifi Date: Tue, 16 Apr 2024 23:46:24 +0330 Subject: [PATCH] build: fix arm64 cross-compilation bug on non-arm machines --- node.gyp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/node.gyp b/node.gyp index 4a2632c541c380..0c317dc127ed53 100644 --- a/node.gyp +++ b/node.gyp @@ -479,8 +479,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': [