public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "Paul E. Murphy" <murphyp@linux.vnet.ibm.com>
To: libc-alpha@sourceware.org
Subject: [PATCH v2 06/10] powerpc64le: raise GCC requirement to 7.3 for long double transition
Date: Fri, 27 Mar 2020 16:17:57 -0500	[thread overview]
Message-ID: <20200327211801.31234-7-murphyp@linux.vnet.ibm.com> (raw)
In-Reply-To: <20200327211801.31234-1-murphyp@linux.vnet.ibm.com>

Add compiler feature tests to ensure we can build ieee128 long double.
These test for -mabi=ieeelongdouble, -mno-gnu-attribute, and -Wno-psabi.

Likewise, verify some compiler bugs have been addressed.  These aren't
helpful for building glibc, but may cause test failures when testing
the new long double.  See notes below from Raji.

On powerpc64le, some older compiler versions give error for the function
signbit() for 128-bit floating point types. This is fixed by PR83862
in gcc 8.0 and backported to gcc6 and gcc7. This patch adds a test
to check compiler version to avoid compiler errors during make check.

Likewise, test for -mno-gnu-attribute support which was

On powerpc64le, a few files are built on IEEE long double mode
(-mabi=ieeelongdouble), whereas most are built on IBM long double mode
(-mabi=ibmlongdouble, the default for -mlong-double-128). Since binutils
2.31, linking object files with different long double modes causes
errors similar to:

  ld: libc_pic.a(s_isinfl.os) uses IBM long double,
      libc_pic.a(ieee128-qefgcvt.os) uses IEEE long double.
  collect2: error: ld returned 1 exit status
  make[2]: *** [../Makerules:649: libc_pic.os] Error 1

The warnings are fair and correct, but in order for glibc to have
support for both long double modes on powerpc64le, they have to be
ignored.  This can be accomplished with the use of -mno-gnu-attribute
option when building the few files that require IEEE long double mode.

However, -mno-gnu-attribute is not available in GCC 6, the minimum
version required to build glibc, so this patch adds a test for this
feature in powerpc64le builds, and fails early if it's not available.

Co-Authored-By: Rajalakshmi Srinivasaraghavan  <raji@linux.vnet.ibm.com>
Co-Authored-By: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
---
 INSTALL                                   |  5 ++
 NEWS                                      |  3 +-
 manual/install.texi                       |  5 ++
 sysdeps/powerpc/powerpc64/le/configure    | 59 +++++++++++++++++++++++
 sysdeps/powerpc/powerpc64/le/configure.ac | 35 ++++++++++++++
 5 files changed, 106 insertions(+), 1 deletion(-)

diff --git a/INSTALL b/INSTALL
index 242cb06f91..c97f8218d9 100644
--- a/INSTALL
+++ b/INSTALL
@@ -467,6 +467,11 @@ build the GNU C Library:
      better code.  As of release time, GCC 9.2.1 is the newest compiler
      verified to work to build the GNU C Library.
 
+     For PowerPC 64-bits little-endian (powerpc64le), a GCC version with
+     support for '-mno-gnu-attribute' is required.  As of release time,
+     this means GCC 7 or higher.  The compiler option is required for
+     building the GNU C Library with support for IEEE long double.
+
      For multi-arch support it is recommended to use a GCC which has
      been built with support for GNU indirect functions.  This ensures
      that correct debugging information is generated for functions
diff --git a/NEWS b/NEWS
index 466c203633..b1cda0d43d 100644
--- a/NEWS
+++ b/NEWS
@@ -17,7 +17,8 @@ Deprecated and removed features, and other changes affecting compatibility:
 
 Changes to build and runtime requirements:
 
-  [Add changes to build and runtime requirements here]
+  * powerpc64le requires GCC 7.3 or newer.  This is required for supporting
+    long double redirects.
 
 Security related changes:
 
diff --git a/manual/install.texi b/manual/install.texi
index 71bf47cac6..3e32a08eaa 100644
--- a/manual/install.texi
+++ b/manual/install.texi
@@ -507,6 +507,11 @@ the newest version of the compiler that is known to work for building
 release time, GCC 9.2.1 is the newest compiler verified to work to build
 @theglibc{}.
 
