public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] configure: Allow LD to be a linker other than GNU ld and gold
@ 2020-03-13 20:46 Fangrui Song
  2020-04-07 22:00 ` Adhemerval Zanella
  2020-04-08  6:43 ` Florian Weimer
  0 siblings, 2 replies; 10+ messages in thread
From: Fangrui Song @ 2020-03-13 20:46 UTC (permalink / raw)
  To: libc-alpha

When using lld as the linker, configure prints a confusing message.

*** These critical programs are missing or too old: GNU ld

lld>=8 can build glibc with very few patches. lld may be built with a
custom version information (e.g. git commit ID), so a version check is not
useful at all.
---
 configure    | 13 ++++++++-----
 configure.ac | 13 ++++++++-----
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/configure b/configure
index 8df47d61f8..e3922b6d5d 100755
--- a/configure
+++ b/configure
@@ -4615,9 +4615,10 @@ if test $ac_verc_fail = yes; then
 fi
 
 
-if test -n "`$LD --version | sed -n 's/^GNU \(gold\).*$/\1/p'`"; then
+case $($LD --version) in
+  "GNU gold"*)
   # Accept gold 1.14 or higher
-  for ac_prog in $LD
+    for ac_prog in $LD
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
@@ -4680,8 +4681,9 @@ if test $ac_verc_fail = yes; then
   LD=: critic_missing="$critic_missing GNU gold"
 fi
 
-else
-  for ac_prog in $LD
+    ;;
+  "GNU ld"*)
+    for ac_prog in $LD
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
@@ -4744,7 +4746,8 @@ if test $ac_verc_fail = yes; then
   LD=: critic_missing="$critic_missing GNU ld"
 fi
 
-fi
+    ;;
+esac
 
 # These programs are version sensitive.
 
diff --git a/configure.ac b/configure.ac
index 5f229679a9..faa45946ad 100644
--- a/configure.ac
+++ b/configure.ac
@@ -986,18 +986,21 @@ AC_CHECK_PROG_VER(AS, $AS, --version,
 		  [2.1[0-9][0-9]*|2.2[5-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*],
 		  AS=: critic_missing="$critic_missing as")
 
-if test -n "`$LD --version | sed -n 's/^GNU \(gold\).*$/\1/p'`"; then
+case $($LD --version) in
+  "GNU gold"*)
   # Accept gold 1.14 or higher
-  AC_CHECK_PROG_VER(LD, $LD, --version,
+    AC_CHECK_PROG_VER(LD, $LD, --version,
 		    [GNU gold.* \([0-9][0-9]*\.[0-9.]*\)],
 		    [1.1[4-9]*|1.[2-9][0-9]*|1.1[0-9][0-9]*|[2-9].*|[1-9][0-9]*],
 		    LD=: critic_missing="$critic_missing GNU gold")
-else
-  AC_CHECK_PROG_VER(LD, $LD, --version,
+    ;;
+  "GNU ld"*)
+    AC_CHECK_PROG_VER(LD, $LD, --version,
 		    [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
 		    [2.1[0-9][0-9]*|2.2[5-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*],
 		    LD=: critic_missing="$critic_missing GNU ld")
-fi
+    ;;
+esac
 
 # These programs are version sensitive.
 AC_CHECK_TOOL_PREFIX
-- 
2.25.1.481.gfbce0eb801-goog

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-04-12  0:28 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-13 20:46 [PATCH] configure: Allow LD to be a linker other than GNU ld and gold Fangrui Song
2020-04-07 22:00 ` Adhemerval Zanella
2020-04-08  6:43 ` Florian Weimer
2020-04-08  7:11   ` Fangrui Song
2020-04-11 17:07     ` Florian Weimer
2020-04-11 18:42       ` Fangrui Song
2020-04-11 18:58         ` Florian Weimer
2020-04-11 19:21           ` Fangrui Song
2020-04-11 23:53             ` Fangrui Song
2020-04-12  0:28               ` H.J. Lu

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).