[v2,09/10] powerpc64le: blacklist broken GCC compilers (e.g GCC 7.5.0)

Message ID 20200327211801.31234-10-murphyp@linux.vnet.ibm.com
State Superseded
Headers
Series IEEE binary128 long double on powerpc64le |

Commit Message

Paul E. Murphy March 27, 2020, 9:18 p.m. UTC
  GCC 7.5.0 (BZ# 94200) will refuse to compile if both -mabi=% and
-mlong-double-128 are passed on the command line.  Surprisingly,
it will work happily if the latter is not.  For the sake of
maintianing status quo, test for and blacklist such compilers.

Tested with a GCC 8.3.1 and GCC 7.5.0 compiler for ppc64le.
---
 sysdeps/ieee754/ldbl-128ibm-compat/Makefile | 12 ---------
 sysdeps/powerpc/powerpc64/le/configure      | 27 +++++++++++++++++++++
 sysdeps/powerpc/powerpc64/le/configure.ac   | 15 ++++++++++++
 3 files changed, 42 insertions(+), 12 deletions(-)
  

Comments

Adhemerval Zanella April 3, 2020, 8:38 p.m. UTC | #1
On 27/03/2020 18:18, Paul E. Murphy via Libc-alpha wrote:
> GCC 7.5.0 (BZ# 94200) will refuse to compile if both -mabi=% and
> -mlong-double-128 are passed on the command line.  Surprisingly,
> it will work happily if the latter is not.  For the sake of
> maintianing status quo, test for and blacklist such compilers.
> 
> Tested with a GCC 8.3.1 and GCC 7.5.0 compiler for ppc64le.

I guess that test for 7.5.0 is that it emits an error when
trying to configure glibc, right?
  
Paul E Murphy April 7, 2020, 7:57 p.m. UTC | #2
On 4/3/20 3:38 PM, Adhemerval Zanella via Libc-alpha wrote:
> 
> 
> On 27/03/2020 18:18, Paul E. Murphy via Libc-alpha wrote:
>> GCC 7.5.0 (BZ# 94200) will refuse to compile if both -mabi=% and
>> -mlong-double-128 are passed on the command line.  Surprisingly,
>> it will work happily if the latter is not.  For the sake of
>> maintianing status quo, test for and blacklist such compilers.
>>
>> Tested with a GCC 8.3.1 and GCC 7.5.0 compiler for ppc64le.
> 
> I guess that test for 7.5.0 is that it emits an error when
> trying to configure glibc, right?

Correct.
  

Patch

diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/Makefile b/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
index 0ac52a53bc..7b42746c34 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
@@ -249,13 +249,6 @@  ldbl-extra-routines += err \
 CFLAGS-ieee128-qefgcvt.c += -mabi=ieeelongdouble -Wno-psabi -mno-gnu-attribute
 CFLAGS-ieee128-qefgcvt_r.c += -mabi=ieeelongdouble -Wno-psabi -mno-gnu-attribute
 
-# Remove -mlong-double-128 because it does not work correctly with
-# -mabi=ibmlongdoule in some GCC versions, e.g. GCC 7.
-$(foreach o,$(all-object-suffixes),$(objpfx)ieee128-qefgcvt$(o)): \
-  sysdep-CFLAGS := $(filter-out -mlong-double-128, $(sysdep-CFLAGS))
-$(foreach o,$(all-object-suffixes),$(objpfx)ieee128-qefgcvt_r$(o)): \
-  sysdep-CFLAGS := $(filter-out -mlong-double-128, $(sysdep-CFLAGS))
-
 tests-internal += tst-ibm128-warn tst-ieee128-warn
 tests-internal += tst-ibm128-error tst-ieee128-error
 tests-internal += tst-ibm128-efgcvt tst-ieee128-efgcvt
@@ -348,11 +341,6 @@  ldbl-ibm128-files := $(objpfx)test-%-ibm128^ \
 		     $(foreach r,$(ldbl-extra-routines),$(objpfx)$(r)-internal^)
 obj-suf-foreach = $(foreach suf,$(all-object-suffixes),$(subst ^,$(suf),$(1)))
 
-# Remove -mlong-double-128 because it does not work correctly with
-# -mabi=ibmlongdoule in some GCC versions, e.g. GCC 7.
-$(call obj-suf-foreach,$(ldbl-ibm128-files)): \
-  sysdep-CFLAGS := $(filter-out -mlong-double-128, $(sysdep-CFLAGS))
-
 # Explicitly add -mabi=ibm-long-double to required files.
 $(call obj-suf-foreach,$(ldbl-ibm128-files)): \
   sysdep-CFLAGS += -mabi=ibmlongdouble
diff --git a/sysdeps/powerpc/powerpc64/le/configure b/sysdeps/powerpc/powerpc64/le/configure
index 46f8bfd727..0971f2b1f5 100644
--- a/sysdeps/powerpc/powerpc64/le/configure
+++ b/sysdeps/powerpc/powerpc64/le/configure
@@ -90,6 +90,33 @@  if test "$libc_cv_compiler_powerpc64le_ice" != "yes"; then :
   critic_missing="$critic_missing GCC >= 7.3 is required on powerpc64le."
 fi
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC compiles with -mabi=ieeelongdouble and -mlong-double-128" >&5
+$as_echo_n "checking if $CC compiles with -mabi=ieeelongdouble and -mlong-double-128... " >&6; }
+if ${libc_cv_compiler_powerpc64le_ldbl128_mabi+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -mabi=ieeelongdouble -mlong-double-128"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+long double x;
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  libc_cv_compiler_powerpc64le_ldbl128_mabi=yes
+else
+  libc_cv_compiler_powerpc64le_ldbl128_mabi=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+CFLAGS="$save_CFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_compiler_powerpc64le_ldbl128_mabi" >&5
+$as_echo "$libc_cv_compiler_powerpc64le_ldbl128_mabi" >&6; }
+if test "$libc_cv_compiler_powerpc64le_ldbl128_mabi" == "no"; then :
+  critic_missing="$critic_missing The compiler must support -mabi=ieeelongdouble and -mlongdouble simultaneously."
+fi
+
 # Binutils (objcopy) 2.26 or newer required to support the --update-section
 # feature for fixing up .gnu.attribute section with IEEE ldbl.
 for ac_prog in $OBJCOPY
diff --git a/sysdeps/powerpc/powerpc64/le/configure.ac b/sysdeps/powerpc/powerpc64/le/configure.ac
index 4fea85882a..f3070634b9 100644
--- a/sysdeps/powerpc/powerpc64/le/configure.ac
+++ b/sysdeps/powerpc/powerpc64/le/configure.ac
@@ -51,6 +51,21 @@  CFLAGS="$save_CFLAGS"])
 AS_IF([test "$libc_cv_compiler_powerpc64le_ice" != "yes"],
       [critic_missing="$critic_missing GCC >= 7.3 is required on powerpc64le."])
 
+dnl Some old compiler versions give out error messages when combining
+dnl -mabi=% and -mlong-double-128.  i.e GCC 7.5.0 (BZ# 94200)
+AC_CACHE_CHECK([if $CC compiles with -mabi=ieeelongdouble and -mlong-double-128],
+	       libc_cv_compiler_powerpc64le_ldbl128_mabi, [dnl
+save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -mabi=ieeelongdouble -mlong-double-128"
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+long double x;
+]])],
+		  [libc_cv_compiler_powerpc64le_ldbl128_mabi=yes],
+		  [libc_cv_compiler_powerpc64le_ldbl128_mabi=no])
+CFLAGS="$save_CFLAGS"])
+AS_IF([test "$libc_cv_compiler_powerpc64le_ldbl128_mabi" == "no"],
+      [critic_missing="$critic_missing The compiler must support -mabi=ieeelongdouble and -mlongdouble simultaneously."])
+
 # Binutils (objcopy) 2.26 or newer required to support the --update-section
 # feature for fixing up .gnu.attribute section with IEEE ldbl.
 AC_CHECK_PROG_VER(OBJCOPY, $OBJCOPY, --version,