From patchwork Tue Oct 12 00:25:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fangrui Song X-Patchwork-Id: 46116 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 CC2CA385780A for ; Tue, 12 Oct 2021 00:25:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CC2CA385780A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1633998331; bh=0Vjq6gUXtU3kMP/Ty8aEIkOlkt9U40QucTAP3yp6s9E=; h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=wvCiyZQnaQes1R28GGlbjPOu4T5SlRpL5OwNSLcJjl9Hr1HqqBY2c7r+3R40bulxt KMD18ufq04M4oMGNQTawLpRbuLvs/VmcuDcJa5I+55OvAk21LebmnifuQefABvKQiK LqCyhsw2732WNw7QgP8a6aimmlMhYDHtHuwwz19k= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by sourceware.org (Postfix) with ESMTPS id 3BFF63858C3A for ; Tue, 12 Oct 2021 00:25:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3BFF63858C3A Received: by mail-yb1-xb4a.google.com with SMTP id t7-20020a258387000000b005b6d7220c79so25167281ybk.16 for ; Mon, 11 Oct 2021 17:25:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=0Vjq6gUXtU3kMP/Ty8aEIkOlkt9U40QucTAP3yp6s9E=; b=tVeN+Tvpa0eqIMr2qYR8BlYklDNqjNJy4aLpF/Y99YQXO2LGN2O2v/LrMcjj5ohrx1 /TLSEOHnwX8ZrCwdzpNqjfLu9FiZvcXvoC3a9QVwac8lBKix8g3BpB0ApSHkEuoIQcm/ TbmTJFvbYtnujbzxij+DGGofMJw3D5ZVHatUOBdiow6RdeBwiJ+LaYiMIlWpPp0rlYL0 hxI4DHhdeNWdYw3rYyAjIAMsE4fGWDBX6mDUyvO9Dw73mPwfjvSfeLBpYZ4f6lD+FDvB FLtmyyOzFXKYMxOs+zC/5KbDw46A+BzpZI0CdGdMJ+0rXb9pAsifGnIPVck85/UhL13V P1YQ== X-Gm-Message-State: AOAM533Eo9fXo9PL76bKbV3w5yEVFd9AAy1Y0DKoafGgFopXmZQYcnH6 EQm0QLJeWoG+zqjb8tfSmo4kgeM1NOmLoQytIBoE02ww6Tm6VkRsjjM/eHfNNqxFYYhfRIqGkG3 8In3/O3sUi5Td56QYWeMnWk9yt9lKMvvNvpxkHB3ly07s1xoHQo6qXcRrbuwUoBSKqlsG X-Google-Smtp-Source: ABdhPJwv9fVKflX/Q3ruXyEnAKo9M9LrouikXwg9rkpo0psRpxforzPJ/UaALyP5KrakKCj70PdW+Af6Az3v X-Received: from maskray1.svl.corp.google.com ([2620:15c:2ce:200:6a95:a8b:3fb1:c17]) (user=maskray job=sendgmr) by 2002:a25:5b8b:: with SMTP id p133mr25161378ybb.273.1633998309728; Mon, 11 Oct 2021 17:25:09 -0700 (PDT) Date: Mon, 11 Oct 2021 17:25:05 -0700 Message-Id: <20211012002505.839804-1-maskray@google.com> Mime-Version: 1.0 Subject: [PATCH] configure: Don't check LD -v --help for LIBC_LINKER_FEATURE To: libc-alpha@sourceware.org, Joseph Myers , "H.J. Lu" X-Spam-Status: No, score=-19.6 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, 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 LIBC_LINKER_FEATURE is used to check a linker option with the equal sign, it will likely fail because the LD -v --help output may look like `-z lam-report=[none|warning|error]` while the needle is something like `-z lam-report=warning`. The LD -v --help filter doesn't save much time, so just remove it. --- aclocal.m4 | 19 +++--- configure | 76 ++++++++++------------- sysdeps/unix/sysv/linux/powerpc/configure | 19 +++--- 3 files changed, 48 insertions(+), 66 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index c195c4db56..65a12df047 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -224,20 +224,17 @@ 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 - libc_linker_check=`$LD -v --help 2>/dev/null | grep "\$1"` - if test -n "$libc_linker_check"; then - cat > conftest.c < conftest.c <&AS_MESSAGE_LOG_FD]) - then - libc_linker_feature=yes - fi - rm -f conftest* + 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 + libc_linker_feature=yes fi + rm -f conftest* fi if test $libc_linker_feature = yes; then $3 diff --git a/configure b/configure index 39d75eb4ed..3227e434d3 100755 --- a/configure +++ b/configure @@ -5979,25 +5979,22 @@ fi $as_echo_n "checking for linker that supports -z execstack... " >&6; } libc_linker_feature=no if test x"$gnu_ld" = x"yes"; then - libc_linker_check=`$LD -v --help 2>/dev/null | grep "\-z execstack"` - if test -n "$libc_linker_check"; then - cat > conftest.c < conftest.c <&5 (eval $ac_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; } - then - libc_linker_feature=yes - fi - rm -f conftest* + then + libc_linker_feature=yes fi + rm -f conftest* fi if test $libc_linker_feature = yes; then libc_cv_z_execstack=yes @@ -6012,25 +6009,22 @@ $as_echo "$libc_linker_feature" >&6; } $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 - libc_linker_check=`$LD -v --help 2>/dev/null | grep "\-z start-stop-gc"` - if test -n "$libc_linker_check"; then - cat > conftest.c < conftest.c <&5 (eval $ac_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; } - then - libc_linker_feature=yes - fi - rm -f conftest* + then + libc_linker_feature=yes fi + rm -f conftest* fi if test $libc_linker_feature = yes; then libc_cv_z_start_stop_gc=yes @@ -6046,25 +6040,22 @@ have-z-start-stop-gc = $libc_cv_z_start_stop_gc" $as_echo_n "checking for linker that supports --depaudit... " >&6; } libc_linker_feature=no if test x"$gnu_ld" = x"yes"; then - libc_linker_check=`$LD -v --help 2>/dev/null | grep "\--depaudit"` - if test -n "$libc_linker_check"; then - cat > conftest.c < conftest.c <&5 (eval $ac_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; } - then - libc_linker_feature=yes - fi - rm -f conftest* + then + libc_linker_feature=yes fi + rm -f conftest* fi if test $libc_linker_feature = yes; then libc_cv_depaudit=yes @@ -6080,25 +6071,22 @@ have-depaudit = $libc_cv_depaudit" $as_echo_n "checking for linker that supports --no-dynamic-linker... " >&6; } libc_linker_feature=no if test x"$gnu_ld" = x"yes"; then - libc_linker_check=`$LD -v --help 2>/dev/null | grep "\--no-dynamic-linker"` - if test -n "$libc_linker_check"; then - cat > conftest.c < conftest.c <&5 (eval $ac_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; } - then - libc_linker_feature=yes - fi - rm -f conftest* + then + libc_linker_feature=yes fi + rm -f conftest* fi if test $libc_linker_feature = yes; then libc_cv_no_dynamic_linker=yes diff --git a/sysdeps/unix/sysv/linux/powerpc/configure b/sysdeps/unix/sysv/linux/powerpc/configure index ceb1bd7c1b..a4c809fd98 100644 --- a/sysdeps/unix/sysv/linux/powerpc/configure +++ b/sysdeps/unix/sysv/linux/powerpc/configure @@ -80,25 +80,22 @@ fi $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 - libc_linker_check=`$LD -v --help 2>/dev/null | grep "\--no-tls-get-addr-optimize"` - if test -n "$libc_linker_check"; then - cat > conftest.c < conftest.c <&5 (eval $ac_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; } - then - libc_linker_feature=yes - fi - rm -f conftest* + then + libc_linker_feature=yes fi + rm -f conftest* fi if test $libc_linker_feature = yes; then libc_cv_tls_get_addr_optimize=yes