diff mbox series

s390x: Add missing grep -q flag to static PIE check

Message ID 87jzikj7tp.fsf@oldenburg.str.redhat.com
State New
Headers show
Series s390x: Add missing grep -q flag to static PIE check | expand

Commit Message

Florian Weimer June 20, 2024, 9:13 a.m. UTC
The test is not a run-time check, so update the description.
Also use readelf -W for a more stable output format.

This avoids grabled configure diagnostics:

checking for s390-specific static PIE requirements (runtime check)...  0x0000000000000017 (JMPREL)             0x280
yes

Tested on s390x-linux-gnu.  The generated .so files do not change.

---
 sysdeps/s390/s390-64/configure    | 8 ++++----
 sysdeps/s390/s390-64/configure.ac | 6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)


base-commit: 086910fc41655152812b515dc324d2ac0dc36e67

Comments

Sam James June 20, 2024, 9:46 a.m. UTC | #1
Florian Weimer <fweimer@redhat.com> writes:

> The test is not a run-time check, so update the description.
> Also use readelf -W for a more stable output format.
>
> This avoids grabled configure diagnostics:

garbled

>
> checking for s390-specific static PIE requirements (runtime check)...  0x0000000000000017 (JMPREL)             0x280
> yes
>
> Tested on s390x-linux-gnu.  The generated .so files do not change.

Maybe check config.log for good measure?

>
> ---
>  sysdeps/s390/s390-64/configure    | 8 ++++----
>  sysdeps/s390/s390-64/configure.ac | 6 +++---
>  2 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/sysdeps/s390/s390-64/configure b/sysdeps/s390/s390-64/configure
> index 33c28614c2..7856df7295 100644
> --- a/sysdeps/s390/s390-64/configure
> +++ b/sysdeps/s390/s390-64/configure
> @@ -4,8 +4,8 @@
>  # Minimal checking for static PIE support in ld.
>  # Compare to ld testcase/bugzilla:
>  # <binutils-source>/ld/testsuite/ld-elf/pr22263-1.rd
> -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for s390-specific static PIE requirements (runtime check)" >&5
> -printf %s "checking for s390-specific static PIE requirements (runtime check)... " >&6; }
> +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for s390-specific static PIE requirements" >&5
> +printf %s "checking for s390-specific static PIE requirements... " >&6; }
>  if { as_var=\
>  libc_cv_s390x_staticpie_req_runtime; eval test \${$as_var+y}; }
>  then :
> @@ -62,13 +62,13 @@ EOF
>    ac_status=$?
>    printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
>    test $ac_status = 0; }; } \
> -     && { ac_try='! LC_ALL=C $READELF -Wr conftest | grep R_390_TLS_TPOFF'
> +     && { ac_try='! LC_ALL=C $READELF -Wr conftest | grep -q R_390_TLS_TPOFF'
>    { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
>    (eval $ac_try) 2>&5
>    ac_status=$?
>    printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
>    test $ac_status = 0; }; } \
> -     && { ac_try='LC_ACLL=C $READELF -d conftest | grep JMPREL'
> +     && { ac_try='LC_ACLL=C $READELF -Wd conftest | grep -q JMPREL'
>    { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
>    (eval $ac_try) 2>&5
>    ac_status=$?
> diff --git a/sysdeps/s390/s390-64/configure.ac b/sysdeps/s390/s390-64/configure.ac
> index fd729e1496..98f67dafc8 100644
> --- a/sysdeps/s390/s390-64/configure.ac
> +++ b/sysdeps/s390/s390-64/configure.ac
> @@ -4,7 +4,7 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
>  # Minimal checking for static PIE support in ld.
>  # Compare to ld testcase/bugzilla:
>  # <binutils-source>/ld/testsuite/ld-elf/pr22263-1.rd
> -AC_CACHE_CHECK([for s390-specific static PIE requirements (runtime check)], \
> +AC_CACHE_CHECK([for s390-specific static PIE requirements], \
>  [libc_cv_s390x_staticpie_req_runtime], [dnl
>    cat > conftest1.c <<EOF
>  __thread int * foo;
> @@ -42,8 +42,8 @@ EOF
>    if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -fPIE -c conftest1.c -o conftest1.o]) \
>       && AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -fPIE -c conftest2.c -o conftest2.o]) \
>       && AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static-pie -nostartfiles -nostdlib -fPIE -o conftest conftest1.o conftest2.o]) \
> -     && AC_TRY_COMMAND([! LC_ALL=C $READELF -Wr conftest | grep R_390_TLS_TPOFF]) \
> -     && AC_TRY_COMMAND([LC_ACLL=C $READELF -d conftest | grep JMPREL])
> +     && AC_TRY_COMMAND([! LC_ALL=C $READELF -Wr conftest | grep -q R_390_TLS_TPOFF]) \
> +     && AC_TRY_COMMAND([LC_ACLL=C $READELF -Wd conftest | grep -q JMPREL])

This typo predates you, but LC_ALL=C.

>    then
>      libc_cv_s390x_staticpie_req_runtime=yes
>    fi
>
> base-commit: 086910fc41655152812b515dc324d2ac0dc36e67
Florian Weimer June 20, 2024, 10:11 a.m. UTC | #2
* Sam James:

> Florian Weimer <fweimer@redhat.com> writes:
>
>> The test is not a run-time check, so update the description.
>> Also use readelf -W for a more stable output format.
>>
>> This avoids grabled configure diagnostics:
>
> garbled

Fixed locally.

>> checking for s390-specific static PIE requirements (runtime check)...  0x0000000000000017 (JMPREL)             0x280
>> yes
>>
>> Tested on s390x-linux-gnu.  The generated .so files do not change.
>
> Maybe check config.log for good measure?

The command logging in config.log changed, but the rest is unchanged.

Thanks,
Florian
Andreas Schwab June 20, 2024, 10:34 a.m. UTC | #3
On Jun 20 2024, Florian Weimer wrote:

> checking for s390-specific static PIE requirements (runtime check)...  0x0000000000000017 (JMPREL)             0x280
> yes

The output could be redirected to the log file.
Florian Weimer June 20, 2024, 11:37 a.m. UTC | #4
* Andreas Schwab:

> On Jun 20 2024, Florian Weimer wrote:
>
>> checking for s390-specific static PIE requirements (runtime check)...  0x0000000000000017 (JMPREL)             0x280
>> yes
>
> The output could be redirected to the log file.

What's the blessed Autoconf construct for that?

Thanks,
Florian
Florian Weimer June 20, 2024, 11:47 a.m. UTC | #5
* Florian Weimer:

> * Andreas Schwab:
>
>> On Jun 20 2024, Florian Weimer wrote:
>>
>>> checking for s390-specific static PIE requirements (runtime check)...  0x0000000000000017 (JMPREL)             0x280
>>> yes
>>
>> The output could be redirected to the log file.
>
> What's the blessed Autoconf construct for that?

I assume it's >&AS_MESSAGE_LOG_FD.

Thanks,
Florian
diff mbox series

Patch

diff --git a/sysdeps/s390/s390-64/configure b/sysdeps/s390/s390-64/configure
index 33c28614c2..7856df7295 100644
--- a/sysdeps/s390/s390-64/configure
+++ b/sysdeps/s390/s390-64/configure
@@ -4,8 +4,8 @@ 
 # Minimal checking for static PIE support in ld.
 # Compare to ld testcase/bugzilla:
 # <binutils-source>/ld/testsuite/ld-elf/pr22263-1.rd
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for s390-specific static PIE requirements (runtime check)" >&5
-printf %s "checking for s390-specific static PIE requirements (runtime check)... " >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for s390-specific static PIE requirements" >&5
+printf %s "checking for s390-specific static PIE requirements... " >&6; }
 if { as_var=\
 libc_cv_s390x_staticpie_req_runtime; eval test \${$as_var+y}; }
 then :
