public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/maskray/relr] Fix LIBC_PROG_BINUTILS for -fuse-ld=lld
@ 2021-10-29 22:21 Fangrui Song
0 siblings, 0 replies; only message in thread
From: Fangrui Song @ 2021-10-29 22:21 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=3d5ecb624638627869e6965410f558b15db6946e
commit 3d5ecb624638627869e6965410f558b15db6946e
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Tue Oct 26 09:02:57 2021 -0300
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>
Diff:
---
aclocal.m4 | 6 +++++-
configure | 6 +++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/aclocal.m4 b/aclocal.m4
index 65a12df047..3a90d4f679 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 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`
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-10-29 22:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-29 22:21 [glibc/maskray/relr] Fix LIBC_PROG_BINUTILS for -fuse-ld=lld Fangrui Song
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).