diff options
Diffstat (limited to 'meta-oe/recipes-devtools/nodejs/nodejs/libatomic.patch')
-rw-r--r-- | meta-oe/recipes-devtools/nodejs/nodejs/libatomic.patch | 86 |
1 files changed, 71 insertions, 15 deletions
diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/libatomic.patch b/meta-oe/recipes-devtools/nodejs/nodejs/libatomic.patch index cdf6bc8e23..bc51f99d85 100644 --- a/meta-oe/recipes-devtools/nodejs/nodejs/libatomic.patch +++ b/meta-oe/recipes-devtools/nodejs/nodejs/libatomic.patch @@ -1,21 +1,77 @@ -Link mksnapshot with libatomic on x86 +From 15e751e4b79475fb34e4b32a3ca54119b20c564a Mon Sep 17 00:00:00 2001 +From: Hongxu Jia <hongxu.jia@windriver.com> +Date: Sat, 17 Aug 2024 21:33:18 +0800 +Subject: [PATCH] link libatomic for clang conditionally -Clang-12 on x86 emits atomic builtins +Clang emits atomic builtin, explicitly link libatomic conditionally: +- For target build, always link -latomic for clang as usual +- For host build, if host and target have same bit width, cross compiling + is enabled, and host toolchain is gcc which does not link -latomic; + if host and target have different bit width, no cross compiling, + host build is the same with target build that requires to link + -latomic; -Fixes -| module-compiler.cc:(.text._ZN2v88internal4wasm12_GLOBAL__N_123ExecuteCompilationUnitsERKSt10shared_ptrINS2_22BackgroundCompileTokenEEPNS0_8CountersEiNS2_19CompileBaselineOnlyE+0x558): un -defined reference to `__atomic_load' +Fix: +|tmp-glibc/work/core2-64-wrs-linux/nodejs/20.13.0/node-v20.13.0/out/Release/node_js2c: error while loading shared libraries: libatomic.so.1: cannot open shared object file: No such file or directory -Upstream-Status: Pending -Signed-off-by: Khem Raj <raj.khem@gmail.com> +Upstream-Status: Inappropriate [OE specific] +Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> +--- + node.gyp | 13 ++++++++++++- + tools/v8_gypfiles/v8.gyp | 15 ++++++++++++--- + 2 files changed, 24 insertions(+), 4 deletions(-) + +diff --git a/node.gyp b/node.gyp +index b425f443..f296f35c 100644 +--- a/node.gyp ++++ b/node.gyp +@@ -487,7 +487,18 @@ + ], + }], + ['OS == "linux" and llvm_version != "0.0"', { +- 'libraries': ['-latomic'], ++ 'target_conditions': [ ++ ['_toolset=="host"', { ++ 'conditions': [ ++ ['"<!(echo $HOST_AND_TARGET_SAME_WIDTH)"=="0"', { ++ 'libraries': ['-latomic'], ++ }], ++ ], ++ }], ++ ['_toolset=="target"', { ++ 'libraries': ['-latomic'], ++ }], ++ ], + }], + ], + }, +diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp +index b23263cf..dcabf4ca 100644 --- 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', +@@ -1100,9 +1100,18 @@ + # Platforms that don't have Compare-And-Swap (CAS) support need to link atomic library + # to implement atomic memory access + ['v8_current_cpu in ["mips64", "mips64el", "ppc", "arm", "riscv64", "loong64"]', { +- 'link_settings': { +- 'libraries': ['-latomic', ], +- }, ++ 'target_conditions': [ ++ ['_toolset=="host"', { ++ 'conditions': [ ++ ['"<!(echo $HOST_AND_TARGET_SAME_WIDTH)"=="0"', { ++ 'libraries': ['-latomic'], ++ }], ++ ], ++ }], ++ ['_toolset=="target"', { ++ 'libraries': ['-latomic', ], ++ }], ++ ], + }], + ], + }, # v8_base_without_compiler +-- +2.35.5 + |