From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1962) id E3F373858D37; Mon, 22 May 2023 08:23:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E3F373858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1684743820; bh=U4Ly4CGKZ2Cp+FtjquTUF2O/0clmkjZGaTxPACbhpUo=; h=From:To:Subject:Date:From; b=V7sAwLX86y61HADp0IHLa3vC4AZPKeikycy7PZyLXyBm8PQ9pjBzbIsRT/0ZiEMNs ucOG//yFFa2ApJFFjqYqyWTPGuQEl2zpWeSm2vxq+SY+HLtsz3H44t3g2U1sbeNcYF AhEPQpRrSrYYnALOJgQfZ0CAPaSYgoutpKnWltxE= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Stefan Liebler To: glibc-cvs@sourceware.org Subject: [glibc] S390: Use compile-only instead of also link-tests in configure. X-Act-Checkin: glibc X-Git-Author: Stefan Liebler X-Git-Refname: refs/heads/master X-Git-Oldrev: 9cc27336c9b6fc7b59d1adbf36f0a044a0b89a59 X-Git-Newrev: 368b7c614b102122b86af3953daea2b30230d0a8 Message-Id: <20230522082340.E3F373858D37@sourceware.org> Date: Mon, 22 May 2023 08:23:40 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=368b7c614b102122b86af3953daea2b30230d0a8 commit 368b7c614b102122b86af3953daea2b30230d0a8 Author: Stefan Liebler Date: Fri May 12 12:44:49 2023 +0200 S390: Use compile-only instead of also link-tests in configure. 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 achieved by using AC_COMPILE_IFELSE in configure.ac file. 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. Diff: --- sysdeps/s390/configure | 142 ++++++++++++++++++++------------------------- sysdeps/s390/configure.ac | 144 +++++++++++++++------------------------------- 2 files changed, 109 insertions(+), 177 deletions(-) diff --git a/sysdeps/s390/configure b/sysdeps/s390/configure index cc68cbbb03..6a13c9c7bd 100644 --- a/sysdeps/s390/configure +++ b/sysdeps/s390/configure @@ -37,12 +37,16 @@ if test "$libc_cv_gcc_builtin_tbegin" = no ; then fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for S390 vector instruction support" >&5 $as_echo_n "checking for S390 vector instruction support... " >&6; } if ${libc_cv_asm_s390_vx+:} false; then : $as_echo_n "(cached) " >&6 else - cat > conftest.c <<\EOF + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + void testvecinsn () { __asm__ (".machine \"z13\" \n\t" @@ -50,23 +54,17 @@ void testvecinsn () "vistrbs %%v16,%%v17 \n\t" "locghie %%r1,0" : :); } -EOF -if { ac_try='${CC-cc} --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=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; } ; -then + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : libc_cv_asm_s390_vx=yes else libc_cv_asm_s390_vx=no fi -rm -f conftest* +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_asm_s390_vx" >&5 $as_echo "$libc_cv_asm_s390_vx" >&6; } - if test "$libc_cv_asm_s390_vx" = yes ; then $as_echo "#define HAVE_S390_VX_ASM_SUPPORT 1" >>confdefs.h @@ -76,45 +74,47 @@ else $as_echo "$as_me: WARNING: Use binutils with vector-support in order to use optimized implementations." >&2;} fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for S390 vector support in gcc" >&5 $as_echo_n "checking for S390 vector support in gcc... " >&6; } if ${libc_cv_gcc_s390_vx+:} false; then : $as_echo_n "(cached) " >&6 else - cat > conftest.c <<\EOF + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + void testvecclobber () { __asm__ ("" : : : "v16"); } -EOF -if { ac_try='${CC-cc} --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=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; } ; -then + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : libc_cv_gcc_s390_vx=yes else libc_cv_gcc_s390_vx=no fi -rm -f conftest* +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_gcc_s390_vx" >&5 $as_echo "$libc_cv_gcc_s390_vx" >&6; } - if test "$libc_cv_gcc_s390_vx" = yes ; then $as_echo "#define HAVE_S390_VX_GCC_SUPPORT 1" >>confdefs.h fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for S390 arch13 zarch instruction support" >&5 $as_echo_n "checking for S390 arch13 zarch instruction support... " >&6; } if ${libc_cv_asm_s390_arch13+:} false; then : $as_echo_n "(cached) " >&6 else - cat > conftest.c <<\EOF + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + void testinsn (char *buf) { __asm__ (".machine \"arch13\" \n\t" @@ -124,20 +124,14 @@ void testinsn (char *buf) "vstrs %%v20,%%v20,%%v20,%%v20,0,2" : : "a" (buf) : "memory", "r0"); } -EOF -if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS --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=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; } ; -then + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : libc_cv_asm_s390_arch13=yes else libc_cv_asm_s390_arch13=no fi -rm -f conftest* +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_asm_s390_arch13" >&5 $as_echo "$libc_cv_asm_s390_arch13" >&6; } @@ -153,7 +147,10 @@ $as_echo_n "checking for S390 z10 zarch instruction support as default... " >&6; if ${libc_cv_asm_s390_min_z10_zarch+:} false; then : $as_echo_n "(cached) " >&6 else - cat > conftest.c <<\EOF + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + void testinsn (void *a, void *b, int n) { __asm__ ("exrl %2,1f \n\t" @@ -163,72 +160,66 @@ void testinsn (void *a, void *b, int n) : : "a" (a), "a" (b), "d" (n) : "memory", "cc"); } -EOF -if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS --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=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; } ; -then + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : libc_cv_asm_s390_min_z10_zarch=yes else libc_cv_asm_s390_min_z10_zarch=no fi -rm -f conftest* +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_asm_s390_min_z10_zarch" >&5 $as_echo "$libc_cv_asm_s390_min_z10_zarch" >&6; } - if test "$libc_cv_asm_s390_min_z10_zarch" = yes ; then $as_echo "#define HAVE_S390_MIN_Z10_ZARCH_ASM_SUPPORT 1" >>confdefs.h fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for S390 z196 zarch instruction support as default" >&5 $as_echo_n "checking for S390 z196 zarch instruction support as default... " >&6; } if ${libc_cv_asm_s390_min_z196_zarch+:} false; then : $as_echo_n "(cached) " >&6 else - cat > conftest.c <<\EOF + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + float testinsn (double e) { float d; __asm__ ("ledbra %0,5,%1,4" : "=f" (d) : "f" (e) ); return d; } -EOF -if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS --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=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; } ; -then + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : libc_cv_asm_s390_min_z196_zarch=yes else libc_cv_asm_s390_min_z196_zarch=no fi -rm -f conftest* +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_asm_s390_min_z196_zarch" >&5 $as_echo "$libc_cv_asm_s390_min_z196_zarch" >&6; } - if test "$libc_cv_asm_s390_min_z196_zarch" = yes ; then $as_echo "#define HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT 1" >>confdefs.h fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for S390 z13 zarch instruction support as default" >&5 $as_echo_n "checking for S390 z13 zarch instruction support as default... " >&6; } if ${libc_cv_asm_s390_min_z13_zarch+:} false; then : $as_echo_n "(cached) " >&6 else - cat > conftest.c <<\EOF + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + int testinsn (void) { int i; @@ -237,36 +228,33 @@ int testinsn (void) : "=d" (i) : : "memory", "v16"); return i; } -EOF -if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS --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=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; } ; -then + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : libc_cv_asm_s390_min_z13_zarch=yes else libc_cv_asm_s390_min_z13_zarch=no fi -rm -f conftest* +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_asm_s390_min_z13_zarch" >&5 $as_echo "$libc_cv_asm_s390_min_z13_zarch" >&6; } - if test "$libc_cv_asm_s390_min_z13_zarch" = yes ; then $as_echo "#define HAVE_S390_MIN_Z13_ZARCH_ASM_SUPPORT 1" >>confdefs.h fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for S390 arch13 zarch instruction support as default" >&5 $as_echo_n "checking for S390 arch13 zarch instruction support as default... " >&6; } if ${libc_cv_asm_s390_min_arch13_zarch+:} false; then : $as_echo_n "(cached) " >&6 else - cat > conftest.c <<\EOF + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + void testinsn (char *buf) { __asm__ ("lghi %%r0,16 \n\t" @@ -274,20 +262,14 @@ void testinsn (char *buf) "vstrs %%v20,%%v20,%%v20,%%v20,0,2" : : "a" (buf) : "memory", "r0"); } -EOF -if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS --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=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; } ; -then + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : libc_cv_asm_s390_min_arch13_zarch=yes else libc_cv_asm_s390_min_arch13_zarch=no fi -rm -f conftest* +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_asm_s390_min_arch13_zarch" >&5 $as_echo "$libc_cv_asm_s390_min_arch13_zarch" >&6; } diff --git a/sysdeps/s390/configure.ac b/sysdeps/s390/configure.ac index daf1bc6823..89c3e5b211 100644 --- a/sysdeps/s390/configure.ac +++ b/sysdeps/s390/configure.ac @@ -27,8 +27,8 @@ if test "$libc_cv_gcc_builtin_tbegin" = no ; then fi -AC_CACHE_CHECK(for S390 vector instruction support, libc_cv_asm_s390_vx, [dnl -cat > conftest.c <<\EOF +AC_CACHE_CHECK([for S390 vector instruction support], libc_cv_asm_s390_vx, [ +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ void testvecinsn () { __asm__ (".machine \"z13\" \n\t" @@ -36,17 +36,9 @@ void testvecinsn () "vistrbs %%v16,%%v17 \n\t" "locghie %%r1,0" : :); } -EOF -dnl -dnl test, if assembler supports S390 vector instructions -if AC_TRY_COMMAND([${CC-cc} --shared conftest.c -o conftest.o &> /dev/null]) ; -then - libc_cv_asm_s390_vx=yes -else - libc_cv_asm_s390_vx=no -fi -rm -f conftest* ]) - +]])], + [libc_cv_asm_s390_vx=yes], + [libc_cv_asm_s390_vx=no])]) if test "$libc_cv_asm_s390_vx" = yes ; then AC_DEFINE(HAVE_S390_VX_ASM_SUPPORT) @@ -54,31 +46,26 @@ else AC_MSG_WARN([Use binutils with vector-support in order to use optimized implementations.]) fi -AC_CACHE_CHECK(for S390 vector support in gcc, libc_cv_gcc_s390_vx, [dnl -cat > conftest.c <<\EOF + +dnl test, if gcc supports S390 vector registers as clobber in inline assembly +AC_CACHE_CHECK([for S390 vector support in gcc], libc_cv_gcc_s390_vx, [ +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ void testvecclobber () { __asm__ ("" : : : "v16"); } -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]) ; -then - libc_cv_gcc_s390_vx=yes -else - libc_cv_gcc_s390_vx=no -fi -rm -f conftest* ]) - +]])], + [libc_cv_gcc_s390_vx=yes], + [libc_cv_gcc_s390_vx=no])]) if test "$libc_cv_gcc_s390_vx" = yes ; then AC_DEFINE(HAVE_S390_VX_GCC_SUPPORT) fi -AC_CACHE_CHECK(for S390 arch13 zarch instruction support, - libc_cv_asm_s390_arch13, [dnl -cat > conftest.c <<\EOF + +AC_CACHE_CHECK([for S390 arch13 zarch instruction support], + libc_cv_asm_s390_arch13, [ +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ void testinsn (char *buf) { __asm__ (".machine \"arch13\" \n\t" @@ -88,25 +75,18 @@ void testinsn (char *buf) "vstrs %%v20,%%v20,%%v20,%%v20,0,2" : : "a" (buf) : "memory", "r0"); } -EOF -dnl test, if assembler supports S390 arch13 instructions -if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS --shared conftest.c - -o conftest.o &> /dev/null]) ; -then - libc_cv_asm_s390_arch13=yes -else - libc_cv_asm_s390_arch13=no -fi -rm -f conftest* ]) +]])], + [libc_cv_asm_s390_arch13=yes], + [libc_cv_asm_s390_arch13=no])]) if test "$libc_cv_asm_s390_arch13" = yes ; then AC_DEFINE(HAVE_S390_ARCH13_ASM_SUPPORT) fi -AC_CACHE_CHECK(for S390 z10 zarch instruction support as default, - libc_cv_asm_s390_min_z10_zarch, [dnl -cat > conftest.c <<\EOF +AC_CACHE_CHECK([for S390 z10 zarch instruction support as default], + libc_cv_asm_s390_min_z10_zarch, [ +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ void testinsn (void *a, void *b, int n) { __asm__ ("exrl %2,1f \n\t" @@ -116,52 +96,36 @@ void testinsn (void *a, void *b, int n) : : "a" (a), "a" (b), "d" (n) : "memory", "cc"); } -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 - -o conftest.o &> /dev/null]) ; -then - libc_cv_asm_s390_min_z10_zarch=yes -else - libc_cv_asm_s390_min_z10_zarch=no -fi -rm -f conftest* ]) - +]])], + [libc_cv_asm_s390_min_z10_zarch=yes], + [libc_cv_asm_s390_min_z10_zarch=no])]) if test "$libc_cv_asm_s390_min_z10_zarch" = yes ; then AC_DEFINE(HAVE_S390_MIN_Z10_ZARCH_ASM_SUPPORT) fi -AC_CACHE_CHECK(for S390 z196 zarch instruction support as default, - libc_cv_asm_s390_min_z196_zarch, [dnl -cat > conftest.c <<\EOF + +AC_CACHE_CHECK([for S390 z196 zarch instruction support as default], + libc_cv_asm_s390_min_z196_zarch, [ +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ float testinsn (double e) { float d; __asm__ ("ledbra %0,5,%1,4" : "=f" (d) : "f" (e) ); return d; } -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 - -o conftest.o &> /dev/null]) ; -then - libc_cv_asm_s390_min_z196_zarch=yes -else - libc_cv_asm_s390_min_z196_zarch=no -fi -rm -f conftest* ]) - +]])], + [libc_cv_asm_s390_min_z196_zarch=yes], + [libc_cv_asm_s390_min_z196_zarch=no])]) if test "$libc_cv_asm_s390_min_z196_zarch" = yes ; then AC_DEFINE(HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT) fi -AC_CACHE_CHECK(for S390 z13 zarch instruction support as default, - libc_cv_asm_s390_min_z13_zarch, [dnl -cat > conftest.c <<\EOF + +AC_CACHE_CHECK([for S390 z13 zarch instruction support as default], + libc_cv_asm_s390_min_z13_zarch, [ +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ int testinsn (void) { int i; @@ -170,26 +134,18 @@ int testinsn (void) : "=d" (i) : : "memory", "v16"); return i; } -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 - -o conftest.o &> /dev/null]) ; -then - libc_cv_asm_s390_min_z13_zarch=yes -else - libc_cv_asm_s390_min_z13_zarch=no -fi -rm -f conftest* ]) - +]])], + [libc_cv_asm_s390_min_z13_zarch=yes], + [libc_cv_asm_s390_min_z13_zarch=no])]) if test "$libc_cv_asm_s390_min_z13_zarch" = yes ; then AC_DEFINE(HAVE_S390_MIN_Z13_ZARCH_ASM_SUPPORT) fi -AC_CACHE_CHECK(for S390 arch13 zarch instruction support as default, - libc_cv_asm_s390_min_arch13_zarch, [dnl -cat > conftest.c <<\EOF + +AC_CACHE_CHECK([for S390 arch13 zarch instruction support as default], + libc_cv_asm_s390_min_arch13_zarch, [ +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ void testinsn (char *buf) { __asm__ ("lghi %%r0,16 \n\t" @@ -197,21 +153,15 @@ void testinsn (char *buf) "vstrs %%v20,%%v20,%%v20,%%v20,0,2" : : "a" (buf) : "memory", "r0"); } -EOF -dnl test, if assembler supports S390 arch13 zarch instructions as default -if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS --shared conftest.c - -o conftest.o &> /dev/null]) ; -then - libc_cv_asm_s390_min_arch13_zarch=yes -else - libc_cv_asm_s390_min_arch13_zarch=no -fi -rm -f conftest* ]) +]])], + [libc_cv_asm_s390_min_arch13_zarch=yes], + [libc_cv_asm_s390_min_arch13_zarch=no])]) if test "$libc_cv_asm_s390_min_arch13_zarch" = yes ; then AC_DEFINE(HAVE_S390_MIN_ARCH13_ZARCH_ASM_SUPPORT) fi + dnl test if GCC is new enough. See gcc "Bug 98269 - gcc 6.5.0 dnl __builtin_add_overflow() with small uint32_t values incorrectly detects dnl overflow