commit:     50f739129dc820687c2903a9d038f951fa79accc
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 19 14:46:40 2025 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Dec 19 14:47:22 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=50f73912

sys-libs/glibc: Remove gcc forcing; glibc can be built with clang now

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-libs/glibc/glibc-9999.ebuild | 78 ++++++++--------------------------------
 1 file changed, 15 insertions(+), 63 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 095b33bd38e5..9307d6f02b6c 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -155,7 +155,9 @@ if [[ ${CATEGORY} == cross-* ]] ; then
 else
        BDEPEND+="
                >=sys-devel/binutils-2.27
-               >=sys-devel/gcc-6.2
+               || ( ( >=sys-devel/gcc-6.2 )
+                    ( >=sys-devel/gcc-6.2 >=llvm-core/clang-18 )
+                    ( >=llvm-core/clang-18 >=llvm-runtimes/libgcc-18 ) )
        "
        DEPEND+=" virtual/os-headers "
        RDEPEND+="
@@ -599,68 +601,18 @@ setup_env() {
        export glibc__ORIG_CXX=${CXX}
        export glibc__ORIG_CPP=${CPP}
 
-       if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
-               export glibc__force_gcc=yes
-               # once this is toggled on, it needs to stay on, since with CPP 
manipulated
-               # tc-is-clang does not work correctly anymore...
-       fi
-
-       if [[ ${glibc__force_gcc} == "yes" ]] ; then
-               # If we are running in an otherwise clang/llvm environment, we 
need to
-               # recover the proper gcc and binutils settings here, at least 
until glibc
-               # is finally building with clang. So let's override everything 
that is
-               # set in the clang profiles.
-               # Want to shoot yourself into the foot? Set USE=custom-cflags, 
that's always
-               # a good start into that direction.
-               # Also, if you're crosscompiling, let's assume you know what 
you are doing.
-               # Hopefully.
-               # Last, we need the settings of the *build* environment, not of 
the
-               # target environment...
-
-               local current_binutils_path=$(env CHOST="${CBUILD}" 
ROOT="${BROOT}" binutils-config -B "${CTARGET}")
-               local current_gcc_path=$(env ROOT="${BROOT}" gcc-config -B)
-               einfo "Overriding clang configuration, since it won't work here"
-
-               export CC="${current_gcc_path}/${CTARGET}-gcc"
-               export CPP="${current_gcc_path}/${CTARGET}-cpp"
-               export CXX="${current_gcc_path}/${CTARGET}-g++"
-               export LD="${current_binutils_path}/ld.bfd"
-               export AR="${current_binutils_path}/ar"
-               export AS="${current_binutils_path}/as"
-               export NM="${current_binutils_path}/nm"
-               export STRIP="${current_binutils_path}/strip"
-               export RANLIB="${current_binutils_path}/ranlib"
-               export OBJCOPY="${current_binutils_path}/objcopy"
-               export STRINGS="${current_binutils_path}/strings"
-               export OBJDUMP="${current_binutils_path}/objdump"
-               export READELF="${current_binutils_path}/readelf"
-               export ADDR2LINE="${current_binutils_path}/addr2line"
-
-               # do we need to also do flags munging here? yes! at least...
-               filter-flags '-fuse-ld=*'
-               filter-flags '-D_FORTIFY_SOURCE=*'
-
-       else
-
-               # this is the "normal" case
-
-               export CC="$(tc-getCC ${CTARGET})"
-               export CXX="$(tc-getCXX ${CTARGET})"
-               export CPP="$(tc-getCPP ${CTARGET})"
-
-               # Always use tuple-prefixed toolchain. For non-native ABI 
glibc's configure
-               # can't detect them automatically due to ${CHOST} mismatch and 
fallbacks
-               # to unprefixed tools. Similar to 
multilib.eclass:multilib_toolchain_setup().
-               export NM="$(tc-getNM ${CTARGET})"
-               export READELF="$(tc-getREADELF ${CTARGET})"
-
-       fi
-
-       # We need to export CFLAGS with abi information in them because glibc's
-       # configure script checks CFLAGS for some targets (like mips).  Keep
-       # around the original clean value to avoid appending multiple ABIs on
-       # top of each other. (Why does the comment talk about CFLAGS if the code
-       # acts on CC?)
+       # Always use tuple-prefixed toolchain. For non-native ABI glibc's 
configure
+       # can't detect them automatically due to ${CHOST} mismatch and fallbacks
+       # to unprefixed tools. Similar to 
multilib.eclass:multilib_toolchain_setup().
+       export CC="$(tc-getCC ${CTARGET})"
+       export CXX="$(tc-getCXX ${CTARGET})"
+       export CPP="$(tc-getCPP ${CTARGET})"
+       export NM="$(tc-getNM ${CTARGET})"
+       export READELF="$(tc-getREADELF ${CTARGET})"
+
+       # We need to move CFLAGS with abi information into CC etc per glibc 
upstream
+       # requirement. Keep around the original clean value to avoid appending
+       # multiple ABIs on top of each other.
        export glibc__GLIBC_CC=${CC}
        export glibc__GLIBC_CXX=${CXX}
        export glibc__GLIBC_CPP=${CPP}

Reply via email to