]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix LIBC_PROG_BINUTILS for -fuse-ld=lld
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 26 Oct 2021 12:02:57 +0000 (09:02 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 29 Oct 2021 12:21:37 +0000 (09:21 -0300)
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 <maskray@google.com>
aclocal.m4
configure

index 65a12df047c4880c45b4aad3f8506f4b3419f8d6..3a90d4f679a996c22477a7b363c0c2a7b56b8164 100644 (file)
@@ -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`
index 3227e434d3a62c2386cc2f093d2d209896c603d7..367db1c1acb3ad13c2cfa6ce905a067a218bdb78 100755 (executable)
--- 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`