From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x22f.google.com (mail-oi1-x22f.google.com [IPv6:2607:f8b0:4864:20::22f]) by sourceware.org (Postfix) with ESMTPS id DCD5E385800F for ; Mon, 28 Dec 2020 20:46:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DCD5E385800F Received: by mail-oi1-x22f.google.com with SMTP id l200so12642512oig.9 for ; Mon, 28 Dec 2020 12:46:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=rMMlyAKWZJHi4qdxF+NA+9viM2cgI/0bsBwnayCtyxA=; b=NlkYtLdGKmg9pCslczWV3uLn1uGIad6JuAQr2dfvn5LnYEUvCpBmCf/bVBtOnxVJ4c e34faAyMIIFJNVGqJkkKrzqMkA/LcCCIbAXtlaDi2MWDehpzD5Q4A+udBdw1Ei4VRhZX dIKuAYnMkrJP+bs7pd7tSlHApnwUrbjYQvIBEVf9LOc+wGukPAWCnabvcNvJ0SpWIyi0 VKyibyjOiXpCGaJaUFlcnZJOptVaWj29HNOx2GUk0KW+G7yR+x18PdPXY577Wfz7qQIy U21NAkmBVkn1MGOOYI3vvLSqeLX4+QreuoKNnl+lMspy5OI0/9rMF5i6sq57cx2cU0/O Dwmw== X-Gm-Message-State: AOAM532M6gZQ9rYG6cew51zTXr8jBH1y1LM06Ttj/A5ulBglXHTRGZqz 7aZ9mBKnvoY+8BWmZ+jFRxwM6JqwOlVXXEFhQbTmAfFf X-Google-Smtp-Source: ABdhPJxM+ndmcOk5mssEKs9tsS02TxiAK6WYjwGfOUjA8IlEXM4lCB8LkQ/qEBRaCofqOJWS8dhTB7Kv5V5wJBjAcxw= X-Received: by 2002:aca:4d8b:: with SMTP id a133mr464225oib.79.1609188415297; Mon, 28 Dec 2020 12:46:55 -0800 (PST) MIME-Version: 1.0 References: <20201228194855.510315-1-maskray@google.com> <20201228194855.510315-2-maskray@google.com> In-Reply-To: <20201228194855.510315-2-maskray@google.com> From: "H.J. Lu" Date: Mon, 28 Dec 2020 12:46:19 -0800 Message-ID: Subject: Re: [PATCH 1/3] configure: Allow LD to be a linker other than GNU ld and gold To: Fangrui Song Cc: GNU C Library Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3036.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2020 20:47:00 -0000 On Mon, Dec 28, 2020 at 11:49 AM Fangrui Song via Libc-alpha wrote: > > 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. But not all versions of lld can be used to build glibc. Please find a way to check the working lld version. > --- > configure | 13 ++++++++----- > configure.ac | 13 ++++++++----- > 2 files changed, 16 insertions(+), 10 deletions(-) > > diff --git a/configure b/configure > index 6a35553805..6dcd2270f8 100755 > --- a/configure > +++ b/configure > @@ -4601,9 +4601,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 > @@ -4666,8 +4667,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 > @@ -4730,7 +4732,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 43cfac9d48..1a2054cd1a 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -979,18 +979,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.29.2.729.g45daf8777d-goog > -- H.J.