Skip to content

Commit

Permalink
build: fix arm64 cross-compilation
Browse files Browse the repository at this point in the history
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: nodejs#42888
  • Loading branch information
bnoordhuis committed Dec 6, 2022
1 parent ab064d1 commit 6bdf9dc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 0 additions & 2 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1247,9 +1247,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:
Expand Down
3 changes: 3 additions & 0 deletions node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@
},

'conditions': [
['target_arch=="arm64"', {
'cflags': ['-msign-return-address=all'], # Pointer authentication.
}],
['OS=="aix"', {
'ldflags': [
'-Wl,-bnoerrmsg',
Expand Down

0 comments on commit 6bdf9dc

Please sign in to comment.