Skip to content

Commit 297368a

Browse files
targosmarco-ippolito
authored andcommitted
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. The flag being deprecated, it is also changed to `-mbranch-protection=standard`. Fixes: #42888 Co-Authored-By: Michaël Zasso <targos@protonmail.com> PR-URL: #51256 Fixes: nodejs/build#3319 Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent c530520 commit 297368a

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

configure.py

-2
Original file line numberDiff line numberDiff line change
@@ -1280,9 +1280,7 @@ def configure_node(o):
12801280

12811281
o['variables']['want_separate_host_toolset'] = int(cross_compiling)
12821282

1283-
# Enable branch protection for arm64
12841283
if target_arch == 'arm64':
1285-
o['cflags']+=['-msign-return-address=all']
12861284
o['variables']['arm_fpu'] = options.arm_fpu or 'neon'
12871285

12881286
if options.node_snapshot_main is not None:

node.gyp

+3
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,9 @@
464464
},
465465

466466
'conditions': [
467+
['target_arch=="arm64"', {
468+
'cflags': ['-mbranch-protection=standard'], # Pointer authentication.
469+
}],
467470
['OS in "aix os400"', {
468471
'ldflags': [
469472
'-Wl,-bnoerrmsg',

0 commit comments

Comments
 (0)