From: "Fāng-ruì Sòng" <maskray@google.com>
To: libc-alpha@sourceware.org, Joseph Myers <joseph@codesourcery.com>,
"H.J. Lu" <hjl.tools@gmail.com>
Subject: Re: [PATCH] configure: Don't check LD -v --help for LIBC_LINKER_FEATURE
Date: Tue, 19 Oct 2021 10:02:19 -0700 [thread overview]
Message-ID: <CAFP8O3LH+oAVgu-hikuEOigmnOfCybDPdTV=O_+-O1qR7ukSiA@mail.gmail.com> (raw)
In-Reply-To: <20211012002505.839804-1-maskray@google.com>
On Mon, Oct 11, 2021 at 5:25 PM Fangrui Song <maskray@google.com> wrote:
>
> 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 <<EOF
> + cat > conftest.c <<EOF
> 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
> - 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 <<EOF
> + cat > conftest.c <<EOF
> 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
> - 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 <<EOF
> + cat > conftest.c <<EOF
> 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
> - 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 <<EOF
> + cat > conftest.c <<EOF
> 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
> - 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 <<EOF
> + cat > conftest.c <<EOF
> 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
> - 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 <<EOF
> + cat > conftest.c <<EOF
> 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
> - 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
> --
> 2.33.0.882.g93a45727a2-goog
>
Ping🥳
next prev parent reply other threads:[~2021-10-19 17:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-12 0:25 Fangrui Song
2021-10-19 17:02 ` Fāng-ruì Sòng [this message]
2021-10-20 18:04 ` Fāng-ruì Sòng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFP8O3LH+oAVgu-hikuEOigmnOfCybDPdTV=O_+-O1qR7ukSiA@mail.gmail.com' \
--to=maskray@google.com \
--cc=hjl.tools@gmail.com \
--cc=joseph@codesourcery.com \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).