@@ -62,13 +62,13 @@  EOF
   ac_status=$?
   printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; } \
-     && { ac_try='! LC_ALL=C $READELF -Wr conftest | grep R_390_TLS_TPOFF'
+     && { ac_try='! LC_ALL=C $READELF -Wr conftest | grep -q R_390_TLS_TPOFF'
   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
   (eval $ac_try) 2>&5
   ac_status=$?
   printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; } \
-     && { ac_try='LC_ACLL=C $READELF -d conftest | grep JMPREL'
+     && { ac_try='LC_ACLL=C $READELF -Wd conftest | grep -q JMPREL'
   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
   (eval $ac_try) 2>&5
   ac_status=$?
diff --git a/sysdeps/s390/s390-64/configure.ac b/sysdeps/s390/s390-64/configure.ac
index fd729e1496..98f67dafc8 100644
--- a/sysdeps/s390/s390-64/configure.ac
+++ b/sysdeps/s390/s390-64/configure.ac
@@ -4,7 +4,7 @@  GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
 # Minimal checking for static PIE support in ld.
 # Compare to ld testcase/bugzilla:
 # <binutils-source>/ld/testsuite/ld-elf/pr22263-1.rd
-AC_CACHE_CHECK([for s390-specific static PIE requirements (runtime check)], \
+AC_CACHE_CHECK([for s390-specific static PIE requirements], \
 [libc_cv_s390x_staticpie_req_runtime], [dnl
   cat > conftest1.c <<EOF
 __thread int * foo;
@@ -42,8 +42,8 @@  EOF
   if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -fPIE -c conftest1.c -o conftest1.o]) \
      && AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -fPIE -c conftest2.c -o conftest2.o]) \
      && AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static-pie -nostartfiles -nostdlib -fPIE -o conftest conftest1.o conftest2.o]) \
-     && AC_TRY_COMMAND([! LC_ALL=C $READELF -Wr conftest | grep R_390_TLS_TPOFF]) \
-     && AC_TRY_COMMAND([LC_ACLL=C $READELF -d conftest | grep JMPREL])
+     && AC_TRY_COMMAND([! LC_ALL=C $READELF -Wr conftest | grep -q R_390_TLS_TPOFF]) \
+     && AC_TRY_COMMAND([LC_ACLL=C $READELF -Wd conftest | grep -q JMPREL])
   then
     libc_cv_s390x_staticpie_req_runtime=yes
   fi