Skip to content

Commit c21b2be

Browse files
authored
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 c366422 commit c21b2be

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
@@ -1273,9 +1273,7 @@ def configure_node(o):
12731273

12741274
o['variables']['want_separate_host_toolset'] = int(cross_compiling)
12751275

1276-
# Enable branch protection for arm64
12771276
if target_arch == 'arm64':
1278-
o['cflags']+=['-msign-return-address=all']
12791277
o['variables']['arm_fpu'] = options.arm_fpu or 'neon'
12801278

12811279
if options.node_snapshot_main is not None:

node.gyp

+3
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,9 @@
471471
},
472472

473473
'conditions': [
474+
['target_arch=="arm64"', {
475+
'cflags': ['-mbranch-protection=standard'], # Pointer authentication.
476+
}],
474477
['OS in "aix os400"', {
475478
'ldflags': [
476479
'-Wl,-bnoerrmsg',

0 commit comments

Comments
 (0)