S390: Use compile-only instead of also link-tests in configure.

Message ID 20230510112518.1976213-1-stli@linux.ibm.com
State Superseded
Headers
Series S390: Use compile-only instead of also link-tests in configure. |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent
dj/TryBot-32bit success Build for i686

Commit Message

Stefan Liebler May 10, 2023, 11:25 a.m. UTC
  Some of the s390-specific configure checks are using compile and
link configure tests.  Now use only compile tests as the link
tests fails when e.g. bootstrapping a cross-toolchain due to
missing crt-files/libc.so.

This is observable e.g. when using buildroot which builds glibc
only once or the build-many-glibcs.py script.  Note that the latter
one is building glibc twice in the compilers-step (configure-checks
fails) and in the glibcs-step (configure-checks succeed).

Note, that the s390 specific configure tests for static PIE have to
link an executable to test binutils support.  Thus we can't fix
those tests.
---
 sysdeps/s390/configure    | 14 +++++++-------
 sysdeps/s390/configure.ac | 14 +++++++-------
 2 files changed, 14 insertions(+), 14 deletions(-)
  

Comments

Andreas Schwab May 10, 2023, 11:47 a.m. UTC | #1
On Mai 10 2023, Stefan Liebler via Libc-alpha wrote:

> diff --git a/sysdeps/s390/configure.ac b/sysdeps/s390/configure.ac
> index daf1bc6823..02c0f66c76 100644
> --- a/sysdeps/s390/configure.ac
> +++ b/sysdeps/s390/configure.ac
> @@ -39,7 +39,7 @@ void testvecinsn ()
>  EOF
>  dnl
>  dnl test, if assembler supports S390 vector instructions
> -if AC_TRY_COMMAND([${CC-cc} --shared conftest.c -o conftest.o &> /dev/null]) ;
> +if AC_TRY_COMMAND([${CC-cc} -c --shared conftest.c -o conftest.o &> /dev/null]) ;

--shared is only a linker option.  Can this use AC_COMPILE_IFELSE instead?
  
Stefan Liebler May 12, 2023, 10:47 a.m. UTC | #2
On 10.05.23 13:47, Andreas Schwab wrote:
> On Mai 10 2023, Stefan Liebler via Libc-alpha wrote:
> 
>> diff --git a/sysdeps/s390/configure.ac b/sysdeps/s390/configure.ac
>> index daf1bc6823..02c0f66c76 100644
>> --- a/sysdeps/s390/configure.ac
>> +++ b/sysdeps/s390/configure.ac
>> @@ -39,7 +39,7 @@ void testvecinsn ()
>>  EOF
>>  dnl
>>  dnl test, if assembler supports S390 vector instructions
>> -if AC_TRY_COMMAND([${CC-cc} --shared conftest.c -o conftest.o &> /dev/null]) ;
>> +if AC_TRY_COMMAND([${CC-cc} -c --shared conftest.c -o conftest.o &> /dev/null]) ;
> 
> --shared is only a linker option.  Can this use AC_COMPILE_IFELSE instead?
> 
Hi Andreas,

yes, AC_COMPILE_IFELSE is fine. I've just posted v2:
"[PATCH v2] S390: Use compile-only instead of also link-tests in configure."
https://sourceware.org/pipermail/libc-alpha/2023-May/148028.html
Can you please have a look?

Thanks,
Stefan
  

Patch

diff --git a/sysdeps/s390/configure b/sysdeps/s390/configure
index cc68cbbb03..894fe3b594 100644
--- a/sysdeps/s390/configure
+++ b/sysdeps/s390/configure
@@ -51,7 +51,7 @@  void testvecinsn ()
 	     "locghie %%r1,0" : :);
 }
 EOF
-if { ac_try='${CC-cc} --shared conftest.c -o conftest.o &> /dev/null'
+if { ac_try='${CC-cc} -c --shared conftest.c -o conftest.o &> /dev/null'
   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -87,7 +87,7 @@  void testvecclobber ()
   __asm__ ("" : : : "v16");
 }
 EOF
-if { ac_try='${CC-cc} --shared conftest.c -o conftest.o &> /dev/null'
+if { ac_try='${CC-cc} -c --shared conftest.c -o conftest.o &> /dev/null'
   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -125,7 +125,7 @@  void testinsn (char *buf)
 	     : : "a" (buf) : "memory", "r0");
 }
 EOF
-if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS --shared conftest.c
+if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -c --shared conftest.c
 			-o conftest.o &> /dev/null'
   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
   (eval $ac_try) 2>&5
@@ -164,7 +164,7 @@  void testinsn (void *a, void *b, int n)
 	     : "memory", "cc");
 }
 EOF
