From patchwork Mon Aug 30 21:03:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fangrui Song X-Patchwork-Id: 44821 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 C160E385843D for ; Mon, 30 Aug 2021 21:04:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C160E385843D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1630357458; bh=mH9fFkfogk9637nECaP1oNdw46ZS2NYiq3TZIIJ6+x4=; h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=PVhYP7SwtHRiW3EG5izUXtTtXvKPDQ07XvnVjMLSEa9hxhLXjXLo87fJ9sGM6s/SI HM4t/o5jZSbzPLaSF2JhTi2pPjJ6kFsQFybWDrmmT7qysUEvRNRqVFMqoWljuhODNJ lRCA84h9PEryWanNaEUchZ+bMZUkywOZ8bZ4mmWU= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org 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 6EA9A3858431 for ; Mon, 30 Aug 2021 21:03:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6EA9A3858431 Received: by mail-qv1-xf4a.google.com with SMTP id l12-20020a0cc20c000000b0037766e5daaeso811848qvh.10 for ; Mon, 30 Aug 2021 14:03:25 -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:message-id:mime-version:subject:from:to:cc; bh=mH9fFkfogk9637nECaP1oNdw46ZS2NYiq3TZIIJ6+x4=; b=mEXOJlxxkOK1pRSd6z3aGNJPmjwj+kC+DWJxPAN4ccYmYFS/0kfddv2wII3VyPcV5e rEuP9GQMxvE5I+Dn7HCUj2o0YZksRx56/+AJG2AmiYfpOM/4mUjPGD7KEwdLW44LVQ9h mzCNUlZiHaqFglzmhC203XHQiwmB7fv9KbIKMp1OuCljG106/n/fzOxMiLAE5dEyRDmG P2ag4nOUcCvhUCxrVt3rp5Y018anM31Qpm1XZmImUCzJvL31Dh0pWhdG4ykNYj0J6kT3 zDiVmN94iMIRwPHh1CXweBEG8sTcJKGc/paot5Z6L0I8X/Rm0dRCk1cF00GKarW4sY39 4sFQ== X-Gm-Message-State: AOAM533oXWtubg+vGAvT840+wSfr3D1bPXlnDUsoTcvaZGZJYCqRwEcm CA1uyLb7gMFVbqtAp/bcYQ8XHCeHWT8OPNT64MK/kwPg5Eui7xE8HtilYYg3zMPg7+uUGk5PRpU n5+2TvIoS35hxf/bWQb9v0Zy61svEi/uj5eW9jB+1LqjgS2b/iqmDFrwrfC3e3AE5DCui X-Google-Smtp-Source: ABdhPJzdKiL+eG3t8+I8AUjIIPkjO5QaZWh/i0zPBWizBvg6DE4PIJXdEGjeeXT7ZXCWGjhC/7730xSvmZ1G X-Received: from maskray1.svl.corp.google.com ([2620:15c:2ce:200:1cd:8b62:66c1:7de7]) (user=maskray job=sendgmr) by 2002:a0c:fb11:: with SMTP id c17mr24557996qvp.15.1630357404967; Mon, 30 Aug 2021 14:03:24 -0700 (PDT) Date: Mon, 30 Aug 2021 14:03:20 -0700 Message-Id: <20210830210320.1718767-1-maskray@google.com> Mime-Version: 1.0 Subject: [PATCH v3] configure: Allow LD to be LLD 13.0.0 or above [BZ #26558] To: libc-alpha@sourceware.org X-Spam-Status: No, score=-18.8 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, URIBL_BLACK, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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 Errors-To: libc-alpha-bounces+patchwork=sourceware.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). XFAIL two tests sysdeps/x86/tst-ifunc-isa-* which have the BZ #28154 issue (LLD follows the PowerPC port of GNU ld for ifunc by placing IRELATIVE relocations in .rela.dyn, triggering a glibc ifunc fragility). 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 (non-default version symbols are changed to default versions by a version script BZ #28196). --- configure | 81 +++++++++++++++++++++++++++++++++++++++++--- configure.ac | 23 ++++++++++--- sysdeps/x86/Makefile | 4 +++ 3 files changed, 99 insertions(+), 9 deletions(-) diff --git a/configure b/configure index 61ff26487e..542802ad35 100755 --- a/configure +++ b/configure @@ -4664,9 +4664,11 @@ if test $ac_verc_fail = yes; then fi -if test -n "`$LD --version | sed -n 's/^GNU \(gold\).*$/\1/p'`"; then +libc_cv_with_lld=no +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 +4731,76 @@ 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 + + libc_cv_with_lld=yes + ;; + *) + 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 +4863,10 @@ if test $ac_verc_fail = yes; then LD=: critic_missing="$critic_missing GNU ld" fi -fi + ;; +esac +config_vars="$config_vars +with-lld = $libc_cv_with_lld" # These programs are version sensitive. for ac_prog in gnumake gmake make diff --git a/configure.ac b/configure.ac index e250f0e20b..d9232418de 100644 --- a/configure.ac +++ b/configure.ac @@ -995,18 +995,31 @@ 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 +libc_cv_with_lld=no +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") + libc_cv_with_lld=yes + ;; + *) + 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 +LIBC_CONFIG_VAR([with-lld], [$libc_cv_with_lld]) # These programs are version sensitive. AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version, diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile index 5ee06f9473..402986ff68 100644 --- a/sysdeps/x86/Makefile +++ b/sysdeps/x86/Makefile @@ -22,12 +22,16 @@ tests += \ tst-ifunc-isa-1-static tests-static += \ tst-ifunc-isa-1-static +test-xfail-tst-ifunc-isa-1 = $(with-lld) +test-xfail-tst-ifunc-isa-1-static = $(with-lld) ifneq ($(have-tunables),no) tests += \ tst-ifunc-isa-2 \ tst-ifunc-isa-2-static tests-static += \ tst-ifunc-isa-2-static +test-xfail-tst-ifunc-isa-2 = $(with-lld) +test-xfail-tst-ifunc-isa-2-static = $(with-lld) endif endif endif