about summary refs log tree commit diff
path: root/configure
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-10-26 09:02:57 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-10-29 09:21:37 -0300
commit3d5ecb624638627869e6965410f558b15db6946e (patch)
tree07989c89c19c217d024e4d7d3dc63ba0435673e2 /configure
parent66a273d16a63d1ed74a8d14a210a04c6a0f5dd45 (diff)
downloadglibc-3d5ecb624638627869e6965410f558b15db6946e.tar.gz
glibc-3d5ecb624638627869e6965410f558b15db6946e.tar.xz
glibc-3d5ecb624638627869e6965410f558b15db6946e.zip
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 <maskray@google.com>
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure6
1 files changed, 5 insertions, 1 deletions
diff --git a/configure b/configure
index 3227e434d3..367db1c1ac 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`