commit:     f1d6e8dd62416c2c4fba99600600b068fdbc21fd
Author:     Michal Rostecki <vadorovsky <AT> protonmail <DOT> com>
AuthorDate: Tue Aug 26 17:00:49 2025 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Sep  2 13:17:44 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f1d6e8dd

llvm-runtimes/compiler-rt: Use the partial clang configuration files

Initial installation or upgrade of compiler-rt happens before the main
slotted clang configuration file is created by llvm-core/clang-runtime.
Building compiler-rt requires only the linker configuration (`-fuse-ld`)
to be present. To fix the initial builds, we can use the partial
configuration provided by llvm-core/clang-linker-config.

Signed-off-by: Michal Rostecki <vadorovsky <AT> protonmail.com>
Closes: https://bugs.gentoo.org/951445
Part-of: https://github.com/gentoo/gentoo/pull/42663
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
Part-of: https://github.com/gentoo/gentoo/pull/42663
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 ....0.9999.ebuild => compiler-rt-20.1.8-r1.ebuild} | 23 +++++++++++++++++-----
 ....0.9999.ebuild => compiler-rt-21.1.0-r1.ebuild} | 21 ++++++++++++++++----
 .../compiler-rt/compiler-rt-22.0.0.9999.ebuild     | 18 ++++++++++++++---
 .../compiler-rt-22.0.0_pre20250831.ebuild          | 18 ++++++++++++++---
 4 files changed, 65 insertions(+), 15 deletions(-)

diff --git a/llvm-runtimes/compiler-rt/compiler-rt-22.0.0.9999.ebuild 
b/llvm-runtimes/compiler-rt/compiler-rt-20.1.8-r1.ebuild
similarity index 86%
copy from llvm-runtimes/compiler-rt/compiler-rt-22.0.0.9999.ebuild
copy to llvm-runtimes/compiler-rt/compiler-rt-20.1.8-r1.ebuild
index 2a785527c374..200e6d37d46f 100644
--- a/llvm-runtimes/compiler-rt/compiler-rt-22.0.0.9999.ebuild
+++ b/llvm-runtimes/compiler-rt/compiler-rt-20.1.8-r1.ebuild
@@ -12,7 +12,8 @@ HOMEPAGE="https://llvm.org/";
 
 LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )"
 SLOT="${LLVM_MAJOR}"
-IUSE="+abi_x86_32 abi_x86_64 +atomic-builtins +clang +debug test"
+KEYWORDS="~amd64 ~arm ~arm64 ~loong ~mips ~ppc64 ~riscv ~x86 ~amd64-linux 
~arm64-macos ~ppc-macos ~x64-macos"
+IUSE="+abi_x86_32 abi_x86_64 +atomic-builtins +clang debug test"
 REQUIRED_USE="atomic-builtins? ( clang )"
 RESTRICT="!test? ( test ) !clang? ( test )"
 
@@ -20,7 +21,10 @@ DEPEND="
        llvm-core/llvm:${LLVM_MAJOR}
 "
 BDEPEND="
-       clang? ( llvm-core/clang:${LLVM_MAJOR} )
+       clang? (
+               llvm-core/clang:${LLVM_MAJOR}
+               llvm-core/clang-linker-config:${LLVM_MAJOR}
+       )
        test? (
                $(python_gen_any_dep ">=dev-python/lit-15[\${PYTHON_USEDEP}]")
                =llvm-core/clang-${LLVM_VERSION}*:${LLVM_MAJOR}
@@ -30,7 +34,7 @@ BDEPEND="
        )
 "
 
-LLVM_COMPONENTS=( compiler-rt cmake llvm/cmake third-party/siphash )
+LLVM_COMPONENTS=( compiler-rt cmake llvm/cmake )
 LLVM_TEST_COMPONENTS=( llvm/include/llvm/TargetParser )
 llvm.org_set_globals
 
