From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 0BE70393BA49 for ; Mon, 5 Dec 2022 15:56:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0BE70393BA49 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670255789; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0siAhg9UQl/hjQBzs0/XGYoIsDLaXtK0FYrNOUS5pRo=; b=ANTreCYdYRpaiQ7viqEgWJ8COLCZ+VLp0A7JeTs7cRoSYQsZnoeTpl8tfWA6n5SXzx7rWo 8pdcJmIwnePGt8wGRL9VknZjdkuv8/p42NShfPsY8XPBZ9bFesTe5sBsFRS7shNt2YaAqS WMrv9dpdOtYuvVNQoPoF1O48rw0c24E= Received: from mail-il1-f198.google.com (mail-il1-f198.google.com [209.85.166.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-549-_QrA1Fh2P1iFctLXGzp_sQ-1; Mon, 05 Dec 2022 10:56:28 -0500 X-MC-Unique: _QrA1Fh2P1iFctLXGzp_sQ-1 Received: by mail-il1-f198.google.com with SMTP id l16-20020a056e02067000b0030325bbd570so12295319ilt.0 for ; Mon, 05 Dec 2022 07:56:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from:references :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=0siAhg9UQl/hjQBzs0/XGYoIsDLaXtK0FYrNOUS5pRo=; b=Eah0SDmkX2OWrWKUolRKlHtdo64DBiQjZN2Y8bVCUkfTkMEBOV+WoYke6hFKaq/eYR phxtCsouyz1GdkmZxYp8javfTf/Bi0gBFQUsUZ2iL8ykmQaKfvnDDWgKH6LbxTQURgcc SjP206cAFkhs3obSOWFolUaBK+8/c9MShqFUlqY4QNU8lbSmBLT54WuezpIMkKL9yayi UsSxzK8N2+lmdgztSGyCSEaQ3XjiLu8TmqoJNYD3nhcCbUpTPFNFuFjYEW9WZ02IIk9A yxL5t2/B8uzKuHE048kg6cSd9aW6sbYE8vcqkv6Dkj52sNC7ttSLjuWVNhVrAtWpBljT zgNg== X-Gm-Message-State: ANoB5plh+L2xBtEJ9kMzILCtJ0jUnIdEBliCc0+sxxeRXgiuMXS8ajN4 6MVWYwSji9UPaD9oc7BF8TYuEwQO2BAbbhkdmTjRV13uTmcAlyLZhpupyp4Y/bg58ih/6jnzjyZ uz/OTztlYZqqY4+r9SU4h X-Received: by 2002:a5d:80d0:0:b0:6a4:fde6:9f04 with SMTP id h16-20020a5d80d0000000b006a4fde69f04mr31011580ior.88.1670255787836; Mon, 05 Dec 2022 07:56:27 -0800 (PST) X-Google-Smtp-Source: AA0mqf5EuZSIH/esYZV7YJYXxgw0dGam4C2BqqIGRvRzGBZEBfVeP0fQwqjRaLRJIY/UILyuqtSo6w== X-Received: by 2002:a5d:80d0:0:b0:6a4:fde6:9f04 with SMTP id h16-20020a5d80d0000000b006a4fde69f04mr31011570ior.88.1670255787544; Mon, 05 Dec 2022 07:56:27 -0800 (PST) Received: from [192.168.0.241] (192-0-145-146.cpe.teksavvy.com. [192.0.145.146]) by smtp.gmail.com with ESMTPSA id w8-20020a0566022c0800b006de73a731dbsm5976204iov.51.2022.12.05.07.56.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 05 Dec 2022 07:56:27 -0800 (PST) Message-ID: Date: Mon, 5 Dec 2022 10:56:26 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Re: [PATCH 3/6] configure: Remove check if ld is GNU To: Adhemerval Zanella , libc-alpha@sourceware.org, Vineet Gupta , =?UTF-8?Q?Ludovic_Court=c3=a8s?= References: <20221202190030.1671870-1-adhemerval.zanella@linaro.org> <20221202190030.1671870-4-adhemerval.zanella@linaro.org> From: Carlos O'Donell Organization: Red Hat In-Reply-To: <20221202190030.1671870-4-adhemerval.zanella@linaro.org> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 12/2/22 14:00, Adhemerval Zanella via Libc-alpha wrote: > Assume linker has gnu argument input style. Agreed. Good cleanup. We should just check that the linker has the features we need e.g. libc_linker_feature. LGTM. Reviewed-by: Carlos O'Donell > --- > aclocal.m4 | 32 ++--- > configure | 158 +++++++++------------- > sysdeps/unix/sysv/linux/powerpc/configure | 28 ++-- > 3 files changed, 91 insertions(+), 127 deletions(-) > > diff --git a/aclocal.m4 b/aclocal.m4 > index 149b9e5376..88db64a683 100644 > --- a/aclocal.m4 > +++ b/aclocal.m4 > @@ -126,10 +126,6 @@ OBJCOPY=`$CC -print-prog-name=objcopy` > AC_SUBST(OBJCOPY) > GPROF=`$CC -print-prog-name=gprof` > AC_SUBST(GPROF) > - > -AC_CACHE_CHECK(whether $LD is GNU ld, libc_cv_prog_ld_gnu, > -[LIBC_PROG_FOO_GNU($LD, libc_cv_prog_ld_gnu=yes, libc_cv_prog_ld_gnu=no)]) > -gnu_ld=$libc_cv_prog_ld_gnu OK. Remove libc_cv_prog_ld_gnu check. > ]) > > dnl Run a static link test with -nostdlib -nostartfiles. > @@ -219,25 +215,23 @@ dnl LIBC_LINKER_FEATURE([ld_option], [cc_option], [action-if-true], [action-if-f > AC_DEFUN([LIBC_LINKER_FEATURE], > [AC_MSG_CHECKING([for linker that supports $1]) > libc_linker_feature=no > -if test x"$gnu_ld" = x"yes"; then > - cat > conftest.c < +cat > conftest.c < int _start (void) { return 42; } > EOF > - if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp > - $2 -nostdlib -nostartfiles > - -fPIC -shared -o conftest.so conftest.c > - 1>&AS_MESSAGE_LOG_FD]) > - then > - if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp $2 -nostdlib \ > - -nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \ > - | grep "warning: $1 ignored" > /dev/null 2>&1; then > - true > - else > - libc_linker_feature=yes > - fi > +if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp > + $2 -nostdlib -nostartfiles > + -fPIC -shared -o conftest.so conftest.c > + 1>&AS_MESSAGE_LOG_FD]) OK. Try to link > +then > + if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp $2 -nostdlib \ > + -nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \ > + | grep "warning: $1 ignored" > /dev/null 2>&1; then > + true > + else > + libc_linker_feature=yes > fi > - rm -f conftest* > fi > +rm -f conftest* OK. > if test $libc_linker_feature = yes; then > $3 > else > diff --git a/configure b/configure > index 2d3b3946b9..086d6fba7a 100755 > --- a/configure > +++ b/configure OK. Regenerate. > @@ -4155,24 +4155,6 @@ OBJCOPY=`$CC -print-prog-name=objcopy` > GPROF=`$CC -print-prog-name=gprof` > > > -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $LD is GNU ld" >&5 > -$as_echo_n "checking whether $LD is GNU ld... " >&6; } > -if ${libc_cv_prog_ld_gnu+:} false; then : > - $as_echo_n "(cached) " >&6 > -else > - # Most GNU programs take a -v and spit out some text including > -# the word 'GNU'. Some try to read stdin, so give them /dev/null. > -if $LD -o conftest -v &1 | grep GNU > /dev/null 2>&1; then > - libc_cv_prog_ld_gnu=yes > -else > - libc_cv_prog_ld_gnu=no > -fi > -rm -fr contest* > -fi > -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_prog_ld_gnu" >&5 > -$as_echo "$libc_cv_prog_ld_gnu" >&6; } > -gnu_ld=$libc_cv_prog_ld_gnu > - > > # Accept binutils 2.25 or newer. > for ac_prog in $AS > @@ -6037,30 +6019,28 @@ fi > { $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker that supports -z execstack" >&5 > $as_echo_n "checking for linker that supports -z execstack... " >&6; } > libc_linker_feature=no > -if test x"$gnu_ld" = x"yes"; then > - cat > conftest.c < +cat > conftest.c < int _start (void) { return 42; } > EOF > - if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp > - -Wl,-z,execstack -nostdlib -nostartfiles > - -fPIC -shared -o conftest.so conftest.c > - 1>&5' > +if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp > + -Wl,-z,execstack -nostdlib -nostartfiles > + -fPIC -shared -o conftest.so conftest.c > + 1>&5' > { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 > (eval $ac_try) 2>&5 > ac_status=$? > $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 > test $ac_status = 0; }; } > - then > - if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,-z,execstack -nostdlib \ > - -nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \ > - | grep "warning: -z execstack ignored" > /dev/null 2>&1; then > - true > - else > - libc_linker_feature=yes > - fi > +then > + if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,-z,execstack -nostdlib \ > + -nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \ > + | grep "warning: -z execstack ignored" > /dev/null 2>&1; then > + true > + else > + libc_linker_feature=yes > fi > - rm -f conftest* > fi > +rm -f conftest* > if test $libc_linker_feature = yes; then > libc_cv_z_execstack=yes > else > @@ -6073,30 +6053,28 @@ $as_echo "$libc_linker_feature" >&6; } > { $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker that supports -z start-stop-gc" >&5 > $as_echo_n "checking for linker that supports -z start-stop-gc... " >&6; } > libc_linker_feature=no > -if test x"$gnu_ld" = x"yes"; then > - cat > conftest.c < +cat > conftest.c < int _start (void) { return 42; } > EOF > - if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp > - -Wl,-z,start-stop-gc -nostdlib -nostartfiles > - -fPIC -shared -o conftest.so conftest.c > - 1>&5' > +if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp > + -Wl,-z,start-stop-gc -nostdlib -nostartfiles > + -fPIC -shared -o conftest.so conftest.c > + 1>&5' > { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 > (eval $ac_try) 2>&5 > ac_status=$? > $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 > test $ac_status = 0; }; } > - then > - if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,-z,start-stop-gc -nostdlib \ > - -nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \ > - | grep "warning: -z start-stop-gc ignored" > /dev/null 2>&1; then > - true > - else > - libc_linker_feature=yes > - fi > +then > + if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,-z,start-stop-gc -nostdlib \ > + -nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \ > + | grep "warning: -z start-stop-gc ignored" > /dev/null 2>&1; then > + true > + else > + libc_linker_feature=yes > fi > - rm -f conftest* > fi > +rm -f conftest* > if test $libc_linker_feature = yes; then > libc_cv_z_start_stop_gc=yes > else > @@ -6110,30 +6088,28 @@ have-z-start-stop-gc = $libc_cv_z_start_stop_gc" > { $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker that supports --depaudit" >&5 > $as_echo_n "checking for linker that supports --depaudit... " >&6; } > libc_linker_feature=no > -if test x"$gnu_ld" = x"yes"; then > - cat > conftest.c < +cat > conftest.c < int _start (void) { return 42; } > EOF > - if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp > - -Wl,--depaudit,x -nostdlib -nostartfiles > - -fPIC -shared -o conftest.so conftest.c > - 1>&5' > +if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp > + -Wl,--depaudit,x -nostdlib -nostartfiles > + -fPIC -shared -o conftest.so conftest.c > + 1>&5' > { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 > (eval $ac_try) 2>&5 > ac_status=$? > $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 > test $ac_status = 0; }; } > - then > - if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,--depaudit,x -nostdlib \ > - -nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \ > - | grep "warning: --depaudit ignored" > /dev/null 2>&1; then > - true > - else > - libc_linker_feature=yes > - fi > +then > + if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,--depaudit,x -nostdlib \ > + -nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \ > + | grep "warning: --depaudit ignored" > /dev/null 2>&1; then > + true > + else > + libc_linker_feature=yes > fi > - rm -f conftest* > fi > +rm -f conftest* > if test $libc_linker_feature = yes; then > libc_cv_depaudit=yes > else > @@ -6147,30 +6123,28 @@ have-depaudit = $libc_cv_depaudit" > { $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker that supports -z pack-relative-relocs" >&5 > $as_echo_n "checking for linker that supports -z pack-relative-relocs... " >&6; } > libc_linker_feature=no > -if test x"$gnu_ld" = x"yes"; then > - cat > conftest.c < +cat > conftest.c < int _start (void) { return 42; } > EOF > - if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp > - -Wl,-z,pack-relative-relocs -nostdlib -nostartfiles > - -fPIC -shared -o conftest.so conftest.c > - 1>&5' > +if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp > + -Wl,-z,pack-relative-relocs -nostdlib -nostartfiles > + -fPIC -shared -o conftest.so conftest.c > + 1>&5' > { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 > (eval $ac_try) 2>&5 > ac_status=$? > $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 > test $ac_status = 0; }; } > - then > - if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,-z,pack-relative-relocs -nostdlib \ > - -nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \ > - | grep "warning: -z pack-relative-relocs ignored" > /dev/null 2>&1; then > - true > - else > - libc_linker_feature=yes > - fi > +then > + if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,-z,pack-relative-relocs -nostdlib \ > + -nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \ > + | grep "warning: -z pack-relative-relocs ignored" > /dev/null 2>&1; then > + true > + else > + libc_linker_feature=yes > fi > - rm -f conftest* > fi > +rm -f conftest* > if test $libc_linker_feature = yes; then > libc_cv_dt_relr=yes > else > @@ -6184,30 +6158,28 @@ have-dt-relr = $libc_cv_dt_relr" > { $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker that supports --no-dynamic-linker" >&5 > $as_echo_n "checking for linker that supports --no-dynamic-linker... " >&6; } > libc_linker_feature=no > -if test x"$gnu_ld" = x"yes"; then > - cat > conftest.c < +cat > conftest.c < int _start (void) { return 42; } > EOF > - if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp > - -Wl,--no-dynamic-linker -nostdlib -nostartfiles > - -fPIC -shared -o conftest.so conftest.c > - 1>&5' > +if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp > + -Wl,--no-dynamic-linker -nostdlib -nostartfiles > + -fPIC -shared -o conftest.so conftest.c > + 1>&5' > { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 > (eval $ac_try) 2>&5 > ac_status=$? > $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 > test $ac_status = 0; }; } > - then > - if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,--no-dynamic-linker -nostdlib \ > - -nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \ > - | grep "warning: --no-dynamic-linker ignored" > /dev/null 2>&1; then > - true > - else > - libc_linker_feature=yes > - fi > +then > + if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,--no-dynamic-linker -nostdlib \ > + -nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \ > + | grep "warning: --no-dynamic-linker ignored" > /dev/null 2>&1; then > + true > + else > + libc_linker_feature=yes > fi > - rm -f conftest* > fi > +rm -f conftest* > if test $libc_linker_feature = yes; then > libc_cv_no_dynamic_linker=yes > else > diff --git a/sysdeps/unix/sysv/linux/powerpc/configure b/sysdeps/unix/sysv/linux/powerpc/configure > index 7183573bc0..84a39495f0 100644 > --- a/sysdeps/unix/sysv/linux/powerpc/configure > +++ b/sysdeps/unix/sysv/linux/powerpc/configure > @@ -79,30 +79,28 @@ fi > { $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker that supports --no-tls-get-addr-optimize" >&5 > $as_echo_n "checking for linker that supports --no-tls-get-addr-optimize... " >&6; } > libc_linker_feature=no > -if test x"$gnu_ld" = x"yes"; then > - cat > conftest.c < +cat > conftest.c < int _start (void) { return 42; } > EOF > - if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp > - -Wl,--no-tls-get-addr-optimize -nostdlib -nostartfiles > - -fPIC -shared -o conftest.so conftest.c > - 1>&5' > +if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp > + -Wl,--no-tls-get-addr-optimize -nostdlib -nostartfiles > + -fPIC -shared -o conftest.so conftest.c > + 1>&5' > { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 > (eval $ac_try) 2>&5 > ac_status=$? > $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 > test $ac_status = 0; }; } > - then > - if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,--no-tls-get-addr-optimize -nostdlib \ > - -nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \ > - | grep "warning: --no-tls-get-addr-optimize ignored" > /dev/null 2>&1; then > - true > - else > - libc_linker_feature=yes > - fi > +then > + if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,--no-tls-get-addr-optimize -nostdlib \ > + -nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \ > + | grep "warning: --no-tls-get-addr-optimize ignored" > /dev/null 2>&1; then > + true > + else > + libc_linker_feature=yes > fi > - rm -f conftest* > fi > +rm -f conftest* > if test $libc_linker_feature = yes; then > libc_cv_tls_get_addr_optimize=yes > else -- Cheers, Carlos.