From 01b87f3d40bc7bd51af1806af69b3172d64e7e60 Mon Sep 17 00:00:00 2001 From: Honza Horak Date: Wed, 7 Aug 2024 18:37:06 +0200 Subject: [PATCH] Revert -mbranch-protection=standard compilation option on aarch64 gcc available in RHEL-8 does not know -mbranch-protection option and since it was introduced for cross-compilation purposes in nodejs upstream, it seems to be save to revert the upstream patch. Revert "build: fix arm64 cross-compilation bug on non-arm machines" This reverts upstream commit 6826bbf26755b144a478e51fd0a7dc83aa0c65b8. Revert "build: fix arm64 cross-compilation" This reverts upstream commit 297368a1edc48d2bedc58c75f1857276bdcdd578. Resolves: RHEL-43645 RHEL-46706 RHEL-46882 RHEL-50109 --- ...-arm64-cross-compilation-bug-on-non-.patch | 57 +++++++++++++++++++ nodejs.spec | 1 + 2 files changed, 58 insertions(+) create mode 100644 0001-Revert-build-fix-arm64-cross-compilation-bug-on-non-.patch diff --git a/0001-Revert-build-fix-arm64-cross-compilation-bug-on-non-.patch b/0001-Revert-build-fix-arm64-cross-compilation-bug-on-non-.patch new file mode 100644 index 0000000..0b1dec3 --- /dev/null +++ b/0001-Revert-build-fix-arm64-cross-compilation-bug-on-non-.patch @@ -0,0 +1,57 @@ +gcc available in RHEL-8 does not know -mbranch-protection option and since +it was introduced for cross-compilation purposes in nodejs upstream, it seems +to be save to revert the upstream patch. + +Revert "build: fix arm64 cross-compilation bug on non-arm machines" +This reverts upstream commit 6826bbf26755b144a478e51fd0a7dc83aa0c65b8. + +Revert "build: fix arm64 cross-compilation" +This reverts upstream commit 297368a1edc48d2bedc58c75f1857276bdcdd578. +--- + configure.py | 2 ++ + node.gyp | 15 --------------- + 2 files changed, 2 insertions(+), 15 deletions(-) + +diff --git a/configure.py b/configure.py +index f189ba2bf09..9b2d993bb32 100755 +--- a/configure.py ++++ b/configure.py +@@ -1344,7 +1344,9 @@ 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 ff59af6ff76..7d9ec812917 100644 +--- a/node.gyp ++++ b/node.gyp +@@ -468,21 +468,6 @@ + }, + + 'conditions': [ +- # Pointer authentication for ARM64. +- ['target_arch=="arm64"', { +- 'target_conditions': [ +- ['_toolset=="host"', { +- 'conditions': [ +- ['host_arch=="arm64"', { +- 'cflags': ['-mbranch-protection=standard'], +- }], +- ], +- }], +- ['_toolset=="target"', { +- 'cflags': ['-mbranch-protection=standard'], +- }], +- ], +- }], + ['OS in "aix os400"', { + 'ldflags': [ + '-Wl,-bnoerrmsg', +-- +2.45.2 + diff --git a/nodejs.spec b/nodejs.spec index e00527a..ecdc17e 100644 --- a/nodejs.spec +++ b/nodejs.spec @@ -193,6 +193,7 @@ Source112: https://github.com/WebAssembly/wasi-sdk/archive/wasi-sdk-16/wasi-sdk- # Disable running gyp on bundled deps we don't use Patch1: 0001-Disable-running-gyp-on-shared-deps.patch Patch2: 0002-Disable-FIPS-options.patch +Patch3: 0001-Revert-build-fix-arm64-cross-compilation-bug-on-non-.patch BuildRequires: make BuildRequires: python3-devel