-if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS --shared conftest.c
+if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -c --shared conftest.c
 			-o conftest.o &> /dev/null'
   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
   (eval $ac_try) 2>&5
@@ -200,7 +200,7 @@  float testinsn (double e)
     return d;
 }
 EOF
-if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS --shared conftest.c
+if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -c --shared conftest.c
 			-o conftest.o &> /dev/null'
   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
   (eval $ac_try) 2>&5
@@ -238,7 +238,7 @@  int testinsn (void)
     return i;
 }
 EOF
-if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS --shared conftest.c
+if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -c --shared conftest.c
 			-o conftest.o &> /dev/null'
   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
   (eval $ac_try) 2>&5
@@ -275,7 +275,7 @@  void testinsn (char *buf)
 	     : : "a" (buf) : "memory", "r0");
 }
 EOF
-if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS --shared conftest.c
+if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -c --shared conftest.c
 			-o conftest.o &> /dev/null'
   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
   (eval $ac_try) 2>&5
diff --git a/sysdeps/s390/configure.ac b/sysdeps/s390/configure.ac
index daf1bc6823..02c0f66c76 100644
--- a/sysdeps/s390/configure.ac
+++ b/sysdeps/s390/configure.ac
@@ -39,7 +39,7 @@  void testvecinsn ()
 EOF
 dnl
 dnl test, if assembler supports S390 vector instructions
-if AC_TRY_COMMAND([${CC-cc} --shared conftest.c -o conftest.o &> /dev/null]) ;
+if AC_TRY_COMMAND([${CC-cc} -c --shared conftest.c -o conftest.o &> /dev/null]) ;
 then
   libc_cv_asm_s390_vx=yes
 else
@@ -63,7 +63,7 @@  void testvecclobber ()
 EOF
 dnl
 dnl test, if gcc supports S390 vector registers as clobber in inline assembly
-if AC_TRY_COMMAND([${CC-cc} --shared conftest.c -o conftest.o &> /dev/null]) ;
+if AC_TRY_COMMAND([${CC-cc} -c --shared conftest.c -o conftest.o &> /dev/null]) ;
 then
   libc_cv_gcc_s390_vx=yes
 else
@@ -90,7 +90,7 @@  void testinsn (char *buf)
 }
 EOF
 dnl test, if assembler supports S390 arch13 instructions
-if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS --shared conftest.c
+if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -c --shared conftest.c
 			-o conftest.o &> /dev/null]) ;
 then
   libc_cv_asm_s390_arch13=yes
@@ -119,7 +119,7 @@  void testinsn (void *a, void *b, int n)
 EOF
 dnl
 dnl test, if assembler supports S390 z10 zarch instructions as default
-if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS --shared conftest.c
+if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -c --shared conftest.c
 			-o conftest.o &> /dev/null]) ;
 then
   libc_cv_asm_s390_min_z10_zarch=yes
@@ -145,7 +145,7 @@  float testinsn (double e)
 EOF
 dnl
 dnl test, if assembler supports S390 z196 zarch instructions as default
-if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS --shared conftest.c
+if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -c --shared conftest.c
 			-o conftest.o &> /dev/null]) ;
 then
   libc_cv_asm_s390_min_z196_zarch=yes
@@ -173,7 +173,7 @@  int testinsn (void)
 EOF
 dnl
 dnl test, if assembler supports S390 z13 zarch instructions as default
-if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS --shared conftest.c
+if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -c --shared conftest.c
 			-o conftest.o &> /dev/null]) ;
 then
   libc_cv_asm_s390_min_z13_zarch=yes
@@ -199,7 +199,7 @@  void testinsn (char *buf)
 }
 EOF
 dnl test, if assembler supports S390 arch13 zarch instructions as default
-if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS --shared conftest.c
+if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -c --shared conftest.c
 			-o conftest.o &> /dev/null]) ;
 then
   libc_cv_asm_s390_min_arch13_zarch=yes