+For PowerPC 64-bits little-endian (powerpc64le), a GCC version with
+support for @option{-mno-gnu-attribute} is required.  As of release time,
+this means GCC 7 or higher. The compiler option is required for building
+the GNU C Library with support for IEEE long double.
+
 For multi-arch support it is recommended to use a GCC which has been built with
 support for GNU indirect functions.  This ensures that correct debugging
 information is generated for functions selected by IFUNC resolvers.  This
diff --git a/sysdeps/powerpc/powerpc64/le/configure b/sysdeps/powerpc/powerpc64/le/configure
index bca80cec76..9f5aba4eef 100644
--- a/sysdeps/powerpc/powerpc64/le/configure
+++ b/sysdeps/powerpc/powerpc64/le/configure
@@ -32,4 +32,63 @@ if test "$libc_cv_target_power8_ok" != "yes"; then :
 fi
 CFLAGS="$OLD_CFLAGS"
 
+OLD_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -mno-gnu-attribute"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the compiler supports -mno-gnu-attribute" >&5
+$as_echo_n "checking if the compiler supports -mno-gnu-attribute... " >&6; }
+if ${libc_cv_no_gnu_attr_ok+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  libc_cv_no_gnu_attr_ok=yes
+else
+  libc_cv_no_gnu_attr_ok=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_no_gnu_attr_ok" >&5
+$as_echo "$libc_cv_no_gnu_attr_ok" >&6; }
+if test "$libc_cv_no_gnu_attr_ok" != "yes"; then :
+  critic_missing="$critic_missing A compiler with -mno-gnu-attribute is required on powerpc64le."
+fi
+CFLAGS="$OLD_CFLAGS"
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC compiles signbit with 128-bit floating point type" >&5
+$as_echo_n "checking if $CC compiles signbit with 128-bit floating point type... " >&6; }
+if ${libc_cv_compiler_powerpc64le_ice+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -mabi=ieeelongdouble -Wno-psabi"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int sbr (long double a) { return __builtin_signbit (a); }
+int sbm (long double *a) { return __builtin_signbit (*a); }
+int sbo (long double *a) { return __builtin_signbit (a[4]); }
+int sbi (long double *a, unsigned long n) { return __builtin_signbit (a[n]); }
+void sbs (int *p, long double a) { *p = __builtin_signbit (a); }
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  libc_cv_compiler_powerpc64le_ice=yes
+else
+  libc_cv_compiler_powerpc64le_ice=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_ice" >&5
+$as_echo "$libc_cv_compiler_powerpc64le_ice" >&6; }
+if test "$libc_cv_compiler_powerpc64le_ice" != "yes"; then :
+  critic_missing="$critic_missing GCC >= 7.3 is required on powerpc64le."
+fi
+
+
 test -n "$critic_missing" && as_fn_error $? "*** $critic_missing" "$LINENO" 5
diff --git a/sysdeps/powerpc/powerpc64/le/configure.ac b/sysdeps/powerpc/powerpc64/le/configure.ac
index 7f2c9fbf1f..9da8412bbc 100644
--- a/sysdeps/powerpc/powerpc64/le/configure.ac
+++ b/sysdeps/powerpc/powerpc64/le/configure.ac
@@ -17,4 +17,39 @@ AS_IF([test "$libc_cv_target_power8_ok" != "yes"],
       [critic_missing="$critic_missing POWER8 or newer is required on powerpc64le."])
 CFLAGS="$OLD_CFLAGS"
 
