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 cb0237309e..d987ac50be 100644 --- a/meta-oe/recipes-devtools/nodejs/nodejs/libatomic.patch +++ b/meta-oe/recipes-devtools/nodejs/nodejs/libatomic.patch | |||
@@ -1,21 +1,77 @@ | |||
1 | Link mksnapshot with libatomic on x86 | 1 | From 15e751e4b79475fb34e4b32a3ca54119b20c564a Mon Sep 17 00:00:00 2001 |
2 | From: Hongxu Jia <hongxu.jia@windriver.com> | ||
3 | Date: Sat, 17 Aug 2024 21:33:18 +0800 | ||
4 | Subject: [PATCH] link libatomic for clang conditionally | ||
2 | 5 | ||
3 | Clang-12 on x86 emits atomic builtins | 6 | Clang emits atomic builtin, explicitly link libatomic conditionally: |
7 | - For target build, always link -latomic for clang as usual | ||
8 | - For host build, if host and target have same bit width, cross compiling | ||
9 | is enabled, and host toolchain is gcc which does not link -latomic; | ||
10 | if host and target have different bit width, no cross compiling, | ||
11 | host build is the same with target build that requires to link | ||
12 | -latomic; | ||
4 | 13 | ||
5 | Fixes | 14 | Fix: |
6 | | module-compiler.cc:(.text._ZN2v88internal4wasm12_GLOBAL__N_123ExecuteCompilationUnitsERKSt10shared_ptrINS2_22BackgroundCompileTokenEEPNS0_8CountersEiNS2_19CompileBaselineOnlyE+0x558): un | 15 | |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 |
7 | defined reference to `__atomic_load' | ||
8 | 16 | ||
9 | Upstream-Status: Pending | 17 | Upstream-Status: Inappropriate [OE specific] |
10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
11 | 18 | ||
19 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | ||
20 | --- | ||
21 | node.gyp | 13 ++++++++++++- | ||
22 | tools/v8_gypfiles/v8.gyp | 15 ++++++++++++--- | ||
23 | 2 files changed, 24 insertions(+), 4 deletions(-) | ||
24 | |||
25 | diff --git a/node.gyp b/node.gyp | ||
26 | index b425f443..f296f35c 100644 | ||
27 | --- a/node.gyp | ||
28 | +++ b/node.gyp | ||
29 | @@ -487,7 +487,18 @@ | ||
30 | ], | ||
31 | }], | ||
32 | ['OS=="linux" and clang==1', { | ||
33 | - 'libraries': ['-latomic'], | ||
34 | + 'target_conditions': [ | ||
35 | + ['_toolset=="host"', { | ||
36 | + 'conditions': [ | ||
37 | + ['"<!(echo $HOST_AND_TARGET_SAME_WIDTH)"=="0"', { | ||
38 | + 'libraries': ['-latomic'], | ||
39 | + }], | ||
40 | + ], | ||
41 | + }], | ||
42 | + ['_toolset=="target"', { | ||
43 | + 'libraries': ['-latomic'], | ||
44 | + }], | ||
45 | + ], | ||
46 | }], | ||
47 | ], | ||
48 | }, | ||
49 | diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp | ||
50 | index b23263cf..dcabf4ca 100644 | ||
12 | --- a/tools/v8_gypfiles/v8.gyp | 51 | --- a/tools/v8_gypfiles/v8.gyp |
13 | +++ b/tools/v8_gypfiles/v8.gyp | 52 | +++ b/tools/v8_gypfiles/v8.gyp |
14 | @@ -1436,6 +1436,7 @@ | 53 | @@ -1100,9 +1100,18 @@ |
15 | { | 54 | # Platforms that don't have Compare-And-Swap (CAS) support need to link atomic library |
16 | 'target_name': 'mksnapshot', | 55 | # to implement atomic memory access |
17 | 'type': 'executable', | 56 | ['v8_current_cpu in ["mips64", "mips64el", "ppc", "arm", "riscv64", "loong64"]', { |
18 | + 'libraries': [ '-latomic' ], | 57 | - 'link_settings': { |
19 | 'dependencies': [ | 58 | - 'libraries': ['-latomic', ], |
20 | 'v8_base_without_compiler', | 59 | - }, |
21 | 'v8_compiler_for_mksnapshot', | 60 | + 'target_conditions': [ |
61 | + ['_toolset=="host"', { | ||
62 | + 'conditions': [ | ||
63 | + ['"<!(echo $HOST_AND_TARGET_SAME_WIDTH)"=="0"', { | ||
64 | + 'libraries': ['-latomic'], | ||
65 | + }], | ||
66 | + ], | ||
67 | + }], | ||
68 | + ['_toolset=="target"', { | ||
69 | + 'libraries': ['-latomic', ], | ||
70 | + }], | ||
71 | + ], | ||
72 | }], | ||
73 | ], | ||
74 | }, # v8_base_without_compiler | ||
75 | -- | ||
76 | 2.35.5 | ||
77 | |||