diff options
| author | Michal Rostecki <vadorovsky@protonmail.com> | 2025-08-04 13:55:09 +0200 |
|---|---|---|
| committer | Michał Górny <mgorny@gentoo.org> | 2025-08-06 14:29:20 +0200 |
| commit | f4e632a335124d01497ead01ae93855c5d6c4c21 (patch) | |
| tree | eb17a535ca5e8c96b96abfd4dcfbe0b1624ea98e /llvm-runtimes/libgcc | |
| parent | e6d53eab57db5cacde6735750ebd51ef0b6fbf0b (diff) | |
| download | gentoo-f4e632a335124d01497ead01ae93855c5d6c4c21.tar.gz gentoo-f4e632a335124d01497ead01ae93855c5d6c4c21.tar.bz2 gentoo-f4e632a335124d01497ead01ae93855c5d6c4c21.zip | |
llvm-runtimes/libgcc: Support build with cross emerge wrapper
When cross emerge wrapper is used, using `llvm_prepend_path` without
any options, results in prepending the following path:
```
${ESYSROOT}/usr/lib/llvm/${slot}/bin
```
For example:
```
/usr/aarch64-unknown-linux-musl/usr/lib/llvm/19/bin
```
The problem is that cross emerge wrapper uses a cross clang wrapper as
a compiler, e.g. `aarch64-unknown-linux-musl-clang`. However, the file
with such name can be usually found in two places:
* `/usr/lib/llvm/19/bin/aarch64-unknown-linux-musl-clang`, which is
a clang wrapper that calls the host clang with appropriate
configuration. We want to call that file.
* `/usr/aarch64-unknown-linux-musl/usr/lib/llvm/19/bin/aarch64-unknown-linux-musl-clang`,
which is an actual aarch64 compiler binary. We cannot execute it on
x86_64, or other incompatible host.
However, the path added by `llvm_prepend_path` causes resolution of
`aarch64-unknown-linux-musl-clang` to the second path, therefore causing
errors like:
```
/usr/aarch64-unknown-linux-musl/usr/lib/llvm/19/bin/clang: cannot execute binary file: Exec format error
```
Solve that by:
* Using `LLVM_ROOT` CMake parameter to point the build to LLVM library
artifacts.
* Using `llvm_prepend_path` with `-b` argument if we need clang, which
is the case when either `clang` or `test` USE flags are enabled.
Signed-off-by: Michal Rostecki <vadorovsky@protonmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/39280
Closes: https://github.com/gentoo/gentoo/pull/39280
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Part-of: https://github.com/gentoo/gentoo/pull/39280
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'llvm-runtimes/libgcc')
| -rw-r--r-- | llvm-runtimes/libgcc/libgcc-19.1.7-r1.ebuild | 7 | ||||
| -rw-r--r-- | llvm-runtimes/libgcc/libgcc-20.1.8.ebuild | 5 | ||||
| -rw-r--r-- | llvm-runtimes/libgcc/libgcc-21.1.0.9999.ebuild | 5 | ||||
| -rw-r--r-- | llvm-runtimes/libgcc/libgcc-22.0.0.9999.ebuild | 5 |
4 files changed, 17 insertions, 5 deletions
diff --git a/llvm-runtimes/libgcc/libgcc-19.1.7-r1.ebuild b/llvm-runtimes/libgcc/libgcc-19.1.7-r1.ebuild index d0a3126ebcf1..3ae6287c30eb 100644 --- a/llvm-runtimes/libgcc/libgcc-19.1.7-r1.ebuild +++ b/llvm-runtimes/libgcc/libgcc-19.1.7-r1.ebuild @@ -3,7 +3,7 @@ EAPI=8 -PYTHON_COMPAT=( python3_{10..13} ) +PYTHON_COMPAT=( python3_{11..13} ) inherit cmake crossdev flag-o-matic llvm.org llvm-utils python-any-r1 inherit toolchain-funcs @@ -58,7 +58,9 @@ src_configure() { # COMPILER_RT_BUILTINS_HIDE_SYMBOLS option - compatibility with libgcc requires # visibility of all symbols. - llvm_prepend_path "${LLVM_MAJOR}" + if use clang || use test; then + llvm_prepend_path -b "${LLVM_MAJOR}" + fi # LLVM_ENABLE_ASSERTIONS=NO does not guarantee this for us, #614844 use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG" @@ -68,6 +70,7 @@ src_configure() { local mycmakeargs=( -DCOMPILER_RT_INSTALL_PATH="${EPREFIX}/usr/lib/clang/${LLVM_MAJOR}" + -DLLVM_ROOT="${ESYSROOT}/usr/lib/llvm/${LLVM_MAJOR}" -DCOMPILER_RT_INCLUDE_TESTS=$(usex test) -DCOMPILER_RT_BUILD_CRT=OFF diff --git a/llvm-runtimes/libgcc/libgcc-20.1.8.ebuild b/llvm-runtimes/libgcc/libgcc-20.1.8.ebuild index a3e93dfffb7e..310ed22721e8 100644 --- a/llvm-runtimes/libgcc/libgcc-20.1.8.ebuild +++ b/llvm-runtimes/libgcc/libgcc-20.1.8.ebuild @@ -58,7 +58,9 @@ src_configure() { # COMPILER_RT_BUILTINS_HIDE_SYMBOLS option - compatibility with libgcc requires # visibility of all symbols. - llvm_prepend_path "${LLVM_MAJOR}" + if use clang || use test; then + llvm_prepend_path -b "${LLVM_MAJOR}" + fi # LLVM_ENABLE_ASSERTIONS=NO does not guarantee this for us, #614844 use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG" @@ -68,6 +70,7 @@ src_configure() { local mycmakeargs=( -DCOMPILER_RT_INSTALL_PATH="${EPREFIX}/usr/lib/clang/${LLVM_MAJOR}" + -DLLVM_ROOT="${ESYSROOT}/usr/lib/llvm/${LLVM_MAJOR}" -DCOMPILER_RT_INCLUDE_TESTS=$(usex test) -DCOMPILER_RT_BUILD_CRT=OFF diff --git a/llvm-runtimes/libgcc/libgcc-21.1.0.9999.ebuild b/llvm-runtimes/libgcc/libgcc-21.1.0.9999.ebuild index 285e3592a666..52833f54b8a8 100644 --- a/llvm-runtimes/libgcc/libgcc-21.1.0.9999.ebuild +++ b/llvm-runtimes/libgcc/libgcc-21.1.0.9999.ebuild @@ -57,7 +57,9 @@ src_configure() { # COMPILER_RT_BUILTINS_HIDE_SYMBOLS option - compatibility with libgcc requires # visibility of all symbols. - llvm_prepend_path "${LLVM_MAJOR}" + if use clang || use test; then + llvm_prepend_path -b "${LLVM_MAJOR}" + fi # LLVM_ENABLE_ASSERTIONS=NO does not guarantee this for us, #614844 use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG" @@ -67,6 +69,7 @@ src_configure() { local mycmakeargs=( -DCOMPILER_RT_INSTALL_PATH="${EPREFIX}/usr/lib/clang/${LLVM_MAJOR}" + -DLLVM_ROOT="${ESYSROOT}/usr/lib/llvm/${LLVM_MAJOR}" -DCOMPILER_RT_INCLUDE_TESTS=$(usex test) -DCOMPILER_RT_BUILD_CRT=OFF diff --git a/llvm-runtimes/libgcc/libgcc-22.0.0.9999.ebuild b/llvm-runtimes/libgcc/libgcc-22.0.0.9999.ebuild index a3b9a91d2a2e..eebc5d612900 100644 --- a/llvm-runtimes/libgcc/libgcc-22.0.0.9999.ebuild +++ b/llvm-runtimes/libgcc/libgcc-22.0.0.9999.ebuild @@ -57,7 +57,9 @@ src_configure() { # COMPILER_RT_BUILTINS_HIDE_SYMBOLS option - compatibility with libgcc requires # visibility of all symbols. - llvm_prepend_path "${LLVM_MAJOR}" + if use clang || use test; then + llvm_prepend_path -b "${LLVM_MAJOR}" + fi # LLVM_ENABLE_ASSERTIONS=NO does not guarantee this for us, #614844 use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG" @@ -67,6 +69,7 @@ src_configure() { local mycmakeargs=( -DCOMPILER_RT_INSTALL_PATH="${EPREFIX}/usr/lib/clang/${LLVM_MAJOR}" + -DLLVM_ROOT="${ESYSROOT}/usr/lib/llvm/${LLVM_MAJOR}" -DCOMPILER_RT_INCLUDE_TESTS=$(usex test) -DCOMPILER_RT_BUILD_CRT=OFF |
