nodejs: Fix build with clang for x86 target

Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Khem Raj
2021-04-20 15:59:40 -07:00
parent 2f365001e2
commit 37e0b6152c
2 changed files with 26 additions and 0 deletions
@@ -0,0 +1,21 @@
Link mksnapshot with libatomic on x86
Clang-12 on x86 emits atomic builtins
Fixes
| module-compiler.cc:(.text._ZN2v88internal4wasm12_GLOBAL__N_123ExecuteCompilationUnitsERKSt10shared_ptrINS2_22BackgroundCompileTokenEEPNS0_8CountersEiNS2_19CompileBaselineOnlyE+0x558): un
defined reference to `__atomic_load'
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
--- a/tools/v8_gypfiles/v8.gyp
+++ b/tools/v8_gypfiles/v8.gyp
@@ -1336,6 +1336,7 @@
{
'target_name': 'mksnapshot',
'type': 'executable',
+ 'libraries': [ '-latomic' ],
'dependencies': [
'v8_base_without_compiler',
'v8_compiler_for_mksnapshot',
@@ -27,6 +27,9 @@ SRC_URI = "http://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz \
SRC_URI_append_class-target = " \
file://0002-Using-native-binaries.patch \
"
SRC_URI_append_toolchain-clang_x86 = " \
file://libatomic.patch \
"
SRC_URI[sha256sum] = "e44adbbed6756c2c1a01258383e9f00df30c147b36e438f6369b5ef1069abac3"
S = "${WORKDIR}/node-v${PV}"
@@ -123,6 +126,8 @@ python do_create_v8_qemu_wrapper () {
do_create_v8_qemu_wrapper[dirs] = "${B}"
addtask create_v8_qemu_wrapper after do_configure before do_compile
LDFLAGS_append_x86 = " -latomic"
# Node is way too cool to use proper autotools, so we install two wrappers to forcefully inject proper arch cflags to workaround gypi
do_configure () {
export LD="${CXX}"