https://gcc.gnu.org/g:3696abc890a0e9acbd4e93c688d0e238c011ee76
commit 3696abc890a0e9acbd4e93c688d0e238c011ee76 Author: Michael Meissner <meiss...@linux.ibm.com> Date: Wed Sep 4 11:31:56 2024 -0400 Do not build IEEE 128-bit libstdc++ support if VSX is not available. If you build a little endian compiler and select a default CPU of power5 (i.e. --with-cpu=power5), GCC cannot be built. The reason is that both the libgfortran and libstdc++-v3 libraries assume that all little endian powerpc builds support IEEE 128-bit floating point. However, if the default cpu does not support the VSX instruction set, then we cannot build the IEEE 128-bit libraries. This patch fixes the libstdc++-v3 library so if the GCC compiler does not support IEEE 128-bit floating point, the IEEE 128-bit floating point libraries are not built. A companion patch will fix the libgfortran library. I have built these patches on a little endian system, doing both normal builds, and making a build with a power5 default. There was no regression in the normal builds. I have also built a big endian GCC compiler and there was no regression there. Can I check this patch into the trunk? 2024-09-04 Michael Meissner <meiss...@linux.ibm.com> libstdc++-v3/ PR target/115800 * configure.ac (powerpc*-*-linux*): Don't enable IEEE 128-bit on PowerPC systems without VSX. * configure: Regenerate. * numeric_traits.h: Don't enable IEEE 128-bit on PowerPC systems without VSX. Diff: --- libgcc/config.host | 12 ++++++------ libgcc/config/rs6000/t-float128 | 8 +++++++- libgcc/config/rs6000/t-float128-hw | 3 +-- libgcc/config/rs6000/t-float128-p10-hw | 3 +-- libgcc/configure | 8 +++++++- libgcc/configure.ac | 8 +++++++- 6 files changed, 29 insertions(+), 13 deletions(-) diff --git a/libgcc/config.host b/libgcc/config.host index 9fae51d4ce7..261b08859a4 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -1292,14 +1292,14 @@ powerpc*-*-linux*) if test $libgcc_cv_powerpc_float128 = yes; then tmake_file="${tmake_file} rs6000/t-float128" - fi - if test $libgcc_cv_powerpc_float128_hw = yes; then - tmake_file="${tmake_file} rs6000/t-float128-hw" - fi + if test $libgcc_cv_powerpc_float128_hw = yes; then + tmake_file="${tmake_file} rs6000/t-float128-hw" - if test $libgcc_cv_powerpc_3_1_float128_hw = yes; then - tmake_file="${tmake_file} rs6000/t-float128-p10-hw" + if test $libgcc_cv_powerpc_3_1_float128_hw = yes; then + tmake_file="${tmake_file} rs6000/t-float128-p10-hw" + fi + fi fi extra_parts="$extra_parts ecrti.o ecrtn.o ncrti.o ncrtn.o" diff --git a/libgcc/config/rs6000/t-float128 b/libgcc/config/rs6000/t-float128 index b09b5664af0..93e78adcd62 100644 --- a/libgcc/config/rs6000/t-float128 +++ b/libgcc/config/rs6000/t-float128 @@ -74,7 +74,13 @@ fp128_includes = $(srcdir)/soft-fp/double.h \ $(srcdir)/soft-fp/soft-fp.h # Build the emulator without ISA 3.0 hardware support. -FP128_CFLAGS_SW = -Wno-type-limits -mvsx -mfloat128 \ +# +# In the past we added -mvsx to build the float128 specific libraries with the +# VSX instruction set. This allowed the big endian GCC on server platforms to +# build the float128 support. However, is causes problems when other default +# cpu targets are used such as the 7450. + +FP128_CFLAGS_SW = -Wno-type-limits -mfloat128 \ -mno-float128-hardware -mno-gnu-attribute \ -I$(srcdir)/soft-fp \ -I$(srcdir)/config/rs6000 \ diff --git a/libgcc/config/rs6000/t-float128-hw b/libgcc/config/rs6000/t-float128-hw index ed67b572580..82726c98b98 100644 --- a/libgcc/config/rs6000/t-float128-hw +++ b/libgcc/config/rs6000/t-float128-hw @@ -23,8 +23,7 @@ fp128_ifunc_obj = $(fp128_ifunc_static_obj) $(fp128_ifunc_shared_obj) fp128_sed_hw = -hw # Build the hardware support functions with appropriate hardware support -FP128_CFLAGS_HW = -Wno-type-limits -mvsx -mfloat128 \ - -mcpu=power9 \ +FP128_CFLAGS_HW = -Wno-type-limits -mfloat128 -mcpu=power9 \ -mfloat128-hardware -mno-gnu-attribute \ -I$(srcdir)/soft-fp \ -I$(srcdir)/config/rs6000 \ diff --git a/libgcc/config/rs6000/t-float128-p10-hw b/libgcc/config/rs6000/t-float128-p10-hw index edaaee0e478..ee50d248ca1 100644 --- a/libgcc/config/rs6000/t-float128-p10-hw +++ b/libgcc/config/rs6000/t-float128-p10-hw @@ -13,8 +13,7 @@ fp128_3_1_hw_shared_obj = $(addsuffix _s$(objext),$(fp128_3_1_hw_funcs)) fp128_3_1_hw_obj = $(fp128_3_1_hw_static_obj) $(fp128_3_1_hw_shared_obj) # Build the hardware support functions with appropriate hardware support -FP128_3_1_CFLAGS_HW = -Wno-type-limits -mvsx -mfloat128 \ - -mcpu=power10 \ +FP128_3_1_CFLAGS_HW = -Wno-type-limits -mfloat128 -mcpu=power10 \ -mfloat128-hardware -mno-gnu-attribute \ -I$(srcdir)/soft-fp \ -I$(srcdir)/config/rs6000 \ diff --git a/libgcc/configure b/libgcc/configure index a69d314374a..635237a06c8 100755 --- a/libgcc/configure +++ b/libgcc/configure @@ -5184,9 +5184,15 @@ case ${host} in # check if we have VSX (ISA 2.06) support to build the software libraries, and # whether the assembler can handle xsaddqp for hardware support. Also check if # a new glibc is being used so that __builtin_cpu_supports can be used. +# +# with the VSX instruction set. This allowed the big endian GCC on server +# platforms to build the float128 support. However, is causes problems when +# other default cpu targets are used such as the 7450. Now +# libgcc_cv_powerpc_float128 will fail if the default cpu cannot build the +# float128 support. powerpc*-*-linux*) saved_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -mabi=altivec -mvsx -mfloat128" + CFLAGS="$CFLAGS -mfloat128" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PowerPC ISA 2.06 to build __float128 libraries" >&5 $as_echo_n "checking for PowerPC ISA 2.06 to build __float128 libraries... " >&6; } if ${libgcc_cv_powerpc_float128+:} false; then : diff --git a/libgcc/configure.ac b/libgcc/configure.ac index c2749fe0958..2a725a6f662 100644 --- a/libgcc/configure.ac +++ b/libgcc/configure.ac @@ -407,9 +407,15 @@ case ${host} in # check if we have VSX (ISA 2.06) support to build the software libraries, and # whether the assembler can handle xsaddqp for hardware support. Also check if # a new glibc is being used so that __builtin_cpu_supports can be used. +# +# with the VSX instruction set. This allowed the big endian GCC on server +# platforms to build the float128 support. However, is causes problems when +# other default cpu targets are used such as the 7450. Now +# libgcc_cv_powerpc_float128 will fail if the default cpu cannot build the +# float128 support. powerpc*-*-linux*) saved_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -mabi=altivec -mvsx -mfloat128" + CFLAGS="$CFLAGS -mfloat128" AC_CACHE_CHECK([for PowerPC ISA 2.06 to build __float128 libraries], [libgcc_cv_powerpc_float128], [AC_COMPILE_IFELSE(