diff options
| author | Gyorgy Sarvari <skandigraun@gmail.com> | 2026-02-04 09:57:30 +0100 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2026-02-06 10:06:18 -0800 |
| commit | bfbd962813058ec124f307d8323c28294974e8fc (patch) | |
| tree | 91407db6bdd3d8ccfcdaf226eee2c99c43e3b5b6 | |
| parent | 5ff9251b941d37f40a7158057ea3d5f4305f6a93 (diff) | |
| download | meta-openembedded-bfbd962813058ec124f307d8323c28294974e8fc.tar.gz | |
nodejs: extend libatomic patch to x86
This patch isn't intended to introduce new behavior, rather it
changes the order of some existing LDFLAGS to fix a workaround that
stopped working at some point in the past.
LDFLAGS:x86 contains libatomic, because linking with this library
is required for this platform.
However when gyp links, it invokes the following (pseudo-)command:
$LD $LDFLAGS $RESOURCES_TO_LINK $EXTRA_LIBS $EXTRA_LDFLAGS
The EXTRA* arguments are coming from the gyp config. Since
LDFLAGS appears very early in the command, libatomic also
appears early amongst the resources, and the linker couldn't
find the relevant symbols when compiled for x86 platform (as
it was processed the very last):
| [...] undefined reference to `__atomic_compare_exchange'
Using this patch the library appears at the end, along with
the other EXTRA_LIBS, after the list of linked resources,
allowing linking to succeed.
Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
| -rw-r--r-- | meta-oe/recipes-devtools/nodejs/nodejs/libatomic.patch | 29 | ||||
| -rw-r--r-- | meta-oe/recipes-devtools/nodejs/nodejs_22.22.0.bb | 2 |
2 files changed, 24 insertions, 7 deletions
diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/libatomic.patch b/meta-oe/recipes-devtools/nodejs/nodejs/libatomic.patch index d987ac50be..835c7018de 100644 --- a/meta-oe/recipes-devtools/nodejs/nodejs/libatomic.patch +++ b/meta-oe/recipes-devtools/nodejs/nodejs/libatomic.patch | |||
| @@ -17,6 +17,10 @@ Fix: | |||
| 17 | Upstream-Status: Inappropriate [OE specific] | 17 | Upstream-Status: Inappropriate [OE specific] |
| 18 | 18 | ||
| 19 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | 19 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> |
| 20 | |||
| 21 | Added libatomic library explicitly to x86 targets. | ||
| 22 | |||
| 23 | Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com> | ||
| 20 | --- | 24 | --- |
| 21 | node.gyp | 13 ++++++++++++- | 25 | node.gyp | 13 ++++++++++++- |
| 22 | tools/v8_gypfiles/v8.gyp | 15 ++++++++++++--- | 26 | tools/v8_gypfiles/v8.gyp | 15 ++++++++++++--- |
| @@ -26,7 +30,7 @@ diff --git a/node.gyp b/node.gyp | |||
| 26 | index b425f443..f296f35c 100644 | 30 | index b425f443..f296f35c 100644 |
| 27 | --- a/node.gyp | 31 | --- a/node.gyp |
| 28 | +++ b/node.gyp | 32 | +++ b/node.gyp |
| 29 | @@ -487,7 +487,18 @@ | 33 | @@ -503,7 +503,18 @@ |
| 30 | ], | 34 | ], |
| 31 | }], | 35 | }], |
| 32 | ['OS=="linux" and clang==1', { | 36 | ['OS=="linux" and clang==1', { |
| @@ -50,7 +54,7 @@ diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp | |||
| 50 | index b23263cf..dcabf4ca 100644 | 54 | index b23263cf..dcabf4ca 100644 |
| 51 | --- a/tools/v8_gypfiles/v8.gyp | 55 | --- a/tools/v8_gypfiles/v8.gyp |
| 52 | +++ b/tools/v8_gypfiles/v8.gyp | 56 | +++ b/tools/v8_gypfiles/v8.gyp |
| 53 | @@ -1100,9 +1100,18 @@ | 57 | @@ -1348,9 +1348,18 @@ |
| 54 | # Platforms that don't have Compare-And-Swap (CAS) support need to link atomic library | 58 | # Platforms that don't have Compare-And-Swap (CAS) support need to link atomic library |
| 55 | # to implement atomic memory access | 59 | # to implement atomic memory access |
| 56 | ['v8_current_cpu in ["mips64", "mips64el", "ppc", "arm", "riscv64", "loong64"]', { | 60 | ['v8_current_cpu in ["mips64", "mips64el", "ppc", "arm", "riscv64", "loong64"]', { |
| @@ -72,6 +76,21 @@ index b23263cf..dcabf4ca 100644 | |||
| 72 | }], | 76 | }], |
| 73 | ], | 77 | ], |
| 74 | }, # v8_base_without_compiler | 78 | }, # v8_base_without_compiler |
| 75 | -- | 79 | diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp |
| 76 | 2.35.5 | 80 | index cb82d4f15bc..65cb123b7bf 100644 |
| 77 | 81 | --- a/tools/v8_gypfiles/v8.gyp | |
| 82 | +++ b/tools/v8_gypfiles/v8.gyp | ||
| 83 | @@ -1820,6 +1820,13 @@ | ||
| 84 | ['enable_lto=="true"', { | ||
| 85 | 'ldflags': [ '-fno-lto' ], | ||
| 86 | }], | ||
| 87 | + # For future patch-rebases: this hunk is in mksnapshot target. | ||
| 88 | + # ia32 includes x86 also | ||
| 89 | + ['v8_target_arch=="ia32"', { | ||
| 90 | + 'link_settings': { | ||
| 91 | + 'libraries': ['-latomic'] | ||
| 92 | + } | ||
| 93 | + }], | ||
| 94 | ], | ||
| 95 | }, # mksnapshot | ||
| 96 | { | ||
diff --git a/meta-oe/recipes-devtools/nodejs/nodejs_22.22.0.bb b/meta-oe/recipes-devtools/nodejs/nodejs_22.22.0.bb index 1ef01cc3b2..b3a4fb4245 100644 --- a/meta-oe/recipes-devtools/nodejs/nodejs_22.22.0.bb +++ b/meta-oe/recipes-devtools/nodejs/nodejs_22.22.0.bb | |||
| @@ -133,8 +133,6 @@ python do_create_v8_qemu_wrapper () { | |||
| 133 | do_create_v8_qemu_wrapper[dirs] = "${B}" | 133 | do_create_v8_qemu_wrapper[dirs] = "${B}" |
| 134 | addtask create_v8_qemu_wrapper after do_configure before do_compile | 134 | addtask create_v8_qemu_wrapper after do_configure before do_compile |
| 135 | 135 | ||
| 136 | LDFLAGS:append:x86 = " -latomic" | ||
| 137 | |||
| 138 | export CC_host | 136 | export CC_host |
| 139 | export CFLAGS_host | 137 | export CFLAGS_host |
| 140 | export CXX_host | 138 | export CXX_host |