+dnl Require support for -mno-gnu-attribute
+OLD_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -mno-gnu-attribute"
+AC_CACHE_CHECK([if the compiler supports -mno-gnu-attribute],
+	       libc_cv_no_gnu_attr_ok, [
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+]])],
+	       [libc_cv_no_gnu_attr_ok=yes],
+	       [libc_cv_no_gnu_attr_ok=no])])
+AS_IF([test "$libc_cv_no_gnu_attr_ok" != "yes"],
+      [critic_missing="$critic_missing A compiler with -mno-gnu-attribute is required on powerpc64le."])
+CFLAGS="$OLD_CFLAGS"
+
+dnl Some old compiler versions give error for the function signbit() for
+dnl 128-bit floating point types. This is fixed by BZ 83862 and backported
+dnl to gcc6 and gcc7. This test is to check if we are using the compiler
+dnl that has this bug. (available in GCC 8.0).
+AC_CACHE_CHECK([if $CC compiles signbit with 128-bit floating point type],
+	       libc_cv_compiler_powerpc64le_ice, [dnl
+save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -mabi=ieeelongdouble -Wno-psabi"
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+int sbr (long double a) { return __builtin_signbit (a); }
+int sbm (long double *a) { return __builtin_signbit (*a); }
+int sbo (long double *a) { return __builtin_signbit (a[4]); }
+int sbi (long double *a, unsigned long n) { return __builtin_signbit (a[n]); }
+void sbs (int *p, long double a) { *p = __builtin_signbit (a); }
+]])],
+		  [libc_cv_compiler_powerpc64le_ice=yes],
+		  [libc_cv_compiler_powerpc64le_ice=no])
+CFLAGS="$save_CFLAGS"])
+AS_IF([test "$libc_cv_compiler_powerpc64le_ice" != "yes"],
+      [critic_missing="$critic_missing GCC >= 7.3 is required on powerpc64le."])
+
+
 test -n "$critic_missing" && AC_MSG_ERROR([*** $critic_missing])
-- 
2.21.1


  parent reply	other threads:[~2020-03-27 21:18 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-27 21:17 [PATCH v2 00/10] IEEE binary128 long double on powerpc64le Paul E. Murphy
2020-03-27 21:17 ` [PATCH v2 01/10] ldbl-128ibm-compat: workaround C++ redirect limitations Paul E. Murphy
2020-03-27 21:34   ` Joseph Myers
2020-04-01 20:29     ` Paul E Murphy
2020-04-01 20:41       ` DJ Delorie
2020-04-01 23:07       ` Joseph Myers
2020-04-02 16:48         ` Paul E Murphy
2020-03-27 21:17 ` [PATCH v2 02/10] ldbl-128ibm: simplify iscanonical.h Paul E. Murphy
2020-04-03 20:12   ` Tulio Magno Quites Machado Filho
2020-04-06 16:46     ` Paul E Murphy
2020-03-27 21:17 ` [PATCH v2 03/10] Rename __LONG_DOUBLE_USES_FLOAT128 to Paul E. Murphy
2020-04-03 19:22   ` Tulio Magno Quites Machado Filho
2020-03-27 21:17 ` [PATCH v2 04/10] powerpc64le: Enforce -mabi=ibmlongdouble when -mfloat128 used Paul E. Murphy
2020-04-03 19:29   ` Tulio Magno Quites Machado Filho
2020-04-06 16:49     ` Paul E Murphy
2020-03-27 21:17 ` [PATCH v2 05/10] powerpc64le: workaround ieee long double / _Float128 stdc++ bug Paul E. Murphy
2020-04-03 19:03   ` Tulio Magno Quites Machado Filho
2020-03-27 21:17 ` Paul E. Murphy [this message]
2020-03-31 20:47   ` [PATCH v2 06/10] powerpc64le: raise GCC requirement to 7.3 for long double transition Paul E Murphy
2020-03-27 21:17 ` [PATCH v2 07/10] powerpc64le: bump binutils version requirement to >= 2.26 Paul E. Murphy
2020-04-03 19:36   ` Tulio Magno Quites Machado Filho
2020-03-27 21:17 ` [PATCH v2 08/10] powerpc64le: enforce non-specific long double in .gnu.attributes section Paul E. Murphy
2020-04-03 19:49   ` Tulio Magno Quites Machado Filho
2020-03-27 21:18 ` [PATCH v2 09/10] powerpc64le: blacklist broken GCC compilers (e.g GCC 7.5.0) Paul E. Murphy
2020-04-03 20:38   ` Adhemerval Zanella
2020-04-07 19:57     ` Paul E Murphy
2020-03-27 21:18 ` [PATCH v2 10/10] powerpc64le: Enable support for IEEE long double Paul E. Murphy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200327211801.31234-7-murphyp@linux.vnet.ibm.com \
    --to=murphyp@linux.vnet.ibm.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).