public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Fangrui Song <maskray@google.com>
To: libc-alpha@sourceware.org
Subject: [PATCH] configure: Allow LD to be a linker other than GNU ld and gold
Date: Fri, 13 Mar 2020 13:46:34 -0700	[thread overview]
Message-ID: <20200313204634.7jrgd2m5ga3l5drk@google.com> (raw)

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

             reply	other threads:[~2020-03-13 20:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-13 20:46 Fangrui Song [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200313204634.7jrgd2m5ga3l5drk@google.com \
    --to=maskray@google.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).