@@ -77,11 +81,20 @@ src_configure() {
                # Only do this conditionally to allow overriding with
                # e.g. CC=clang-13 in case of breakage
                if ! tc-is-clang ; then
-                       local -x CC=${CHOST}-clang
-                       local -x CXX=${CHOST}-clang++
+                       local -x CC=${CHOST}-clang-${LLVM_MAJOR}
+                       local -x CXX=${CHOST}-clang++-${LLVM_MAJOR}
                fi
 
                strip-unsupported-flags
+
+               # The full clang configuration might not be ready yet. Given 
that compiler-rt
+               # require runtime, use only the linker configuration.
+               local flags=(
+                       
--config="${ESYSROOT}"/etc/clang/"${LLVM_MAJOR}"/gentoo-linker.cfg
+               )
+               local -x CFLAGS="${CFLAGS} ${flags[@]}"
+               local -x CXXFLAGS="${CXXFLAGS} ${flags[@]}"
+               local -x LDFLAGS="${LDFLAGS} ${flags[@]}"
        fi
 
        if ! is_crosspkg && ! test_compiler ; then

diff --git a/llvm-runtimes/compiler-rt/compiler-rt-22.0.0.9999.ebuild 
b/llvm-runtimes/compiler-rt/compiler-rt-21.1.0-r1.ebuild
similarity index 87%
copy from llvm-runtimes/compiler-rt/compiler-rt-22.0.0.9999.ebuild
copy to llvm-runtimes/compiler-rt/compiler-rt-21.1.0-r1.ebuild
index 2a785527c374..9d0337799be0 100644
--- a/llvm-runtimes/compiler-rt/compiler-rt-22.0.0.9999.ebuild
+++ b/llvm-runtimes/compiler-rt/compiler-rt-21.1.0-r1.ebuild
@@ -12,7 +12,8 @@ HOMEPAGE="https://llvm.org/";
 
 LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )"
 SLOT="${LLVM_MAJOR}"
-IUSE="+abi_x86_32 abi_x86_64 +atomic-builtins +clang +debug test"
+KEYWORDS="~amd64 ~arm ~arm64 ~loong ~mips ~ppc64 ~riscv ~x86 ~amd64-linux 
~arm64-macos ~ppc-macos ~x64-macos"
+IUSE="+abi_x86_32 abi_x86_64 +atomic-builtins +clang debug test"
 REQUIRED_USE="atomic-builtins? ( clang )"
 RESTRICT="!test? ( test ) !clang? ( test )"
 
@@ -20,7 +21,10 @@ DEPEND="
        llvm-core/llvm:${LLVM_MAJOR}
 "
 BDEPEND="
