From patchwork Mon Dec 28 21:15:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fangrui Song X-Patchwork-Id: 41576 X-Patchwork-Delegate: carlos@redhat.com Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C16EC386F024; Mon, 28 Dec 2020 21:15:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C16EC386F024 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1609190151; bh=zrw2kN9xvuiDj58yzgAasZhexAQDz/HnSwfGGKqAfzo=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=hmRqx6BnT60iPwx1eOYAkqwihP9jgoYWBiYPc8N3H0aJLoQDxTvrVhCkh89OdEgoA YjgpiDnz/91onEv0v6oobkloC0BmDq3dXvkXAZChtl8Y5MDdjssMSRjO53rI6Y+W1U OHIBRYYBQ+H4/qx1I/tO+aXIJjL/pu+0qvlLgCs4= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by sourceware.org (Postfix) with ESMTPS id 2C954385482D for ; Mon, 28 Dec 2020 21:15:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2C954385482D Received: by mail-pg1-x532.google.com with SMTP id g15so7965058pgu.9 for ; Mon, 28 Dec 2020 13:15:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=zrw2kN9xvuiDj58yzgAasZhexAQDz/HnSwfGGKqAfzo=; b=hcL5K79dwZALIrr5YMC2vN4a+0tWm9UCebymHx/vGIRSYHh3Ng3qeRnhP+HfYXU5qf DZxaaK/aDTCNpBnudxSb9Bn+DyBiHDnXp7D3QZY1kMAR0nzIg/I7g9+UAQ+/uiQ7FsUn XUoNg54ODIrCK7Po4+IMVmfTMDMaqUTE1iWA2Zy+FFHWU72I8nGWPzKxRf05yDZMHpeN TfDGkisjoMKIyThQG1aJWdA+q8jNpMzZd4V91n8IH57h2p1uBfpLEquBJAO/7TtuLoNi qloQU5BKWduxnEwdMVBiHV/OKWVstsUH/F+GFH+Hd6utP3CKvrz5R3zYH8Ot2ItVu32F V4HQ== X-Gm-Message-State: AOAM5317CM4tf417vM2t70JTkK4Q2iI0EMqpCZNQDqivIasMnehi5Wxu 4kmsOnhbW32AE88gBSFiXi8zXkIv7Y4v7g== X-Google-Smtp-Source: ABdhPJzuCnNu+++SELN9bLcZMCu0DR7bDRnRiS21RYgldY+yiVKjeyaxlrZG5zr04q7hP/n4tYAxVg== X-Received: by 2002:a63:6fce:: with SMTP id k197mr18279709pgc.423.1609190147284; Mon, 28 Dec 2020 13:15:47 -0800 (PST) Received: from google.com ([2620:15c:2ce:0:a6ae:11ff:fe11:4abb]) by smtp.gmail.com with ESMTPSA id jz20sm348495pjb.4.2020.12.28.13.15.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Dec 2020 13:15:46 -0800 (PST) Date: Mon, 28 Dec 2020 13:15:43 -0800 To: "H.J. Lu" Subject: [PATCH 1/3] configure: Allow LD to be LLD 9.0.0 or above and gold Message-ID: <20201228211543.bnmvalznn7dtjr2k@google.com> References: <20201228194855.510315-1-maskray@google.com> <20201228194855.510315-2-maskray@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-25.7 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL 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-Patchwork-Original-From: Fangrui Song via Libc-alpha From: Fangrui Song Reply-To: Fangrui Song Cc: GNU C Library Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" On 2020-12-28, H.J. Lu wrote: >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. Replaced this with "configure: Allow LD to be LLD 9.0.0 or above" in https://sourceware.org/git/?p=glibc.git;a=shortlog;h=refs/heads/maskray/lld 8.0.0 needs an additional workaround. Since 9.0.0 is quite common in distributions, I just set the baseline to 9.0.0 to reduce friction. From 49c46455e41f1e0e396b17425eb93c5e0e776e1b Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Fri, 13 Mar 2020 13:29:46 -0700 Subject: [PATCH 1/3] configure: Allow LD to be LLD 9.0.0 or above When using LLD (LLVM linker) as the linker, configure prints a confusing message. *** These critical programs are missing or too old: GNU ld LLD>=9.0.0 can build glibc with very few patches. (LLD 8.0.0 needs one workaround for -Wl,-defsym=_begin=0). LLD>=9.0.0 is available on many distributions, so just set the baseline version to 9.0.0. --- configure | 77 +++++++++++++++++++++++++++++++++++++++++++++++++--- configure.ac | 20 ++++++++++---- 2 files changed, 88 insertions(+), 9 deletions(-) diff --git a/configure b/configure index 6a35553805..f67eb287fc 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,75 @@ if test $ac_verc_fail = yes; then LD=: critic_missing="$critic_missing GNU gold" fi + ;; + "LLD"*) + # Accept LLD 9.0 or higher + 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_LD+:} false; then : + $as_echo_n "(cached) " >&6 else - for ac_prog in $LD + if test -n "$LD"; then + ac_cv_prog_LD="$LD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_LD="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +LD=$ac_cv_prog_LD +if test -n "$LD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 +$as_echo "$LD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$LD" && break +done + +if test -z "$LD"; then + ac_verc_fail=yes +else + # Found it, now check the version. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking version of $LD" >&5 +$as_echo_n "checking version of $LD... " >&6; } + ac_prog_version=`$LD --version 2>&1 | sed -n 's/^.*LLD.* \([0-9][0-9]*\.[0-9.]*\).*$/\1/p'` + case $ac_prog_version in + '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; + 9.*|[1-9][0-9].*) + ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; + *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; + + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_prog_version" >&5 +$as_echo "$ac_prog_version" >&6; } +fi +if test $ac_verc_fail = yes; then + LD=: critic_missing="$critic_missing LLD" +fi + + ;; + *) + 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 +4798,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..59dbf9bda8 100644 --- a/configure.ac +++ b/configure.ac @@ -979,18 +979,28 @@ 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, + ;; + "LLD"*) + # Accept LLD 9.0 or higher + AC_CHECK_PROG_VER(LD, $LD, --version, + [LLD.* \([0-9][0-9]*\.[0-9.]*\)], + [9.*|[1-9][0-9].*], + LD=: critic_missing="$critic_missing LLD") + ;; + *) + 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