void-packages/srcpkgs/nodejs/patches/cross-aarch64.patch

44 lines
1.3 KiB
Diff

From 6bdf9dc3ec7dbff00acef081f4e3dd3e061fd744 Mon Sep 17 00:00:00 2001
From: Ben Noordhuis <info@bnoordhuis.nl>
Date: Tue, 6 Dec 2022 11:27:49 +0100
Subject: [PATCH] build: fix arm64 cross-compilation
Commit 938212f added -msign-return-address=all to _all_ cflags but that
is wrong when cross-compiling, it should only be added to the target's
cflags.
Fixes: https://github.com/nodejs/node/issues/42888
---
configure.py | 2 --
node.gyp | 3 +++
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/configure.py b/configure.py
index 40e0395e..9de3148f 100755
--- a/configure.py
+++ b/configure.py
@@ -1294,9 +1294,7 @@ def configure_node(o):
o['variables']['want_separate_host_toolset'] = int(cross_compiling)
- # Enable branch protection for arm64
if target_arch == 'arm64':
- o['cflags']+=['-msign-return-address=all']
o['variables']['arm_fpu'] = options.arm_fpu or 'neon'
if options.node_snapshot_main is not None:
diff --git a/node.gyp b/node.gyp
index cf52281b..5218d941 100644
--- a/node.gyp
+++ b/node.gyp
@@ -112,6 +112,9 @@
},
'conditions': [
+ ['target_arch=="arm64"', {
+ 'cflags': ['-msign-return-address=all'], # Pointer authentication.
+ }],
['OS in "aix os400"', {
'ldflags': [
'-Wl,-bnoerrmsg',