-       clang? ( llvm-core/clang:${LLVM_MAJOR} )
+       clang? (
+               llvm-core/clang:${LLVM_MAJOR}
+               llvm-core/clang-linker-config:${LLVM_MAJOR}
+       )
        test? (
                $(python_gen_any_dep ">=dev-python/lit-15[\${PYTHON_USEDEP}]")
                =llvm-core/clang-${LLVM_VERSION}*:${LLVM_MAJOR}
@@ -77,11 +81,20 @@ src_configure() {
                # Only do this conditionally to allow overriding with
                # e.g. CC=clang-13 in case of breakage
                if ! tc-is-clang ; then
-                       local -x CC=${CHOST}-clang
-                       local -x CXX=${CHOST}-clang++
+                       local -x CC=${CHOST}-clang-${LLVM_MAJOR}
+                       local -x CXX=${CHOST}-clang++-${LLVM_MAJOR}
                fi
 
                strip-unsupported-flags
+
+               # The full clang configuration might not be ready yet. Given 
that compiler-rt
+               # require runtime, use only the linker configuration.
+               local flags=(
+                       
--config="${ESYSROOT}"/etc/clang/"${LLVM_MAJOR}"/gentoo-linker.cfg
+               )
+               local -x CFLAGS="${CFLAGS} ${flags[@]}"
+               local -x CXXFLAGS="${CXXFLAGS} ${flags[@]}"
+               local -x LDFLAGS="${LDFLAGS} ${flags[@]}"
        fi
 
        if ! is_crosspkg && ! test_compiler ; then

diff --git a/llvm-runtimes/compiler-rt/compiler-rt-22.0.0.9999.ebuild 
b/llvm-runtimes/compiler-rt/compiler-rt-22.0.0.9999.ebuild
index 2a785527c374..86fe125a08cd 100644
--- a/llvm-runtimes/compiler-rt/compiler-rt-22.0.0.9999.ebuild
+++ b/llvm-runtimes/compiler-rt/compiler-rt-22.0.0.9999.ebuild
@@ -20,7 +20,10 @@ DEPEND="
        llvm-core/llvm:${LLVM_MAJOR}
 "
 BDEPEND="
-       clang? ( llvm-core/clang:${LLVM_MAJOR} )
+       clang? (
+               llvm-core/clang:${LLVM_MAJOR}
+               llvm-core/clang-linker-config:${LLVM_MAJOR}
+       )
        test? (
                $(python_gen_any_dep ">=dev-python/lit-15[\${PYTHON_USEDEP}]")
                =llvm-core/clang-${LLVM_VERSION}*:${LLVM_MAJOR}
@@ -77,11 +80,20 @@ src_configure() {
                # Only do this conditionally to allow overriding with
                # e.g. CC=clang-13 in case of breakage
                if ! tc-is-clang ; then
-                       local -x CC=${CHOST}-clang
-                       local -x CXX=${CHOST}-clang++
+                       local -x CC=${CHOST}-clang-${LLVM_MAJOR}
+                       local -x CXX=${CHOST}-clang++-${LLVM_MAJOR}
                fi
 
                strip-unsupported-flags
+
+               # The full clang configuration might not be ready yet. Given 
that compiler-rt
+               # require runtime, use only the linker configuration.
+               local flags=(
+                       
--config="${ESYSROOT}"/etc/clang/"${LLVM_MAJOR}"/gentoo-linker.cfg
+               )
+               local -x CFLAGS="${CFLAGS} ${flags[@]}"
+               local -x CXXFLAGS="${CXXFLAGS} ${flags[@]}"
+               local -x LDFLAGS="${LDFLAGS} ${flags[@]}"
        fi
 
        if ! is_crosspkg && ! test_compiler ; then

diff --git a/llvm-runtimes/compiler-rt/compiler-rt-22.0.0_pre20250831.ebuild 
b/llvm-runtimes/compiler-rt/compiler-rt-22.0.0_pre20250831.ebuild
index 2a785527c374..86fe125a08cd 100644
--- a/llvm-runtimes/compiler-rt/compiler-rt-22.0.0_pre20250831.ebuild
+++ b/llvm-runtimes/compiler-rt/compiler-rt-22.0.0_pre20250831.ebuild
@@ -20,7 +20,10 @@ DEPEND="
        llvm-core/llvm:${LLVM_MAJOR}
 "
 BDEPEND="
-       clang? ( llvm-core/clang:${LLVM_MAJOR} )
+       clang? (
+               llvm-core/clang:${LLVM_MAJOR}
+               llvm-core/clang-linker-config:${LLVM_MAJOR}
+       )
        test? (
                $(python_gen_any_dep ">=dev-python/lit-15[\${PYTHON_USEDEP}]")
                =llvm-core/clang-${LLVM_VERSION}*:${LLVM_MAJOR}
@@ -77,11 +80,20 @@ src_configure() {
                # Only do this conditionally to allow overriding with
                # e.g. CC=clang-13 in case of breakage
                if ! tc-is-clang ; then
-                       local -x CC=${CHOST}-clang
-                       local -x CXX=${CHOST}-clang++
+                       local -x CC=${CHOST}-clang-${LLVM_MAJOR}
+                       local -x CXX=${CHOST}-clang++-${LLVM_MAJOR}
                fi
 
                strip-unsupported-flags
+
+               # The full clang configuration might not be ready yet. Given 
that compiler-rt
+               # require runtime, use only the linker configuration.
+               local flags=(
+                       
--config="${ESYSROOT}"/etc/clang/"${LLVM_MAJOR}"/gentoo-linker.cfg
+               )
+               local -x CFLAGS="${CFLAGS} ${flags[@]}"
+               local -x CXXFLAGS="${CXXFLAGS} ${flags[@]}"
+               local -x LDFLAGS="${LDFLAGS} ${flags[@]}"
        fi
 
        if ! is_crosspkg && ! test_compiler ; then

Reply via email to