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: AS17314 8.43.84.0/22 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,RCVD_IN_MSPIKE_H2,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 [8.43.85.97]) (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 C8AE01F8C6 for ; Thu, 5 Aug 2021 17:05:27 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A47B13969037 for ; Thu, 5 Aug 2021 17:05:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A47B13969037 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1628183126; bh=7Z5LupUfYWM4wJb7R7ATAd+XdpeLlig6Ikl2KWfrJv4=; h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=eKNskq/rEKrkSTuNnE2g78E1LZw47/29XoRnMuUcanyUPyx6nyFugsGBLS4jVP68i hBqV/OnWwusQXydYDyN1FUrbXQUn1SJW78nLoYFmpXQLpvjbmLW6HAidyCRSpk3S3p BMwvSbq7f1pN8k2IWAhsXcPMccE4BsVEioibOJx0= Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by sourceware.org (Postfix) with ESMTPS id DCEFC3858004 for ; Thu, 5 Aug 2021 17:05:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DCEFC3858004 Received: by mail-pj1-x1031.google.com with SMTP id s22-20020a17090a1c16b0290177caeba067so16429183pjs.0 for ; Thu, 05 Aug 2021 10:05:03 -0700 (PDT) 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:content-transfer-encoding; bh=7Z5LupUfYWM4wJb7R7ATAd+XdpeLlig6Ikl2KWfrJv4=; b=rX9H0XRjHFboqjTEPeFwgH2v8jWHtsyZWEgVUqhhG0rvdSCZ1yQdjtBFxfQ3exqpNS 9qFtBeyBngy8dD77H/XnROO/d8pxoZEmMY1uB05SvDlBwdCK/NIxjlBTA3PtHIiiBS1f QWeEZabqTapNwLbJUv/aTQXBPDcB3qgU+7yoxJCYKZHOyRAGv5ReZ9Vw/Fj5nCZoaz3X EcVVTzuJyiGHP3r4RYULah1cKHBIkpiien7zKTVhjRrVKv+J4U5XURVs+COX8PAgOIu4 R4duq2LOXKYv9C/On+MzfmJ7A5MaXJyR19ZcxqkRUNn+6XEb9B5Ox82Rg1dCcJB1OMnk 7crQ== X-Gm-Message-State: AOAM533lbcoFi2kbjprXtX+sIBtsGaE4prTNqOEqiI/r5Dv83Q+IoXAX Q3nEXAF0DVSFTeWbpdP/i1kEgZwZfvKNn8tNIaE= X-Google-Smtp-Source: ABdhPJzSEhg+U/s8x7mr1sRlDXaengFT3sOeKC8MNcB6Kv6kIGr3brQwpOiP879pE1VJVmh1oySPvdFvvJ4OCXzys/c= X-Received: by 2002:a17:902:b407:b029:12c:aadd:90d7 with SMTP id x7-20020a170902b407b029012caadd90d7mr4793643plr.79.1628183103005; Thu, 05 Aug 2021 10:05:03 -0700 (PDT) MIME-Version: 1.0 References: <20210805162601.1200851-1-maskray@google.com> <20210805162601.1200851-4-maskray@google.com> In-Reply-To: Date: Thu, 5 Aug 2021 10:04:27 -0700 Message-ID: Subject: Re: [PATCH v2 3/3] configure: Allow LD to be LLD 13.0.0 or above [BZ #26558] To: =?UTF-8?B?RsSBbmctcnXDrCBTw7JuZw==?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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: "H.J. Lu via Libc-alpha" Reply-To: "H.J. Lu" Cc: GNU C Library Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" On Thu, Aug 5, 2021 at 9:43 AM F=C4=81ng-ru=C3=AC S=C3=B2ng wrote: > > On Thu, Aug 5, 2021 at 9:34 AM H.J. Lu wrote: > > > > On Thu, Aug 5, 2021 at 9:29 AM Fangrui Song via Libc-alpha > > wrote: > > > > > > When using LLD (LLVM linker) as the linker, configure prints a confus= ing > > > message. > > > > > > *** These critical programs are missing or too old: GNU ld > > > > > > LLD>=3D13.0.0 can build glibc --enable-static-pie. (8.0.0 needs one > > > workaround for -Wl,-defsym=3D_begin=3D0. 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). > > > > This is an lld bug, similar to: > > > > https://sourceware.org/bugzilla/show_bug.cgi?id=3D13302 > > > > Please fix it at least on x86. > > I am afraid that I disagree. The PowerPC port of GNU ld does the right This is just one opinion and it doesn't make it "the right thing". > thing and LLD follows suit. > R_*_IRELATIVE relocations should be eagerly resolved, so they belong > to .rela.dyn instead of .rela.plt. Ulrich and I designed/implemented IFUNC on x86 and for x86. I consider x86 implementation of IFUC as the gold standard. > The objection argument > https://sourceware.org/bugzilla/show_bug.cgi?id=3D28154#c3 is kinda > weak: > > > This requires both linker and ld.so changes. The PR ld/13302 linker ch= ange doesn't require ld.so change. > > Working around the glibc ld.so issue on GNU ld side was probably > simpler, but that does not justify the GNU ld change. > > I mentioned at #c2 about the proper way on the glibc side. > > But our conflict here may be moot because in practice ifunc should not > have such PLT calls, they would be unreliable on other architectures > anyway. > > > > 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 go= od. > > > --- > > > 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 =3D yes; then > > > fi > > > > > > > > > -if test -n "`$LD --version | sed -n 's/^GNU \(gold\).*$/\1/p'`"; the= n > > > +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 nam= e with args. > > > set dummy $ac_prog; ac_word=3D$2 > > > @@ -4729,8 +4730,75 @@ if test $ac_verc_fail =3D yes; then > > > LD=3D: critic_missing=3D"$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 nam= e with args. > > > +set dummy $ac_prog; ac_word=3D$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=3D"$LD" # Let the user override the test. > > > +else > > > +as_save_IFS=3D$IFS; IFS=3D$PATH_SEPARATOR > > > +for as_dir in $PATH > > > +do > > > + IFS=3D$as_save_IFS > > > + test -z "$as_dir" && as_dir=3D. > > > + 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=3D"$ac_prog" > > > + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac= _exec_ext" >&5 > > > + break 2 > > > + fi > > > +done > > > + done > > > +IFS=3D$as_save_IFS > > > + > > > +fi > > > +fi > > > +LD=3D$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=3Dyes > > > +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=3D`$LD --version 2>&1 | sed -n 's/^.*LLD.* \([0-9]= [0-9]*\.[0-9.]*\).*$/\1/p'` > > > + case $ac_prog_version in > > > + '') ac_prog_version=3D"v. ?.??, bad"; ac_verc_fail=3Dyes;; > > > + 1[3-9].*|[2-9][0-9].*) > > > + ac_prog_version=3D"$ac_prog_version, ok"; ac_verc_fail=3Dno;; > > > + *) ac_prog_version=3D"$ac_prog_version, bad"; ac_verc_fail=3Dyes= ;; > > > + > > > + 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 =3D yes; then > > > + LD=3D: critic_missing=3D"$critic_missing LLD" > > > +fi > > > + > > > + ;; > > > + *) > > > + for ac_prog in $LD > > > do > > > # Extract the first word of "$ac_prog", so it can be a program nam= e with args. > > > set dummy $ac_prog; ac_word=3D$2 > > > @@ -4793,7 +4861,8 @@ if test $ac_verc_fail =3D yes; then > > > LD=3D: critic_missing=3D"$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=3D: critic_missing=3D"$critic_missing as") > > > > > > -if test -n "`$LD --version | sed -n 's/^GNU \(gold\).*$/\1/p'`"; the= n > > > +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=3D: critic_missing=3D"$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=3D: critic_missing=3D"$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=3D: critic_missing=3D"$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 -- H.J.