commit:     23f1241fe1802ab3561c15f699d6b48b39a59471
Author:     William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 17 18:26:43 2022 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sat Sep 17 18:38:51 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=23f1241f

net-libs/nodejs: force libgcc as support lib

Upstream behavior is correct wrt libatomic (unconditionally adding it)
due to their use of atomic_is_lock_free which is yet to be added to
compiler-rt (stuck in review hell at https://reviews.llvm.org/D85044).

This necessitates forcing libgcc as support lib.  Linking to libatomic
from gcc is dynamic, so sys-devel/gcc has to go in RDEPEND.  Clang can
be forced to use libgcc with --rtlib=libgcc, even with
USE=default-compiler-rt (which is the original cuase of the bug in
question).

    This applies this pull request to 14.x and 16.x.

Closes: https://github.com/gentoo/gentoo/pull/27271
Signed-off-by: William Hubbs <williamh <AT> gentoo.org>

 net-libs/nodejs/nodejs-14.20.0.ebuild | 9 ++++++++-
 net-libs/nodejs/nodejs-16.17.0.ebuild | 9 ++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/net-libs/nodejs/nodejs-14.20.0.ebuild 
b/net-libs/nodejs/nodejs-14.20.0.ebuild
index 2068d2449ede..00c75dddb7a0 100644
--- a/net-libs/nodejs/nodejs-14.20.0.ebuild
+++ b/net-libs/nodejs/nodejs-14.20.0.ebuild
@@ -41,7 +41,8 @@ RDEPEND=">=app-arch/brotli-1.0.9:=
        system-ssl? (
                >=dev-libs/openssl-1.1.1:0=
                <dev-libs/openssl-3.0.0_beta1:0=
-       )"
+       )
+       sys-devel/gcc:*"
 BDEPEND="${PYTHON_DEPS}
        sys-apps/coreutils
        virtual/pkgconfig
@@ -112,6 +113,12 @@ src_configure() {
 
        # LTO compiler flags are handled by configure.py itself
        filter-flags '-flto*'
+       # nodejs unconditionally links to libatomic #869992
+       # specifically it requires __atomic_is_lock_free which
+       # is not yet implemented by sys-libs/compiler-rt (see
+       # https://reviews.llvm.org/D85044?id=287068), therefore
+       # we depend on gcc and force using libgcc as the support lib
+       tc-is-clang && append-ldflags "--rtlib=libgcc --unwindlib=libgcc"
 
        local myconf=(
                --shared-brotli

diff --git a/net-libs/nodejs/nodejs-16.17.0.ebuild 
b/net-libs/nodejs/nodejs-16.17.0.ebuild
index b091095897cc..4640504d0f55 100644
--- a/net-libs/nodejs/nodejs-16.17.0.ebuild
+++ b/net-libs/nodejs/nodejs-16.17.0.ebuild
@@ -28,7 +28,8 @@ IUSE="cpu_flags_x86_sse2 debug doc +icu inspector lto +npm 
pax-kernel +snapshot
 REQUIRED_USE="inspector? ( icu ssl )
        npm? ( ssl )
        system-icu? ( icu )
-       system-ssl? ( ssl )"
+       system-ssl? ( ssl )
+       sys-devel/gcc:*"
 
 RESTRICT="!test? ( test )"
 
@@ -108,6 +109,12 @@ src_configure() {
 
        # LTO compiler flags are handled by configure.py itself
        filter-flags '-flto*'
+       # nodejs unconditionally links to libatomic #869992
+       # specifically it requires __atomic_is_lock_free which
+       # is not yet implemented by sys-libs/compiler-rt (see
+       # https://reviews.llvm.org/D85044?id=287068), therefore
+       # we depend on gcc and force using libgcc as the support lib
+       tc-is-clang && append-ldflags "--rtlib=libgcc --unwindlib=libgcc"
 
        local myconf=(
                --shared-brotli

Reply via email to