diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/libatomic.patch b/meta-oe/recipes-devtools/nodejs/nodejs/libatomic.patch index cb0237309e0..bc51f99d852 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 +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 +Upstream-Status: Inappropriate [OE specific] +Signed-off-by: Hongxu Jia +--- + 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': [ ++ ['"