From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-3.3 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS,URIBL_BLACK shortcircuit=no autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 7547B1F8C6 for ; Thu, 5 Aug 2021 16:29:17 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B02FB3969013 for ; Thu, 5 Aug 2021 16:29:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B02FB3969013 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1628180956; bh=+L9qpSyUCvPsBF0dC4LZozlPBmZAOrCXryWPzK+oljg=; h=Date:In-Reply-To:References:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=vGxCoAFwD7SpunLnwDIrV9AGCUctqcYzdT3DY6HjpXnRoz4yn5b4WGpLNmaQ97/wJ YYWTLqYXj62Y0GwVplX0SbJnL3N4hPvRYMqNvhNZybMwmRQKHPPnvXmSUawLeIAqiV cbU2o5E8K6OuGvbQbT3+jHjWFx9oGOKrrW2YCzrM= Received: from mail-qv1-xf4a.google.com (mail-qv1-xf4a.google.com [IPv6:2607:f8b0:4864:20::f4a]) by sourceware.org (Postfix) with ESMTPS id 5216A3980C12 for ; Thu, 5 Aug 2021 16:26:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5216A3980C12 Received: by mail-qv1-xf4a.google.com with SMTP id a2-20020a0562141302b02903303839b843so4187392qvv.13 for ; Thu, 05 Aug 2021 09:26:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=+L9qpSyUCvPsBF0dC4LZozlPBmZAOrCXryWPzK+oljg=; b=m3e4Ia3KREqpVlXLqVqqALNyG4+AnVqd2JkPdSVcQ0i8s+dK2DpXUmTNhumu+3Hjt+ oigB16dhnpQDZD+Nl5MQKUtwMDyZOTWlY4FA5IFsXWP+N1KkgaG3G1zS4lHN7yadbs3K UvwVQccHJMlENqNytx4V41UeIMh9MBcV2l2/NIK8b3Rr3fiPW9QKMMWgbcT8nnnb5O8C gpoc6CvOmS5E7OnGRmewNc+u2w8vQdNLGJpAG/8qQc+N49CL6d7eDGm2SvBZE/T6CjRF DZhkcr5N+XtgUxmpJvshkwj5FCftau+9yiDpZ9EUh80KceuyqtkPI1QKU7vFFWxB1feM rOWQ== X-Gm-Message-State: AOAM531Ek3MtjlsZi3da+ZMQ3w2a+4r2g6c/Xy1PNSloU99fKVO3KD7j wLvOXtJuoj++z/wCX2Fqa0uqLyB3+mpwj7RPT1PW0oKQM09L0rdDtfAkKB6qLYbPWxDIAqgV7gR 1sYKPbGr6vAKoiTBjx/2uM7do2KnJMEF/HiCc/dzMV04BF4BDGwEH8672sq1iurS/+3kj X-Google-Smtp-Source: ABdhPJxrqPTBEbKhtjUiz96hm3cwo698ybaplnXRV+m0j7ld9tJv3uADmTHkYBGWARnkQh3KyAe5MmZ766E+ X-Received: from maskray1.svl.corp.google.com ([2620:15c:2ce:200:6668:5d25:689f:8ff1]) (user=maskray job=sendgmr) by 2002:ad4:5de1:: with SMTP id jn1mr6093420qvb.62.1628180773875; Thu, 05 Aug 2021 09:26:13 -0700 (PDT) Date: Thu, 5 Aug 2021 09:26:01 -0700 In-Reply-To: <20210805162601.1200851-1-maskray@google.com> Message-Id: <20210805162601.1200851-4-maskray@google.com> Mime-Version: 1.0 References: <20210805162601.1200851-1-maskray@google.com> Subject: [PATCH v2 3/3] configure: Allow LD to be LLD 13.0.0 or above [BZ #26558] To: libc-alpha@sourceware.org Content-Type: text/plain; charset="UTF-8" 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: , From: Fangrui Song via Libc-alpha Reply-To: Fangrui Song Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" When using LLD (LLVM linker) as the linker, configure prints a confusing message. *** These critical programs are missing or too old: GNU ld LLD>=13.0.0 can build glibc --enable-static-pie. (8.0.0 needs one workaround for -Wl,-defsym=_begin=0. 9.0.0 works with --disable-static-pie). With BZ #28153 (glibc bug exposed by testing with LLD) fixed, `make check` only has 2 more failures with LLD than with GNU ld: BZ #28154 (LLD follows the PowerPC port of GNU ld for ifunc by placing IRELATIVE relocations in .rela.dyn). The set of dynamic symbols is the same with GNU ld and LLD, modulo unused SHN_ABS version node symbols. For comparison, gold does not support --enable-static-pie yet (--no-dynamic-linker is unsupported BZ #22221), yet has 6 failures more than LLD. gold linked libc.so has larger .dynsym differences with GNU ld and LLD (ISTM non-default version symbols are changed to default versions by a version script). --- I identified the lack of support of * version script on non-default version symbols * copy relocations on non-default version symbols in an earlier snapshot of LLD 13.0.0 and fixed them. The functionality of the LLD linked libc.so and ld.so looks pretty good. --- configure | 77 +++++++++++++++++++++++++++++++++++++++++++++++++--- configure.ac | 20 ++++++++++---- 2 files changed, 88 insertions(+), 9 deletions(-) diff --git a/configure b/configure index 9b966196d4..050f1a29cf 100755 --- a/configure +++ b/configure @@ -4664,9 +4664,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 @@ -4729,8 +4730,75 @@ if test $ac_verc_fail = yes; then LD=: critic_missing="$critic_missing GNU gold" fi + ;; + "LLD"*) + # Accept LLD 13.0.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;; + 1[3-9].*|[2-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 @@ -4793,7 +4861,8 @@ if test $ac_verc_fail = yes; then LD=: critic_missing="$critic_missing GNU ld" fi -fi + ;; +esac # These programs are version sensitive. for ac_prog in gnumake gmake make diff --git a/configure.ac b/configure.ac index 17a4c9a1ab..5632277f9c 100644 --- a/configure.ac +++ b/configure.ac @@ -995,18 +995,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 13.0.0 or higher + AC_CHECK_PROG_VER(LD, $LD, --version, + [LLD.* \([0-9][0-9]*\.[0-9.]*\)], + [1[3-9].*|[2-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_PROG_VER(MAKE, gnumake gmake make, --version, -- 2.32.0.605.g8dce9f2422-goog