From: Adhemerval Zanella Date: Tue, 26 Oct 2021 12:02:57 +0000 (-0300) Subject: Fix LIBC_PROG_BINUTILS for -fuse-ld=lld X-Git-Tag: glibc-2.35~377 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3d5ecb624638627869e6965410f558b15db6946e;p=thirdparty%2Fglibc.git Fix LIBC_PROG_BINUTILS for -fuse-ld=lld GCC does not print the correct linker when -fuse-ld=lld is used with the -print-prog-name=ld: $ gcc -v 2>&1 | tail -n 1 gcc version 11.2.0 (Ubuntu 11.2.0-7ubuntu2) $ gcc ld This is different than for gold: $ gcc -fuse-ld=gold -print-prog-name=ld ld.gold Using ld.lld as the static linker name prints the expected result. This is only required when -fuse-ld=lld is used, if lld is used as the 'ld' programs (through a symlink) LIBC_PROG_BINUTILS works as expected. Checked on x86_64-linux-gnu. Reviewed-by: Fangrui Song --- diff --git a/aclocal.m4 b/aclocal.m4 index 65a12df047c..3a90d4f679a 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -114,8 +114,12 @@ if test -n "$path_binutils"; then path_binutils=`(cd $path_binutils; pwd) | sed 's%/*$%/%'` CC="$CC -B$path_binutils" fi +case "$CC" in + *fuse-ld=lld*) LDNAME=ld.lld;; + *) LDNAME=ld;; +esac AS=`$CC -print-prog-name=as` -LD=`$CC -print-prog-name=ld` +LD=`$CC -print-prog-name=$LDNAME` AR=`$CC -print-prog-name=ar` AC_SUBST(AR) OBJDUMP=`$CC -print-prog-name=objdump` diff --git a/configure b/configure index 3227e434d3a..367db1c1acb 100755 --- a/configure +++ b/configure @@ -4549,8 +4549,12 @@ if test -n "$path_binutils"; then path_binutils=`(cd $path_binutils; pwd) | sed 's%/*$%/%'` CC="$CC -B$path_binutils" fi +case "$CC" in + *fuse-ld=lld*) LDNAME=ld.lld;; + *) LDNAME=ld;; +esac AS=`$CC -print-prog-name=as` -LD=`$CC -print-prog-name=ld` +LD=`$CC -print-prog-name=$LDNAME` AR=`$CC -print-prog-name=ar` OBJDUMP=`$CC -print-prog-name=objdump`