unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2 00/10] IEEE binary128 long double on powerpc64le
@ 2020-03-27 21:17 Paul E. Murphy via Libc-alpha
  2020-03-27 21:17 ` [PATCH v2 01/10] ldbl-128ibm-compat: workaround C++ redirect limitations Paul E. Murphy via Libc-alpha
                   ` (9 more replies)
  0 siblings, 10 replies; 27+ messages in thread
From: Paul E. Murphy via Libc-alpha @ 2020-03-27 21:17 UTC (permalink / raw
  To: libc-alpha

New for V2:

Several preparatory patches have been merged, and three new
patches are added.

Notably, GCC 7.5.x is blacklisted as it cannot handle both
-mabi=* and -mlong-double-128 being passed without error.

Update install.texi and regenerate INSTALL per feedback from
JSM.

Cleanup some ugly loose ends in the ldbl-128ibm iscanonical.h,
and add documentation to, and rename __LONG_DOUBLE_USES_FLOAT128
to __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI.

The final 4 patches should be committed simultaneously, and will
be tested against the cross product of the following GCC versions
and CPU targets.

  {power8, power9, powerpc64le} x { GCC 7.3, 8.4, 9.3}

---8<---

This shuffles the powerpc64le Makefile around to support
building and testing the new long double format.  I consider
this support experimental as GNU libstc++ has some growing
pains to make -mfloat128 and -mabi=ieeelongdouble play nicely
togethor, and the runtime symbol selection may also need some
improvement (i.e dlopen/dlsym).  Nevertheless, this is the
start to making this feature available.

The first 3 patches fixup internal headers to ensure local
PLT usage works, and C++ tests continue to work.  Something
changed between g++ 8 and 9 which prevents the redirects from
working unless the headers are marked as system headers.

The majority of the powerpc64le patches refactor the common
ppc64le Makefile to ensure the correct ldouble/float128
compiler flags are applied when -mabi=ieeelongdouble is
applied globally, as should be the case in some future release.

Notably, the only explicit user of long double internally is
difftime.

Gabriel F. T. Gomes (1):
  powerpc64le: Enable support for IEEE long double

Paul E. Murphy (9):
  ldbl-128ibm-compat: workaround C++ redirect limitations
  ldbl-128ibm: simplify iscanonical.h
  Rename __LONG_DOUBLE_USES_FLOAT128 to
  powerpc64le: Enforce -mabi=ibmlongdouble when -mfloat128 used
  powerpc64le: workaround ieee long double / _Float128 stdc++ bug
  powerpc64le: raise GCC requirement to 7.3 for long double transition
  powerpc64le: bump binutils version requirement to >= 2.26
  powerpc64le: enforce non-specific long double in .gnu.attributes
    section
  powerpc64le: blacklist broken GCC compilers (e.g GCC 7.5.0)

 INSTALL                                       |   9 ++
 NEWS                                          |   8 +-
 argp/argp.h                                   |   2 +-
 bits/long-double.h                            |  15 +-
 elf/tst-addr1.c                               |   2 +-
 include/math.h                                |   6 +-
 include/monetary.h                            |   8 +
 include/printf.h                              |   8 +
 include/stdio.h                               |  16 +-
 include/stdlib.h                              |  11 +-
 include/sys/cdefs.h                           |   2 +-
 include/wchar.h                               |   9 ++
 libio/bits/stdio-ldbl.h                       |   4 +-
 libio/stdio.h                                 |   8 +-
 manual/install.texi                           |   9 ++
 math/complex.h                                |   4 +-
 math/math.h                                   |  12 +-
 math/test-ldouble.h                           |   2 +-
 misc/err.h                                    |   2 +-
 misc/error.h                                  |   2 +-
 misc/sys/cdefs.h                              |   4 +-
 misc/sys/syslog.h                             |   2 +-
 stdio-common/printf.h                         |   2 +-
 stdio-common/tst-vfprintf-user-type.c         |   2 +-
 stdlib/bits/stdlib-ldbl.h                     |   2 +-
 stdlib/monetary.h                             |   2 +-
 stdlib/stdlib.h                               |   2 +-
 sysdeps/ieee754/ldbl-128/bits/long-double.h   |   2 +-
 sysdeps/ieee754/ldbl-128ibm-compat/Makefile   |  12 --
 .../ldbl-128ibm-compat/bits/long-double.h     |   7 +-
 .../ieee754/ldbl-128ibm-compat/math_ldbl.h    |   2 +-
 .../ieee754/ldbl-128ibm/bits/iscanonical.h    |  10 +-
 sysdeps/ieee754/ldbl-128ibm/ieee754.h         |   6 +-
 .../ldbl-128ibm/include/bits/iscanonical.h    |   2 +-
 sysdeps/ieee754/ldbl-96/bits/long-double.h    |   2 +-
 sysdeps/ieee754/ldbl-opt/bits/long-double.h   |   2 +-
 sysdeps/mips/ieee754/bits/long-double.h       |   2 +-
 sysdeps/powerpc/fpu/libm-test-ulps            |   4 +
 sysdeps/powerpc/powerpc64/le/Implies-before   |   1 +
 sysdeps/powerpc/powerpc64/le/Makefile         | 130 ++++++++++-----
 sysdeps/powerpc/powerpc64/le/configure        | 151 ++++++++++++++++++
 sysdeps/powerpc/powerpc64/le/configure.ac     |  56 +++++++
 .../powerpc64/le/fpu/multiarch/Makefile       |   4 +-
 .../powerpc64/le/no_ldbl_gnu_attribute.c      |  30 ++++
 .../powerpc64/le/ldbl-128ibm-compat-abi.h     |   8 +
 .../linux/powerpc/powerpc64/le/libc.abilist   |  93 +++++++++++
 .../linux/powerpc/powerpc64/le/libm.abilist   | 117 ++++++++++++++
 .../linux/sparc/sparc32/bits/long-double.h    |   2 +-
 .../linux/sparc/sparc64/bits/long-double.h    |   2 +-
 wcsmbs/bits/wchar-ldbl.h                      |   4 +-
 wcsmbs/wchar.h                                |   8 +-
 51 files changed, 691 insertions(+), 121 deletions(-)
 create mode 100644 sysdeps/powerpc/powerpc64/le/no_ldbl_gnu_attribute.c
 create mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc64/le/ldbl-128ibm-compat-abi.h

-- 
2.21.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH v2 01/10] ldbl-128ibm-compat: workaround C++ redirect limitations
  2020-03-27 21:17 [PATCH v2 00/10] IEEE binary128 long double on powerpc64le Paul E. Murphy via Libc-alpha
@ 2020-03-27 21:17 ` Paul E. Murphy via Libc-alpha
  2020-03-27 21:34   ` Joseph Myers
  2020-03-27 21:17 ` [PATCH v2 02/10] ldbl-128ibm: simplify iscanonical.h Paul E. Murphy via Libc-alpha
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 27+ messages in thread
From: Paul E. Murphy via Libc-alpha @ 2020-03-27 21:17 UTC (permalink / raw
  To: libc-alpha

GCC 8+ is more pedantic about type checking the redirect declarations
for non-system headers.  I am not sure if there is less obtrusive way
to dodge these warnings when building C++ tests using the headers from
the glibc under construction.
---
 include/monetary.h |  8 ++++++++
 include/printf.h   |  8 ++++++++
 include/stdio.h    | 10 ++++++++++
 include/stdlib.h   |  9 +++++++++
 include/wchar.h    |  9 +++++++++
 5 files changed, 44 insertions(+)

diff --git a/include/monetary.h b/include/monetary.h
index 240925e87d..81933a2c5e 100644
--- a/include/monetary.h
+++ b/include/monetary.h
@@ -1,3 +1,11 @@
+/* This is needed to keep GCC >= 9 happy when using redirects inside system
+   headers.   glibc builds some C++ tests which use these headers which do
+   not get marked as system headers.  */
+#include <bits/floatn.h>
+#if defined __cplusplus && __LONG_DOUBLE_USES_FLOAT128 == 1
+# pragma GCC system_header
+#endif
+
 #include <stdlib/monetary.h>
 #ifndef _ISOMAC
 #include <stdarg.h>
diff --git a/include/printf.h b/include/printf.h
index d051514119..9e74e35678 100644
--- a/include/printf.h
+++ b/include/printf.h
@@ -1,5 +1,13 @@
 #ifndef	_PRINTF_H
 
+/* This is needed to keep GCC >= 9 happy when using redirects inside system
+   headers.   glibc builds some C++ tests which use these headers which do
+   not get marked as system headers.  */
+#include <bits/floatn.h>
+#if defined __cplusplus && __LONG_DOUBLE_USES_FLOAT128 == 1
+# pragma GCC system_header
+#endif
+
 #include <stdio-common/printf.h>
 
 # ifndef _ISOMAC
diff --git a/include/stdio.h b/include/stdio.h
index 6718af4108..517d53837f 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -2,8 +2,18 @@
 # if !defined _ISOMAC && defined _IO_MTSAFE_IO
 #  include <stdio-lock.h>
 # endif
+
+/* This is needed to keep GCC >= 9 happy when using redirects inside system
+   headers.   glibc builds some C++ tests which use these headers which do
+   not get marked as system headers.  */
+# include <bits/floatn.h>
+# if defined __cplusplus && __LONG_DOUBLE_USES_FLOAT128 == 1
+#  pragma GCC system_header
+# endif
+
 # include <libio/stdio.h>
 # ifndef _ISOMAC
+
 #  define _LIBC_STDIO_H 1
 #  include <libio/libio.h>
 
diff --git a/include/stdlib.h b/include/stdlib.h
index 926f965f69..7929e45386 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -3,6 +3,15 @@
 #ifndef _ISOMAC
 # include <stddef.h>
 #endif
+
+/* This is needed to keep GCC >= 9 happy when using redirects inside system
+   headers.   glibc builds some C++ tests which use these headers which do
+   not get marked as system headers.  */
+#include <bits/floatn.h>
+#if defined __cplusplus && __LONG_DOUBLE_USES_FLOAT128 == 1
+# pragma GCC system_header
+#endif
+
 #include <stdlib/stdlib.h>
 
 /* Now define the internal interfaces.  */
diff --git a/include/wchar.h b/include/wchar.h
index 617906eb14..64355dd6fb 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -1,4 +1,13 @@
 #ifndef _WCHAR_H
+
+/* This is needed to keep GCC >= 9 happy when using redirects inside system
+   headers.   glibc builds some C++ tests which use these headers which do
+   not get marked as system headers.  */
+# include <bits/floatn.h>
+# if defined __cplusplus && __LONG_DOUBLE_USES_FLOAT128 == 1
+#  pragma GCC system_header
+# endif
+
 # include <wcsmbs/wchar.h>
 # ifndef _ISOMAC
 
-- 
2.21.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v2 02/10] ldbl-128ibm: simplify iscanonical.h
  2020-03-27 21:17 [PATCH v2 00/10] IEEE binary128 long double on powerpc64le Paul E. Murphy via Libc-alpha
  2020-03-27 21:17 ` [PATCH v2 01/10] ldbl-128ibm-compat: workaround C++ redirect limitations Paul E. Murphy via Libc-alpha
@ 2020-03-27 21:17 ` Paul E. Murphy via Libc-alpha
  2020-04-03 20:12   ` Tulio Magno Quites Machado Filho
  2020-03-27 21:17 ` [PATCH v2 03/10] Rename __LONG_DOUBLE_USES_FLOAT128 to Paul E. Murphy via Libc-alpha
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 27+ messages in thread
From: Paul E. Murphy via Libc-alpha @ 2020-03-27 21:17 UTC (permalink / raw
  To: libc-alpha

The test for enabling _Float128 or IEEE 128 long double can be
greatly simplified knowing that there is no ibm128, thus we require
no special cases, and everything is canonical.

This reverts the changes to ldbl-128ibm iscanonical.h from commit
8dbfea3a2094798a52cebddde01d255483f49665 and extends the check
for __NO_LONG_DOUBLE_MATH to include a check for float128 redirects
to long double.
---
 sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h b/sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h
index 70da85f2cb..b2021b5d64 100644
--- a/sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h
+++ b/sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h
@@ -20,15 +20,11 @@
 # error "Never use <bits/iscanonical.h> directly; include <math.h> instead."
 #endif
 
-#ifdef __NO_LONG_DOUBLE_MATH
+#if defined (__NO_LONG_DOUBLE_MATH) || __LONG_DOUBLE_USES_FLOAT128 == 1
 # define iscanonical(x) ((void) (__typeof (x)) (x), 1)
 #else
-# if __LONG_DOUBLE_USES_FLOAT128 == 1
-# define __iscanonicall(x) ((void) (__typeof (x)) (x), 1)
-# else
 extern int __iscanonicall (long double __x)
      __THROW __attribute__ ((__const__));
-# endif
 # define __iscanonicalf(x) ((void) (__typeof (x)) (x), 1)
 # define __iscanonical(x) ((void) (__typeof (x)) (x), 1)
 # if __HAVE_DISTINCT_FLOAT128
@@ -54,9 +50,7 @@ extern "C++" {
 inline int iscanonical (float __val) { return __iscanonicalf (__val); }
 inline int iscanonical (double __val) { return __iscanonical (__val); }
 inline int iscanonical (long double __val) { return __iscanonicall (__val); }
-/* When using an IEEE 128-bit long double, _Float128 is defined as long double
-   in C++.  */
-#  if __HAVE_DISTINCT_FLOAT128 && __HAVE_FLOAT128_UNLIKE_LDBL
+#  if __HAVE_DISTINCT_FLOAT128
 inline int iscanonical (_Float128 __val) { return __iscanonicalf128 (__val); }
 #  endif
 }
-- 
2.21.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v2 03/10] Rename __LONG_DOUBLE_USES_FLOAT128 to
  2020-03-27 21:17 [PATCH v2 00/10] IEEE binary128 long double on powerpc64le Paul E. Murphy via Libc-alpha
  2020-03-27 21:17 ` [PATCH v2 01/10] ldbl-128ibm-compat: workaround C++ redirect limitations Paul E. Murphy via Libc-alpha
  2020-03-27 21:17 ` [PATCH v2 02/10] ldbl-128ibm: simplify iscanonical.h Paul E. Murphy via Libc-alpha
@ 2020-03-27 21:17 ` Paul E. Murphy via Libc-alpha
  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 via Libc-alpha
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 27+ messages in thread
From: Paul E. Murphy via Libc-alpha @ 2020-03-27 21:17 UTC (permalink / raw
  To: libc-alpha

__LDOUBLE_REDIRECTS_TO_FLOAT128_ABI per feedback and disucssion
on libc-alpha [2].  Likewise, add documentation to the macro
in the common bits/long-double.h header.  This is effectively
V2 of [2].

Per the feedback from Joseph [1].  Good comments and a more
self-explanatory macro name will be very helpful when this
macro is able to assume a non-zero value.

[1] <https://sourceware.org/legacy-ml/libc-alpha/2020-02/msg00687.html>
[2] <https://sourceware.org/pipermail/libc-alpha/2020-February/111148.html>

---8<---

Improve the commentary to aid future developers who will stumble
upon this novel, yet not always perfect, mechanism to support
alternative formats for long double.

Likewise, rename __LONG_DOUBLE_USES_FLOAT128 to
__LDOUBLE_REDIRECTS_TO_FLOAT128_ABI now that development work
has settled down.  The command used was

git grep -l __LONG_DOUBLE_USES_FLOAT128 ':!./ChangeLog*' | \
  xargs sed -i 's/__LONG_DOUBLE_USES_FLOAT128/__LDOUBLE_REDIRECTS_TO_FLOAT128_ABI/g'
---
 argp/argp.h                                       |  2 +-
 bits/long-double.h                                | 15 ++++++++++++++-
 elf/tst-addr1.c                                   |  2 +-
 include/math.h                                    |  6 +++---
 include/monetary.h                                |  2 +-
 include/printf.h                                  |  2 +-
 include/stdio.h                                   |  8 ++++----
 include/stdlib.h                                  |  4 ++--
 include/sys/cdefs.h                               |  2 +-
 include/wchar.h                                   |  2 +-
 libio/bits/stdio-ldbl.h                           |  4 ++--
 libio/stdio.h                                     |  8 ++++----
 math/complex.h                                    |  4 ++--
 math/math.h                                       | 12 ++++++------
 math/test-ldouble.h                               |  2 +-
 misc/err.h                                        |  2 +-
 misc/error.h                                      |  2 +-
 misc/sys/cdefs.h                                  |  4 ++--
 misc/sys/syslog.h                                 |  2 +-
 stdio-common/printf.h                             |  2 +-
 stdio-common/tst-vfprintf-user-type.c             |  2 +-
 stdlib/bits/stdlib-ldbl.h                         |  2 +-
 stdlib/monetary.h                                 |  2 +-
 stdlib/stdlib.h                                   |  2 +-
 sysdeps/ieee754/ldbl-128/bits/long-double.h       |  2 +-
 .../ieee754/ldbl-128ibm-compat/bits/long-double.h |  7 ++-----
 sysdeps/ieee754/ldbl-128ibm-compat/math_ldbl.h    |  2 +-
 sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h    |  2 +-
 sysdeps/ieee754/ldbl-128ibm/ieee754.h             |  6 +++---
 .../ldbl-128ibm/include/bits/iscanonical.h        |  2 +-
 sysdeps/ieee754/ldbl-96/bits/long-double.h        |  2 +-
 sysdeps/ieee754/ldbl-opt/bits/long-double.h       |  2 +-
 sysdeps/mips/ieee754/bits/long-double.h           |  2 +-
 .../sysv/linux/sparc/sparc32/bits/long-double.h   |  2 +-
 .../sysv/linux/sparc/sparc64/bits/long-double.h   |  2 +-
 wcsmbs/bits/wchar-ldbl.h                          |  4 ++--
 wcsmbs/wchar.h                                    |  8 ++++----
 37 files changed, 74 insertions(+), 64 deletions(-)

diff --git a/argp/argp.h b/argp/argp.h
index 358d9b43cd..a5b861a4d3 100644
--- a/argp/argp.h
+++ b/argp/argp.h
@@ -555,7 +555,7 @@ __NTH (__option_is_end (const struct argp_option *__opt))
 #endif /* Use extern inlines.  */
 
 #include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LONG_DOUBLE_USES_FLOAT128 == 1
+#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 # include <bits/argp-ldbl.h>
 #endif
 
diff --git a/bits/long-double.h b/bits/long-double.h
index 6e16447e65..bdde78f49a 100644
--- a/bits/long-double.h
+++ b/bits/long-double.h
@@ -37,4 +37,17 @@
 #ifndef __NO_LONG_DOUBLE_MATH
 # define __NO_LONG_DOUBLE_MATH	1
 #endif
-#define __LONG_DOUBLE_USES_FLOAT128 0
+
+/* The macro __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI is used to determine the
+   choice of the underlying ABI of long double.  It will always assume
+   a constant value for each translation unit.
+
+   If the value is non-zero, any API which is parameterized by the long
+   double type (i.e the scanf/printf family of functions or the explicitly
+   parameterized math.h functions) will be redirected to a compatible
+   implementation using _Float128 ABI via symbols suffixed with ieee128.
+
+   The mechanism this macro uses to acquire may be a function
+   of architecture, or target specific options used to invoke the
+   compiler.  */
+#define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 0
diff --git a/elf/tst-addr1.c b/elf/tst-addr1.c
index 27dc0f00f4..93ce669cbd 100644
--- a/elf/tst-addr1.c
+++ b/elf/tst-addr1.c
@@ -15,7 +15,7 @@ do_test (void)
   if (i.dli_sname == NULL)
     return 1;
 
-#if __LONG_DOUBLE_USES_FLOAT128 == 1
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
   /* On architectures which redirect long double to
      _Float128 (e.g powerpc64le), printf will resolve
      to __printfieee128 due to header redirects.  There
diff --git a/include/math.h b/include/math.h
index 1b3199b3f6..3979c47400 100644
--- a/include/math.h
+++ b/include/math.h
@@ -19,7 +19,7 @@ hidden_proto (__isinff)
 hidden_proto (__isnanf)
 
 #  if !defined __NO_LONG_DOUBLE_MATH \
-      && __LONG_DOUBLE_USES_FLOAT128 == 0
+      && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
 hidden_proto (__finitel)
 hidden_proto (__isinfl)
 hidden_proto (__isnanl)
@@ -42,7 +42,7 @@ libm_hidden_proto (__expf)
 libm_hidden_proto (__roundeven)
 
 #  if !defined __NO_LONG_DOUBLE_MATH \
-      && __LONG_DOUBLE_USES_FLOAT128 == 0
+      && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
 libm_hidden_proto (__fpclassifyl)
 libm_hidden_proto (__issignalingl)
 libm_hidden_proto (__expl)
@@ -143,7 +143,7 @@ fabsf128 (_Float128 x)
   MATH_REDIRECT_LDBL (FUNC, PREFIX, ARGS)			\
   MATH_REDIRECT_F128 (FUNC, PREFIX, ARGS)
 #   if defined __NO_LONG_DOUBLE_MATH 				\
-       || __LONG_DOUBLE_USES_FLOAT128 == 1
+       || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 #    define MATH_REDIRECT_LDBL(FUNC, PREFIX, ARGS)
 #   else
 #    define MATH_REDIRECT_LDBL(FUNC, PREFIX, ARGS)			\
diff --git a/include/monetary.h b/include/monetary.h
index 81933a2c5e..d3e95d394d 100644
--- a/include/monetary.h
+++ b/include/monetary.h
@@ -2,7 +2,7 @@
    headers.   glibc builds some C++ tests which use these headers which do
    not get marked as system headers.  */
 #include <bits/floatn.h>
-#if defined __cplusplus && __LONG_DOUBLE_USES_FLOAT128 == 1
+#if defined __cplusplus && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 # pragma GCC system_header
 #endif
 
diff --git a/include/printf.h b/include/printf.h
index 9e74e35678..a9490807b8 100644
--- a/include/printf.h
+++ b/include/printf.h
@@ -4,7 +4,7 @@
    headers.   glibc builds some C++ tests which use these headers which do
    not get marked as system headers.  */
 #include <bits/floatn.h>
-#if defined __cplusplus && __LONG_DOUBLE_USES_FLOAT128 == 1
+#if defined __cplusplus && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 # pragma GCC system_header
 #endif
 
diff --git a/include/stdio.h b/include/stdio.h
index 517d53837f..758659f8e0 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -7,7 +7,7 @@
    headers.   glibc builds some C++ tests which use these headers which do
    not get marked as system headers.  */
 # include <bits/floatn.h>
-# if defined __cplusplus && __LONG_DOUBLE_USES_FLOAT128 == 1
+# if defined __cplusplus && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 #  pragma GCC system_header
 # endif
 
@@ -22,10 +22,10 @@
 /*  Some libc_hidden_ldbl_proto's do not map to a unique symbol when
     redirecting ldouble to _Float128 variants.  We can therefore safely
     directly alias them to their internal name.  */
-# if __LONG_DOUBLE_USES_FLOAT128 == 1 && IS_IN (libc)
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && IS_IN (libc)
 #  define stdio_hidden_ldbl_proto(p, f) \
   extern __typeof (p ## f) p ## f __asm (__ASMNAME ("___ieee128_" #f));
-# elif __LONG_DOUBLE_USES_FLOAT128 == 1
+# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 #  define stdio_hidden_ldbl_proto(p,f) __LDBL_REDIR1_DECL (p ## f, p ## f ## ieee128)
 # else
 #  define stdio_hidden_ldbl_proto(p,f) libc_hidden_proto (p ## f)
@@ -101,7 +101,7 @@ libc_hidden_proto (__isoc99_vfscanf)
 #   define sscanf __isoc99_sscanf
 #  endif
 
-#  if __LONG_DOUBLE_USES_FLOAT128 == 1  && IS_IN (libc)
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1  && IS_IN (libc)
 /* These are implemented as redirects to other public API.
    Therefore, the usual redirection fails to avoid PLT.  */
 extern __typeof (__isoc99_sscanf) ___ieee128_isoc99_sscanf __THROW;
diff --git a/include/stdlib.h b/include/stdlib.h
index 7929e45386..92b7067d8b 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -8,7 +8,7 @@
    headers.   glibc builds some C++ tests which use these headers which do
    not get marked as system headers.  */
 #include <bits/floatn.h>
-#if defined __cplusplus && __LONG_DOUBLE_USES_FLOAT128 == 1
+#if defined __cplusplus && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 # pragma GCC system_header
 #endif
 
@@ -216,7 +216,7 @@ libc_hidden_proto (____strtoull_l_internal)
 #include <bits/floatn.h>
 libc_hidden_proto (strtof)
 libc_hidden_proto (strtod)
-#if __LONG_DOUBLE_USES_FLOAT128 == 0
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
 libc_hidden_proto (strtold)
 #endif
 libc_hidden_proto (strtol)
diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h
index 9f44ac5a0a..6a76160ed4 100644
--- a/include/sys/cdefs.h
+++ b/include/sys/cdefs.h
@@ -16,7 +16,7 @@ rtld_hidden_proto (__chk_fail)
 /* If we are using redirects internally to support long double,
    we need to tweak some macros to ensure the PLT bypass tricks
    continue to work in libc. */
-#if __LONG_DOUBLE_USES_FLOAT128 == 1 && IS_IN (libc) && defined SHARED
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && IS_IN (libc) && defined SHARED
 
 # undef __LDBL_REDIR_DECL
 # define __LDBL_REDIR_DECL(func) \
diff --git a/include/wchar.h b/include/wchar.h
index 64355dd6fb..bd59d3c109 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -4,7 +4,7 @@
    headers.   glibc builds some C++ tests which use these headers which do
    not get marked as system headers.  */
 # include <bits/floatn.h>
-# if defined __cplusplus && __LONG_DOUBLE_USES_FLOAT128 == 1
+# if defined __cplusplus && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 #  pragma GCC system_header
 # endif
 
diff --git a/libio/bits/stdio-ldbl.h b/libio/bits/stdio-ldbl.h
index 3bb9f7dd2c..28c44666e3 100644
--- a/libio/bits/stdio-ldbl.h
+++ b/libio/bits/stdio-ldbl.h
@@ -31,7 +31,7 @@ __LDBL_REDIR_DECL (vsprintf)
 __LDBL_REDIR1_DECL (fscanf, __nldbl___isoc99_fscanf)
 __LDBL_REDIR1_DECL (scanf, __nldbl___isoc99_scanf)
 __LDBL_REDIR1_DECL (sscanf, __nldbl___isoc99_sscanf)
-# elif __LONG_DOUBLE_USES_FLOAT128 == 1
+# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 __LDBL_REDIR1_DECL (fscanf, __isoc99_fscanfieee128)
 __LDBL_REDIR1_DECL (scanf, __isoc99_scanfieee128)
 __LDBL_REDIR1_DECL (sscanf, __isoc99_sscanfieee128)
@@ -55,7 +55,7 @@ __LDBL_REDIR_DECL (vsnprintf)
 __LDBL_REDIR1_DECL (vfscanf, __nldbl___isoc99_vfscanf)
 __LDBL_REDIR1_DECL (vscanf, __nldbl___isoc99_vscanf)
 __LDBL_REDIR1_DECL (vsscanf, __nldbl___isoc99_vsscanf)
-#  elif __LONG_DOUBLE_USES_FLOAT128 == 1
+#  elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 __LDBL_REDIR1_DECL (vfscanf, __isoc99_vfscanfieee128)
 __LDBL_REDIR1_DECL (vscanf, __isoc99_vscanfieee128)
 __LDBL_REDIR1_DECL (vsscanf, __isoc99_vsscanfieee128)
diff --git a/libio/stdio.h b/libio/stdio.h
index 18e29752c4..21ef36ae70 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -401,11 +401,11 @@ extern int sscanf (const char *__restrict __s,
 
 /* For historical reasons, the C99-compliant versions of the scanf
    functions are at alternative names.  When __LDBL_COMPAT or
-   __LONG_DOUBLE_USES_FLOAT128 are in effect, this is handled in
+   __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI are in effect, this is handled in
    bits/stdio-ldbl.h.  */
 #include <bits/floatn.h>
 #if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \
-    && __LONG_DOUBLE_USES_FLOAT128 == 0
+    && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
 # ifdef __REDIRECT
 extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
 				const char *__restrict __format, ...),
@@ -451,7 +451,7 @@ extern int vsscanf (const char *__restrict __s,
 /* Same redirection as above for the v*scanf family.  */
 # if !__GLIBC_USE (DEPRECATED_SCANF)
 #  if defined __REDIRECT && !defined __LDBL_COMPAT \
-      && __LONG_DOUBLE_USES_FLOAT128 == 0
+      && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
 extern int __REDIRECT (vfscanf,
 		       (FILE *__restrict __s,
 			const char *__restrict __format, __gnuc_va_list __arg),
@@ -872,7 +872,7 @@ extern int __overflow (FILE *, int);
 #endif
 
 #include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LONG_DOUBLE_USES_FLOAT128 == 1
+#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 # include <bits/stdio-ldbl.h>
 #endif
 
diff --git a/math/complex.h b/math/complex.h
index b6d175e800..7c06add10c 100644
--- a/math/complex.h
+++ b/math/complex.h
@@ -126,7 +126,7 @@ __BEGIN_DECLS
 #  undef __MATHDECL_1
 #  define __MATHDECL_1(type, function, args) \
   extern type __REDIRECT_NTH(__MATH_PRECNAME(function), args, function)
-# elif __LONG_DOUBLE_USES_FLOAT128 == 1
+# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 #  undef __MATHDECL_1
 #  undef __MATHDECL
 #  define __REDIR_TO(function) \
@@ -142,7 +142,7 @@ __BEGIN_DECLS
 # define __MATH_PRECNAME(name)	name##l
 # include <bits/cmathcalls.h>
 # if defined __LDBL_COMPAT \
-     || __LONG_DOUBLE_USES_FLOAT128 == 1
+     || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 #  undef __REDIR_TO
 #  undef __MATHDECL_1
 #  undef __MATHDECL
diff --git a/math/math.h b/math/math.h
index 5c3dcb9194..baa2e5e11b 100644
--- a/math/math.h
+++ b/math/math.h
@@ -343,7 +343,7 @@ extern long double __REDIRECT_NTH (nexttowardl,
 #   define __MATHDECL_1(type, function,suffix, args) \
   __MATHREDIR(type, function, suffix, args, __CONCAT(function,suffix))
 
-#  elif __LONG_DOUBLE_USES_FLOAT128 == 1
+#  elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 #   ifdef __REDIRECT_NTH
 #    ifdef __USE_ISOC99
 extern float __REDIRECT_NTH (nexttowardf, (float __x, long double __y),
@@ -390,7 +390,7 @@ extern double __REDIRECT_NTH (nexttoward, (double __x, long double __y),
 #  undef __MATH_DECLARING_FLOATN
 
 #  if defined __LDBL_COMPAT \
-      || __LONG_DOUBLE_USES_FLOAT128 == 1
+      || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 #   undef __REDIRTO
 #   undef __REDIRTO_ALT
 #   undef __MATHDECL_1
@@ -562,7 +562,7 @@ extern double __REDIRECT_NTH (nexttoward, (double __x, long double __y),
 #  undef __MATHCALL_NARROW
 #  define __MATHCALL_NARROW(func, redir, nargs) \
   __MATHCALL_NARROW_REDIR (func, redir, nargs)
-# elif __LONG_DOUBLE_USES_FLOAT128 == 1
+# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 #  define __MATHCALL_REDIR_NAME(name) __ ## f32 ## name ## ieee128
 #  undef __MATHCALL_NARROW
 #  define __MATHCALL_NARROW(func, redir, nargs) \
@@ -573,7 +573,7 @@ extern double __REDIRECT_NTH (nexttoward, (double __x, long double __y),
 # undef _Marg_
 # undef __MATHCALL_NAME
 # if defined __LDBL_COMPAT \
-     || __LONG_DOUBLE_USES_FLOAT128 == 1
+     || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 #  undef __MATHCALL_REDIR_NAME
 #  undef __MATHCALL_NARROW
 #  define __MATHCALL_NARROW(func, redir, nargs) \
@@ -588,7 +588,7 @@ extern double __REDIRECT_NTH (nexttoward, (double __x, long double __y),
 #  undef __MATHCALL_NARROW
 #  define __MATHCALL_NARROW(func, redir, nargs) \
   __MATHCALL_NARROW_REDIR (func, redir, nargs)
-# elif __LONG_DOUBLE_USES_FLOAT128 == 1
+# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 #  define __MATHCALL_REDIR_NAME(name) __ ## f64 ## name ## ieee128
 #  undef __MATHCALL_NARROW
 #  define __MATHCALL_NARROW(func, redir, nargs) \
@@ -599,7 +599,7 @@ extern double __REDIRECT_NTH (nexttoward, (double __x, long double __y),
 # undef _Marg_
 # undef __MATHCALL_NAME
 # if defined __LDBL_COMPAT \
-     || __LONG_DOUBLE_USES_FLOAT128 == 1
+     || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 #  undef __MATHCALL_REDIR_NAME
 #  undef __MATHCALL_NARROW
 #  define __MATHCALL_NARROW(func, redir, nargs) \
diff --git a/math/test-ldouble.h b/math/test-ldouble.h
index b9ef6f41f9..3d62c92e14 100644
--- a/math/test-ldouble.h
+++ b/math/test-ldouble.h
@@ -29,7 +29,7 @@
 /* On architectures which redirect long double to _Float128 ABI, we must
    choose the float128 ulps.  Similarly, on such architectures, the ABI
    used may be dependent on how the compiler was invoked.  */
-#elif __LONG_DOUBLE_USES_FLOAT128 == 1
+#elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 # define TYPE_STR "float128"
 # define ULP_IDX ULP_FLT128
 #else
diff --git a/misc/err.h b/misc/err.h
index d146a55054..e56cd73c0e 100644
--- a/misc/err.h
+++ b/misc/err.h
@@ -53,7 +53,7 @@ extern void verrx (int __status, const char *, __gnuc_va_list)
      __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));
 
 #include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LONG_DOUBLE_USES_FLOAT128 == 1
+#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 # include <bits/err-ldbl.h>
 #endif
 
diff --git a/misc/error.h b/misc/error.h
index bb8a3b26a4..41d54c568f 100644
--- a/misc/error.h
+++ b/misc/error.h
@@ -48,7 +48,7 @@ extern unsigned int error_message_count;
 extern int error_one_per_line;
 
 #include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LONG_DOUBLE_USES_FLOAT128 == 1
+#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 # include <bits/error-ldbl.h>
 #else
 /* Do not inline error and error_at_line when long double has the same
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index dd5f69f833..9fa371ab86 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -452,7 +452,7 @@
 #include <bits/wordsize.h>
 #include <bits/long-double.h>
 
-#if __LONG_DOUBLE_USES_FLOAT128 == 1
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 # ifdef __REDIRECT
 
 /* Alias name defined automatically.  */
@@ -503,7 +503,7 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf
   __LDBL_REDIR1_NTH (name, proto, __nldbl_##alias)
 # endif
 #endif
-#if (!defined __LDBL_COMPAT && __LONG_DOUBLE_USES_FLOAT128 == 0) \
+#if (!defined __LDBL_COMPAT && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0) \
     || !defined __REDIRECT
 # define __LDBL_REDIR1(name, proto, alias) name proto
 # define __LDBL_REDIR(name, proto) name proto
diff --git a/misc/sys/syslog.h b/misc/sys/syslog.h
index c000b8e915..dc3b0e7ef8 100644
--- a/misc/sys/syslog.h
+++ b/misc/sys/syslog.h
@@ -208,7 +208,7 @@ extern void vsyslog (int __pri, const char *__fmt, __gnuc_va_list __ap)
 #endif
 
 #include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LONG_DOUBLE_USES_FLOAT128 == 1
+#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 # include <bits/syslog-ldbl.h>
 #endif
 
diff --git a/stdio-common/printf.h b/stdio-common/printf.h
index 00bedebfdb..7dccfcd6fb 100644
--- a/stdio-common/printf.h
+++ b/stdio-common/printf.h
@@ -183,7 +183,7 @@ extern int printf_size_info (const struct printf_info *__restrict
      __THROW;
 
 #include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LONG_DOUBLE_USES_FLOAT128 == 1
+#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 # include <bits/printf-ldbl.h>
 #endif
 
diff --git a/stdio-common/tst-vfprintf-user-type.c b/stdio-common/tst-vfprintf-user-type.c
index 40d714fdb1..0abd61cea3 100644
--- a/stdio-common/tst-vfprintf-user-type.c
+++ b/stdio-common/tst-vfprintf-user-type.c
@@ -147,7 +147,7 @@ do_test (void)
 
   /* Alias declaration for asprintf, to avoid the format string
      attribute and the associated warning.  */
-#if __LONG_DOUBLE_USES_FLOAT128 == 1
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
   extern int asprintf_alias (char **, const char *, ...) __asm__ ("__asprintfieee128");
 #else
   extern int asprintf_alias (char **, const char *, ...) __asm__ ("asprintf");
diff --git a/stdlib/bits/stdlib-ldbl.h b/stdlib/bits/stdlib-ldbl.h
index 2469474532..cc8831dd16 100644
--- a/stdlib/bits/stdlib-ldbl.h
+++ b/stdlib/bits/stdlib-ldbl.h
@@ -51,7 +51,7 @@ __LDBL_REDIR1_DECL (qfcvt, fcvt)
 __LDBL_REDIR1_DECL (qgcvt, gcvt)
 __LDBL_REDIR1_DECL (qecvt_r, ecvt_r)
 __LDBL_REDIR1_DECL (qfcvt_r, fcvt_r)
-# elif __LONG_DOUBLE_USES_FLOAT128 == 1
+# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 __LDBL_REDIR1_DECL (qecvt, __qecvtieee128)
 __LDBL_REDIR1_DECL (qfcvt, __qfcvtieee128)
 __LDBL_REDIR1_DECL (qgcvt, __qgcvtieee128)
diff --git a/stdlib/monetary.h b/stdlib/monetary.h
index 4a6d61fd2d..c9d3c64e14 100644
--- a/stdlib/monetary.h
+++ b/stdlib/monetary.h
@@ -51,7 +51,7 @@ extern ssize_t strfmon_l (char *__restrict __s, size_t __maxsize,
 #endif
 
 #include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LONG_DOUBLE_USES_FLOAT128 == 1
+#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 # include <bits/monetary-ldbl.h>
 #endif
 
diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h
index a7c0c71a80..9b7537c545 100644
--- a/stdlib/stdlib.h
+++ b/stdlib/stdlib.h
@@ -1018,7 +1018,7 @@ extern int ttyslot (void) __THROW;
 #endif
 
 #include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LONG_DOUBLE_USES_FLOAT128 == 1
+#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 # include <bits/stdlib-ldbl.h>
 #endif
 
diff --git a/sysdeps/ieee754/ldbl-128/bits/long-double.h b/sysdeps/ieee754/ldbl-128/bits/long-double.h
index 941e60505f..dd64a06db6 100644
--- a/sysdeps/ieee754/ldbl-128/bits/long-double.h
+++ b/sysdeps/ieee754/ldbl-128/bits/long-double.h
@@ -18,4 +18,4 @@
 
 /* long double is distinct from double, so there is nothing to
    define here.  */
-#define __LONG_DOUBLE_USES_FLOAT128 0
+#define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 0
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/bits/long-double.h b/sysdeps/ieee754/ldbl-128ibm-compat/bits/long-double.h
index 91dddbdc8b..ef834c7748 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/bits/long-double.h
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/bits/long-double.h
@@ -22,8 +22,5 @@
 #  define __NO_LONG_DOUBLE_MATH		1
 # endif
 #endif
-/* On platforms that reuse the _Float128 implementation for IEEE long
-   double, access to the correct long double functions is selected based
-   on the long double mode being used during the compilation.  On
-   powerpc64le, this is true when -mabi=ieeelongdouble is in use.  */
-#define __LONG_DOUBLE_USES_FLOAT128 (__LDBL_MANT_DIG__ == 113)
+
+#define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI (__LDBL_MANT_DIG__ == 113)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/math_ldbl.h b/sysdeps/ieee754/ldbl-128ibm-compat/math_ldbl.h
index 352617e178..5490b400dd 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/math_ldbl.h
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/math_ldbl.h
@@ -23,7 +23,7 @@
 
 /* Trampoline in the ldbl-128ibm headers if building against the
    old abi.  Otherwise, we have nothing to add. */
-#if __LONG_DOUBLE_USES_FLOAT128 == 0
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
 #include_next <math_ldbl.h>
 #endif
 
diff --git a/sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h b/sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h
index b2021b5d64..e60b3017eb 100644
--- a/sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h
+++ b/sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h
@@ -20,7 +20,7 @@
 # error "Never use <bits/iscanonical.h> directly; include <math.h> instead."
 #endif
 
-#if defined (__NO_LONG_DOUBLE_MATH) || __LONG_DOUBLE_USES_FLOAT128 == 1
+#if defined (__NO_LONG_DOUBLE_MATH) || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 # define iscanonical(x) ((void) (__typeof (x)) (x), 1)
 #else
 extern int __iscanonicall (long double __x)
diff --git a/sysdeps/ieee754/ldbl-128ibm/ieee754.h b/sysdeps/ieee754/ldbl-128ibm/ieee754.h
index fe4892d84f..b66e3b9869 100644
--- a/sysdeps/ieee754/ldbl-128ibm/ieee754.h
+++ b/sysdeps/ieee754/ldbl-128ibm/ieee754.h
@@ -112,7 +112,7 @@ union ieee754_double
 #define IEEE754_DOUBLE_BIAS	0x3ff /* Added to exponent.  */
 
 
-#if __LONG_DOUBLE_USES_FLOAT128 == 1
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 /* long double is IEEE 128 bit */
 union ieee854_long_double
   {
@@ -170,7 +170,7 @@ union ieee854_long_double
 #endif
 
 
-#if __LONG_DOUBLE_USES_FLOAT128 == 0 || __GNUC_PREREQ (7, 0)
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0 || __GNUC_PREREQ (7, 0)
 /* IBM extended format for long double.
 
    Each long double is made up of two IEEE doubles.  The value of the
@@ -183,7 +183,7 @@ union ieee854_long_double
    NaN is don't-care.  */
 union ibm_extended_long_double
   {
-# if __LONG_DOUBLE_USES_FLOAT128 == 1 && __GNUC_PREREQ (7, 0)
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && __GNUC_PREREQ (7, 0)
    __ibm128 ld;
 # else
    long double ld;
diff --git a/sysdeps/ieee754/ldbl-128ibm/include/bits/iscanonical.h b/sysdeps/ieee754/ldbl-128ibm/include/bits/iscanonical.h
index 8cbd6f74bf..60d5417089 100644
--- a/sysdeps/ieee754/ldbl-128ibm/include/bits/iscanonical.h
+++ b/sysdeps/ieee754/ldbl-128ibm/include/bits/iscanonical.h
@@ -1,5 +1,5 @@
 #include_next <bits/iscanonical.h>
 
-#if !defined _ISOMAC && (__LONG_DOUBLE_USES_FLOAT128 == 0)
+#if !defined _ISOMAC && (__LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0)
 libm_hidden_proto (__iscanonicall)
 #endif
diff --git a/sysdeps/ieee754/ldbl-96/bits/long-double.h b/sysdeps/ieee754/ldbl-96/bits/long-double.h
index b77124f842..9a2cd0dfe4 100644
--- a/sysdeps/ieee754/ldbl-96/bits/long-double.h
+++ b/sysdeps/ieee754/ldbl-96/bits/long-double.h
@@ -18,4 +18,4 @@
 
 /* long double is distinct from double, so there is nothing to
    define here.  */
-#define __LONG_DOUBLE_USES_FLOAT128 0
+#define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 0
diff --git a/sysdeps/ieee754/ldbl-opt/bits/long-double.h b/sysdeps/ieee754/ldbl-opt/bits/long-double.h
index 242e58410d..48688ad7e1 100644
--- a/sysdeps/ieee754/ldbl-opt/bits/long-double.h
+++ b/sysdeps/ieee754/ldbl-opt/bits/long-double.h
@@ -22,4 +22,4 @@
 #  define __NO_LONG_DOUBLE_MATH		1
 # endif
 #endif
-#define __LONG_DOUBLE_USES_FLOAT128 0
+#define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 0
diff --git a/sysdeps/mips/ieee754/bits/long-double.h b/sysdeps/mips/ieee754/bits/long-double.h
index 57007a84d6..1ad74e4497 100644
--- a/sysdeps/mips/ieee754/bits/long-double.h
+++ b/sysdeps/mips/ieee754/bits/long-double.h
@@ -21,4 +21,4 @@
 #if !defined __NO_LONG_DOUBLE_MATH && _MIPS_SIM == _ABIO32
 # define __NO_LONG_DOUBLE_MATH	1
 #endif
-#define __LONG_DOUBLE_USES_FLOAT128 0
+#define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 0
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/bits/long-double.h b/sysdeps/unix/sysv/linux/sparc/sparc32/bits/long-double.h
index 7046cd40d7..107c5d179b 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/bits/long-double.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/bits/long-double.h
@@ -24,4 +24,4 @@
 #  define __NO_LONG_DOUBLE_MATH        1
 # endif
 #endif
-#define __LONG_DOUBLE_USES_FLOAT128 0
+#define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 0
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/long-double.h b/sysdeps/unix/sysv/linux/sparc/sparc64/bits/long-double.h
index 7046cd40d7..107c5d179b 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/long-double.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/bits/long-double.h
@@ -24,4 +24,4 @@
 #  define __NO_LONG_DOUBLE_MATH        1
 # endif
 #endif
-#define __LONG_DOUBLE_USES_FLOAT128 0
+#define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 0
diff --git a/wcsmbs/bits/wchar-ldbl.h b/wcsmbs/bits/wchar-ldbl.h
index 75d547f680..1b063d1235 100644
--- a/wcsmbs/bits/wchar-ldbl.h
+++ b/wcsmbs/bits/wchar-ldbl.h
@@ -32,7 +32,7 @@ __LDBL_REDIR_DECL (vswprintf);
 __LDBL_REDIR1_DECL (fwscanf, __nldbl___isoc99_fwscanf)
 __LDBL_REDIR1_DECL (wscanf, __nldbl___isoc99_wscanf)
 __LDBL_REDIR1_DECL (swscanf, __nldbl___isoc99_swscanf)
-#  elif __LONG_DOUBLE_USES_FLOAT128 == 1
+#  elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 __LDBL_REDIR1_DECL (fwscanf, __isoc99_fwscanfieee128)
 __LDBL_REDIR1_DECL (wscanf, __isoc99_wscanfieee128)
 __LDBL_REDIR1_DECL (swscanf, __isoc99_swscanfieee128)
@@ -57,7 +57,7 @@ __LDBL_REDIR1_DECL (wcstold, __wcstoieee128)
 __LDBL_REDIR1_DECL (vfwscanf, __nldbl___isoc99_vfwscanf)
 __LDBL_REDIR1_DECL (vwscanf, __nldbl___isoc99_vwscanf)
 __LDBL_REDIR1_DECL (vswscanf, __nldbl___isoc99_vswscanf)
-#  elif __LONG_DOUBLE_USES_FLOAT128 == 1
+#  elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 __LDBL_REDIR1_DECL (vfwscanf, __isoc99_vfwscanfieee128)
 __LDBL_REDIR1_DECL (vwscanf, __isoc99_vwscanfieee128)
 __LDBL_REDIR1_DECL (vswscanf, __isoc99_vswscanfieee128)
diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h
index fb2cec8167..9cf8b05a87 100644
--- a/wcsmbs/wchar.h
+++ b/wcsmbs/wchar.h
@@ -634,10 +634,10 @@ extern int swscanf (const wchar_t *__restrict __s,
 
 /* For historical reasons, the C99-compliant versions of the scanf
    functions are at alternative names.  When __LDBL_COMPAT or
-   __LONG_DOUBLE_USES_FLOAT128 are in effect, this is handled in
+   __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI are in effect, this is handled in
    bits/wchar-ldbl.h.  */
 #if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \
-     && __LONG_DOUBLE_USES_FLOAT128 == 0
+     && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
 #  ifdef __REDIRECT
 extern int __REDIRECT (fwscanf, (__FILE *__restrict __stream,
 				 const wchar_t *__restrict __format, ...),
@@ -691,7 +691,7 @@ extern int vswscanf (const wchar_t *__restrict __s,
 # if !__GLIBC_USE (DEPRECATED_SCANF) \
      && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
      && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) \
-     && __LONG_DOUBLE_USES_FLOAT128 == 0
+     && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
 #  ifdef __REDIRECT
 extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
 				  const wchar_t *__restrict __format,
@@ -853,7 +853,7 @@ extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
 #endif
 
 #include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LONG_DOUBLE_USES_FLOAT128 == 1
+#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 # include <bits/wchar-ldbl.h>
 #endif
 
-- 
2.21.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v2 04/10] powerpc64le: Enforce -mabi=ibmlongdouble when -mfloat128 used
  2020-03-27 21:17 [PATCH v2 00/10] IEEE binary128 long double on powerpc64le Paul E. Murphy via Libc-alpha
                   ` (2 preceding siblings ...)
  2020-03-27 21:17 ` [PATCH v2 03/10] Rename __LONG_DOUBLE_USES_FLOAT128 to Paul E. Murphy via Libc-alpha
@ 2020-03-27 21:17 ` Paul E. Murphy via Libc-alpha
  2020-04-03 19:29   ` Tulio Magno Quites Machado Filho
  2020-03-27 21:17 ` [PATCH v2 05/10] powerpc64le: workaround ieee long double / _Float128 stdc++ bug Paul E. Murphy via Libc-alpha
                   ` (5 subsequent siblings)
  9 siblings, 1 reply; 27+ messages in thread
From: Paul E. Murphy via Libc-alpha @ 2020-03-27 21:17 UTC (permalink / raw
  To: libc-alpha

I have observed a bug on 7.4.0 whereby __mulkc3 calls are
swapped with __multc3 depending on ABI selection.  For the
sake of being overly cautious, build all _Float128 files
with ibm128 to workaround these compilers.  This has been
noted in GCC BZ 84914, and will not be fixed for GCC 7.

Likewise, non-math files built with _Float128 are assumed
to have ibm long double.  Explicilty preserve this
assumption.

Finally, add some bootstrapping code to avoid applying
these options until IEEE long double is enabled as they
require GCC 7 and above.
---
 sysdeps/powerpc/powerpc64/le/Makefile         | 88 +++++++++++--------
 .../powerpc64/le/fpu/multiarch/Makefile       |  4 +-
 2 files changed, 51 insertions(+), 41 deletions(-)

diff --git a/sysdeps/powerpc/powerpc64/le/Makefile b/sysdeps/powerpc/powerpc64/le/Makefile
index d79ad222fc..441a8a14e5 100644
--- a/sysdeps/powerpc/powerpc64/le/Makefile
+++ b/sysdeps/powerpc/powerpc64/le/Makefile
@@ -1,5 +1,6 @@
 # When building float128 we need to ensure -mfloat128 is
 # passed to all such object files.
+type-float128-CFLAGS := -mfloat128
 
 # Bootstrapping code for enabling IEEE 128.  This can be removed and
 # any indirections simplified once IEEE 128 long double is enabled.
@@ -11,28 +12,33 @@ type-ldouble-CFLAGS += $(ibm128-abi-CFLAGS)
 no-gnu-attribute-CFLAGS = -mno-gnu-attribute
 endif
 
+# All _Float128 files should be built assuming an ibm128 long double.
+# Likewise, this avoids some old GCC 7 compiler bugs whereby calls
+# to __mulkc3 are swapped with __multc3, or worse.  This is noted in
+# GCC BZ 84914, and marked as will-not-fix.
+type-float128-CFLAGS += $(type-ldouble-CFLAGS)
+
 ifeq ($(subdir),math)
 # sqrtf128 requires emulation before POWER9.
 CPPFLAGS += -I../soft-fp
 
 # float128 requires adding a handful of extra flags.
 # Similarly, disable
-$(foreach suf,$(all-object-suffixes),%f128$(suf)): CFLAGS += -mfloat128 $(no-gnu-attribute-CFLAGS)
-$(foreach suf,$(all-object-suffixes),%f128_r$(suf)): CFLAGS += -mfloat128 $(no-gnu-attribute-CFLAGS)
-$(foreach suf,$(all-object-suffixes),$(objpfx)test-float128%$(suf)): CFLAGS += -mfloat128
-$(foreach suf,$(all-object-suffixes),$(objpfx)test-float64x%$(suf)): CFLAGS += -mfloat128
+$(foreach suf,$(all-object-suffixes),%f128$(suf)): CFLAGS += $(type-float128-CFLAGS) $(no-gnu-attribute-CFLAGS)
+$(foreach suf,$(all-object-suffixes),%f128_r$(suf)): CFLAGS += $(type-float128-CFLAGS) $(no-gnu-attribute-CFLAGS)
+$(foreach suf,$(all-object-suffixes),$(objpfx)test-float128%$(suf)): CFLAGS += $(type-float128-CFLAGS)
+$(foreach suf,$(all-object-suffixes),$(objpfx)test-float64x%$(suf)): CFLAGS += $(type-float128-CFLAGS)
 # Pairs of types with _Float128 / _Float64x as the wider type but not
 # the narrower one.
 f128-pairs = float32-float64x float32-float128 float64-float64x \
 	     float64-float128 float32x-float64x float32x-float128
-$(foreach suf,$(all-object-suffixes),$(foreach pair,$(f128-pairs),$(objpfx)test-$(pair)%$(suf))): CFLAGS += -mfloat128
-
-CFLAGS-libm-test-support-float128.c += -mfloat128
-CFLAGS-libm-test-support-float64x.c += -mfloat128
-CFLAGS-test-math-iscanonical.cc += -mfloat128
-CFLAGS-test-math-iseqsig.cc += -mfloat128
-CFLAGS-test-math-issignaling.cc += -mfloat128
-CFLAGS-test-math-iszero.cc += -mfloat128
+$(foreach suf,$(all-object-suffixes),$(foreach pair,$(f128-pairs),$(objpfx)test-$(pair)%$(suf))): CFLAGS += $(type-float128-CFLAGS)
+CFLAGS-libm-test-support-float128.c += $(type-float128-CFLAGS)
+CFLAGS-libm-test-support-float64x.c += $(type-float128-CFLAGS)
+CFLAGS-test-math-iscanonical.cc += $(type-float128-CFLAGS)
+CFLAGS-test-math-iseqsig.cc += $(type-float128-CFLAGS)
+CFLAGS-test-math-issignaling.cc += $(type-float128-CFLAGS)
+CFLAGS-test-math-iszero.cc += $(type-float128-CFLAGS)
 
 CFLAGS-s_logbl-power7.c += $(type-ldouble-CFLAGS)
 CFLAGS-s_logbl-ppc64.c += $(type-ldouble-CFLAGS)
@@ -71,45 +77,49 @@ $(foreach suf,$(all-object-suffixes),\
          ): sysdep-CFLAGS := $(filter-out -mabi=ieeelongdouble,$(sysdep-CFLAGS))
 endif
 
+
 # Append flags to string <-> _Float128 routines.
 ifneq ($(filter $(subdir),wcsmbs stdlib),)
-$(foreach suf,$(all-object-suffixes),%f128$(suf)): CFLAGS += -mfloat128 $(no-gnu-attribute-CFLAGS)
-$(foreach suf,$(all-object-suffixes),%f128_l$(suf)): CFLAGS += -mfloat128 $(no-gnu-attribute-CFLAGS)
-$(foreach suf,$(all-object-suffixes),%f128_nan$(suf)): CFLAGS += -mfloat128 $(no-gnu-attribute-CFLAGS)
-$(foreach suf,$(all-object-suffixes),%float1282mpn$(suf)): CFLAGS += -mfloat128 $(no-gnu-attribute-CFLAGS)
-$(foreach suf,$(all-object-suffixes),%mpn2float128$(suf)): CFLAGS += -mfloat128 $(no-gnu-attribute-CFLAGS)
-CFLAGS-bug-strtod.c += -mfloat128
-CFLAGS-bug-strtod2.c += -mfloat128
-CFLAGS-tst-strtod-round.c += -mfloat128
-CFLAGS-tst-wcstod-round.c += -mfloat128
-CFLAGS-tst-strtod-nan-locale.c += -mfloat128
-CFLAGS-tst-wcstod-nan-locale.c += -mfloat128
-CFLAGS-tst-strtod6.c += -mfloat128
-CFLAGS-tst-strfrom.c += -mfloat128
-CFLAGS-tst-strfrom-locale.c += -mfloat128
-CFLAGS-strfrom-skeleton.c += -mfloat128
-CFLAGS-tst-strtod-nan-sign.c += -mfloat128
-CFLAGS-tst-wcstod-nan-sign.c += -mfloat128
+$(foreach suf,$(all-object-suffixes),%f128$(suf)): CFLAGS += $(type-float128-CFLAGS) $(no-gnu-attribute-CFLAGS)
+$(foreach suf,$(all-object-suffixes),%f128_l$(suf)): CFLAGS += $(type-float128-CFLAGS) $(no-gnu-attribute-CFLAGS)
+$(foreach suf,$(all-object-suffixes),%f128_nan$(suf)): CFLAGS += $(type-float128-CFLAGS) $(no-gnu-attribute-CFLAGS)
+$(foreach suf,$(all-object-suffixes),%float1282mpn$(suf)): CFLAGS += $(type-float128-CFLAGS) $(no-gnu-attribute-CFLAGS)
+$(foreach suf,$(all-object-suffixes),%mpn2float128$(suf)): CFLAGS += $(type-float128-CFLAGS) $(no-gnu-attribute-CFLAGS)
+CFLAGS-bug-strtod.c += $(type-float128-CFLAGS)
+CFLAGS-bug-strtod2.c += $(type-float128-CFLAGS)
+CFLAGS-tst-strtod-round.c += $(type-float128-CFLAGS)
+CFLAGS-tst-wcstod-round.c += $(type-float128-CFLAGS)
+CFLAGS-tst-strtod-nan-locale.c += $(type-float128-CFLAGS)
+CFLAGS-tst-wcstod-nan-locale.c += $(type-float128-CFLAGS)
+CFLAGS-tst-strtod6.c += $(type-float128-CFLAGS)
+CFLAGS-tst-strfrom.c += $(type-float128-CFLAGS)
+CFLAGS-tst-strfrom-locale.c += $(type-float128-CFLAGS)
+CFLAGS-strfrom-skeleton.c += $(type-float128-CFLAGS)
+CFLAGS-tst-strtod-nan-sign.c += $(type-float128-CFLAGS)
+CFLAGS-tst-wcstod-nan-sign.c += $(type-float128-CFLAGS)
 
 # When building glibc with support for _Float128, the powers of ten tables in
 # fpioconst.c and in the string conversion functions must be extended.  Some
 # Makefiles (e.g.: wcsmbs/Makefile) override CFLAGS defined by the Makefiles in
 # sysdeps.  This is avoided with the use sysdep-CFLAGS instead of CFLAGS.
 sysdep-CFLAGS += $(sysdep-CFLAGS-$(<F))
-sysdep-CFLAGS-fpioconst.c += -mfloat128
-sysdep-CFLAGS-strtod_l.c += -mfloat128
-sysdep-CFLAGS-strtof_l.c += -mfloat128
-sysdep-CFLAGS-strtold_l.c += -mfloat128
-sysdep-CFLAGS-wcstod_l.c += -mfloat128
-sysdep-CFLAGS-wcstof_l.c += -mfloat128
-sysdep-CFLAGS-wcstold_l.c += -mfloat128
+sysdep-CFLAGS-fpioconst.c += $(type-float128-CFLAGS)
+sysdep-CFLAGS-strtod_l.c += $(type-float128-CFLAGS)
+sysdep-CFLAGS-strtof_l.c += $(type-float128-CFLAGS)
+sysdep-CFLAGS-strtold_l.c += $(type-float128-CFLAGS)
+sysdep-CFLAGS-wcstod_l.c += $(type-float128-CFLAGS)
+sysdep-CFLAGS-wcstof_l.c += $(type-float128-CFLAGS)
+sysdep-CFLAGS-wcstold_l.c += $(type-float128-CFLAGS)
+
+# Build any ibm128 specific stdlib tests with ibm128 ABI.
+$(foreach suf,$(all-object-suffixes),%128ibm$(suf)): CFLAGS += $(type-ldouble-CFLAGS)
 endif
 
 # Append flags to printf routines.
 ifeq ($(subdir),stdio-common)
-CFLAGS-printf_fp.c = -mfloat128
-CFLAGS-printf_fphex.c = -mfloat128
-CFLAGS-printf_size.c = -mfloat128
+CFLAGS-printf_fp.c = $(type-float128-CFLAGS)
+CFLAGS-printf_fphex.c = $(type-float128-CFLAGS)
+CFLAGS-printf_size.c = $(type-float128-CFLAGS)
 endif
 
 # Disable linker noise on files using ieee128 long double internally
diff --git a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/Makefile
index c6ca872a4b..24dd679ea4 100644
--- a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/Makefile
@@ -1,6 +1,6 @@
 ifeq ($(subdir),math)
 libm-sysdep_routines += w_sqrtf128-power9 w_sqrtf128-ppc64le
 
-CFLAGS-w_sqrtf128-ppc64le.c += -mfloat128 $(no-gnu-attribute-CFLAGS)
-CFLAGS-w_sqrtf128-power9.c += -mfloat128 -mcpu=power9 $(no-gnu-attribute-CFLAGS)
+CFLAGS-w_sqrtf128-ppc64le.c += $(type-float128-CFLAGS) $(no-gnu-attribute-CFLAGS)
+CFLAGS-w_sqrtf128-power9.c += $(type-float128-CFLAGS) -mcpu=power9 $(no-gnu-attribute-CFLAGS)
 endif
-- 
2.21.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v2 05/10] powerpc64le: workaround ieee long double / _Float128 stdc++ bug
  2020-03-27 21:17 [PATCH v2 00/10] IEEE binary128 long double on powerpc64le Paul E. Murphy via Libc-alpha
                   ` (3 preceding siblings ...)
  2020-03-27 21:17 ` [PATCH v2 04/10] powerpc64le: Enforce -mabi=ibmlongdouble when -mfloat128 used Paul E. Murphy via Libc-alpha
@ 2020-03-27 21:17 ` Paul E. Murphy via Libc-alpha
  2020-04-03 19:03   ` Tulio Magno Quites Machado Filho
  2020-03-27 21:17 ` [PATCH v2 06/10] powerpc64le: raise GCC requirement to 7.3 for long double transition Paul E. Murphy via Libc-alpha
                   ` (4 subsequent siblings)
  9 siblings, 1 reply; 27+ messages in thread
From: Paul E. Murphy via Libc-alpha @ 2020-03-27 21:17 UTC (permalink / raw
  To: libc-alpha

-mabi=ieeelongdouble triggers the stdc++ libraries _Float128
support, which then breaks if algorithm is included.  For now,
explicitly disable _Float128 for such tests.

I have opened up GCC BZ 94080 to track this.
---
 sysdeps/powerpc/powerpc64/le/Makefile | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/sysdeps/powerpc/powerpc64/le/Makefile b/sysdeps/powerpc/powerpc64/le/Makefile
index 441a8a14e5..9ba7f850ad 100644
--- a/sysdeps/powerpc/powerpc64/le/Makefile
+++ b/sysdeps/powerpc/powerpc64/le/Makefile
@@ -140,3 +140,14 @@ $(foreach suf,$(all-object-suffixes), $(ldbl-ibm128-files)) \
 	  $(foreach r,$(ldbl-128ibm-routines) $(ldbl-tests), \
 		    $(objpfx)$(r)$(suf)): \
   sysdep-CFLAGS := $(filter-out -mabi=ieeelongdouble,$(sysdep-CFLAGS))
+
+# TODO: a bug in stdc++ will fail if -mabi=ieeelongdouble and -mfloat128
+# are both enabled. The latter is enabled by default in GCC 8+.  This is
+# tracked via GCC BZ 94080.
+ifeq ($(subdir),support)
+CFLAGS-links-dso-program.cc += -mno-float128
+endif
+ifeq ($(subdir),nptl)
+CFLAGS-tst-thread_local1.cc += -mno-float128
+CFLAGS-tst-minstack-throw.cc += -mno-float128
+endif
-- 
2.21.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v2 06/10] powerpc64le: raise GCC requirement to 7.3 for long double transition
  2020-03-27 21:17 [PATCH v2 00/10] IEEE binary128 long double on powerpc64le Paul E. Murphy via Libc-alpha
                   ` (4 preceding siblings ...)
  2020-03-27 21:17 ` [PATCH v2 05/10] powerpc64le: workaround ieee long double / _Float128 stdc++ bug Paul E. Murphy via Libc-alpha
@ 2020-03-27 21:17 ` Paul E. Murphy via Libc-alpha
  2020-03-31 20:47   ` Paul E Murphy via Libc-alpha
  2020-03-27 21:17 ` [PATCH v2 07/10] powerpc64le: bump binutils version requirement to >= 2.26 Paul E. Murphy via Libc-alpha
                   ` (3 subsequent siblings)
  9 siblings, 1 reply; 27+ messages in thread
From: Paul E. Murphy via Libc-alpha @ 2020-03-27 21:17 UTC (permalink / raw
  To: libc-alpha

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


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v2 07/10] powerpc64le: bump binutils version requirement to >= 2.26
  2020-03-27 21:17 [PATCH v2 00/10] IEEE binary128 long double on powerpc64le Paul E. Murphy via Libc-alpha
                   ` (5 preceding siblings ...)
  2020-03-27 21:17 ` [PATCH v2 06/10] powerpc64le: raise GCC requirement to 7.3 for long double transition Paul E. Murphy via Libc-alpha
@ 2020-03-27 21:17 ` Paul E. Murphy via Libc-alpha
  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 via Libc-alpha
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 27+ messages in thread
From: Paul E. Murphy via Libc-alpha @ 2020-03-27 21:17 UTC (permalink / raw
  To: libc-alpha

This is a small step up from 2.25 which brings in support for
rewriting the .gnu.attributes section of libc/libm.so.
---
 INSTALL                                   |  4 ++
 NEWS                                      |  4 +-
 manual/install.texi                       |  4 ++
 sysdeps/powerpc/powerpc64/le/configure    | 65 +++++++++++++++++++++++
 sysdeps/powerpc/powerpc64/le/configure.ac |  6 +++
 5 files changed, 81 insertions(+), 2 deletions(-)

diff --git a/INSTALL b/INSTALL
index c97f8218d9..9b59b907b3 100644
--- a/INSTALL
+++ b/INSTALL
@@ -494,6 +494,10 @@ build the GNU C Library:
      moment.  As of release time, GNU 'binutils' 2.32 is the newest
      verified to work to build the GNU C Library.
 
+     For PowerPC 64-bits little-endian (powerpc64le), binutils is
+     required to support the '--update-section'.  This option requires
+     binutils 2.26 or newer.
+
    * GNU 'texinfo' 4.7 or later
 
      To correctly translate and install the Texinfo documentation you
diff --git a/NEWS b/NEWS
index b1cda0d43d..1c88c95d1c 100644
--- a/NEWS
+++ b/NEWS
@@ -17,8 +17,8 @@ Deprecated and removed features, and other changes affecting compatibility:
 
 Changes to build and runtime requirements:
 
-  * powerpc64le requires GCC 7.3 or newer.  This is required for supporting
-    long double redirects.
+  * powerpc64le requires GCC 7.3 or newer, and binutils 2.26 or newer.  This
+    is required for supporting long double redirects.
 
 Security related changes:
 
diff --git a/manual/install.texi b/manual/install.texi
index 3e32a08eaa..c2294fa99e 100644
--- a/manual/install.texi
+++ b/manual/install.texi
@@ -533,6 +533,10 @@ No other assembler or linker has the necessary functionality at the
 moment. As of release time, GNU @code{binutils} 2.32 is the newest
 verified to work to build @theglibc{}.
 
+For PowerPC 64-bits little-endian (powerpc64le), binutils is required
+to support the @option{--update-section}.  This option requires binutils
+2.26 or newer.
+
 @item
 GNU @code{texinfo} 4.7 or later
 
diff --git a/sysdeps/powerpc/powerpc64/le/configure b/sysdeps/powerpc/powerpc64/le/configure
index 9f5aba4eef..46f8bfd727 100644
--- a/sysdeps/powerpc/powerpc64/le/configure
+++ b/sysdeps/powerpc/powerpc64/le/configure
@@ -90,5 +90,70 @@ if test "$libc_cv_compiler_powerpc64le_ice" != "yes"; then :
   critic_missing="$critic_missing GCC >= 7.3 is required on powerpc64le."
 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
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OBJCOPY+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OBJCOPY"; then
+  ac_cv_prog_OBJCOPY="$OBJCOPY" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_OBJCOPY="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OBJCOPY=$ac_cv_prog_OBJCOPY
+if test -n "$OBJCOPY"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJCOPY" >&5
+$as_echo "$OBJCOPY" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$OBJCOPY" && break
+done
+
+if test -z "$OBJCOPY"; then
+  ac_verc_fail=yes
+else
+  # Found it, now check the version.
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking version of $OBJCOPY" >&5
+$as_echo_n "checking version of $OBJCOPY... " >&6; }
+  ac_prog_version=`$OBJCOPY --version 2>&1 | sed -n 's/^.*GNU objcopy.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
+  case $ac_prog_version in
+    '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+    2.1[0-9][0-9]*|2.2[6-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*)
+       ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
+    *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
+
+  esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_prog_version" >&5
+$as_echo "$ac_prog_version" >&6; }
+fi
+if test $ac_verc_fail = yes; then
+  AS=: critic_missing="$critic_missing objcopy >= 2.26 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 9da8412bbc..4fea85882a 100644
--- a/sysdeps/powerpc/powerpc64/le/configure.ac
+++ b/sysdeps/powerpc/powerpc64/le/configure.ac
@@ -51,5 +51,11 @@ CFLAGS="$save_CFLAGS"])
 AS_IF([test "$libc_cv_compiler_powerpc64le_ice" != "yes"],
       [critic_missing="$critic_missing GCC >= 7.3 is required on powerpc64le."])
 
+# 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,
+		  [GNU objcopy.* \([0-9]*\.[0-9.]*\)],
+		  [2.1[0-9][0-9]*|2.2[6-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*],
+		  AS=: critic_missing="$critic_missing objcopy >= 2.26 is required on powerpc64le")
 
 test -n "$critic_missing" && AC_MSG_ERROR([*** $critic_missing])
-- 
2.21.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v2 08/10] powerpc64le: enforce non-specific long double in .gnu.attributes section
  2020-03-27 21:17 [PATCH v2 00/10] IEEE binary128 long double on powerpc64le Paul E. Murphy via Libc-alpha
                   ` (6 preceding siblings ...)
  2020-03-27 21:17 ` [PATCH v2 07/10] powerpc64le: bump binutils version requirement to >= 2.26 Paul E. Murphy via Libc-alpha
@ 2020-03-27 21:17 ` Paul E. Murphy via Libc-alpha
  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 via Libc-alpha
  2020-03-27 21:18 ` [PATCH v2 10/10] powerpc64le: Enable support for IEEE long double Paul E. Murphy via Libc-alpha
  9 siblings, 1 reply; 27+ messages in thread
From: Paul E. Murphy via Libc-alpha @ 2020-03-27 21:17 UTC (permalink / raw
  To: libc-alpha

We turn off this feature to avoid polluting our shared libary with
a specific value.  However, static libgcc is not under our control,
and has enabled this for ibm128 routines.  This pollutes the
resulting shared libraries with it.

Attach a post-linking hook to replace this section with one crafted
as hard-float + indeterminate ldbl.  This allows IEEE ldbl users to
avoid having to disable the gnu attributes feature which should
protect them from linking ibm ldbl libraries using the gnu attributes
feature.

Currently, this only replaces only libc and libm which support both
ldbl formats and rely on application code to explicitly determine which
is to be used.

Strictly speaking, the section could be deleted with minimal lost value.
However correctly set attributes could prove useful for some future change,
and similarly missing attributes.
---
 sysdeps/powerpc/powerpc64/le/Makefile         | 27 ++++++++++++++++-
 .../powerpc64/le/no_ldbl_gnu_attribute.c      | 30 +++++++++++++++++++
 2 files changed, 56 insertions(+), 1 deletion(-)
 create mode 100644 sysdeps/powerpc/powerpc64/le/no_ldbl_gnu_attribute.c

diff --git a/sysdeps/powerpc/powerpc64/le/Makefile b/sysdeps/powerpc/powerpc64/le/Makefile
index 9ba7f850ad..55e0c48f5d 100644
--- a/sysdeps/powerpc/powerpc64/le/Makefile
+++ b/sysdeps/powerpc/powerpc64/le/Makefile
@@ -10,7 +10,32 @@ ifeq ($(ibm128-fcts),yes)
 ibm128-abi-CFLAGS := -mabi=ibmlongdouble
 type-ldouble-CFLAGS += $(ibm128-abi-CFLAGS)
 no-gnu-attribute-CFLAGS = -mno-gnu-attribute
-endif
+
+# This is a very gnarly workaround to static libgcc providing a .gnu.attribute
+# in ibm128 functions.  This is not a bug in static libgcc as normal users
+# should only ever link ibm128 or ieee128 routines, never both.  We are the
+# exception which allows the decision to be deferred to user libraries or
+# applications.
+#
+# We built an object file and extract the desired .gnu.attributes section
+# to be inserted into lib{c,m}.so.
+ifeq ($(build-shared),yes)
+before-compile += $(common-objpfx)no_ldbl_gnu_attribute.bin
+
+$(common-objpfx)no_ldbl_gnu_attribute.bin: $(..)sysdeps/powerpc/powerpc64/le/no_ldbl_gnu_attribute.c
+	$(filter-out $(no-gnu-attribute-CFLAGS),$(compile.c)) -o $(basename $@).o
+	$(OBJCOPY) --dump-section=.gnu.attributes=$@.tmp $(basename $@).o
+	mv $@.tmp $@
+
+define after-link
+if [ ! -z "$(filter libm.so libc.so,$(notdir $1))" ]; then \
+  echo "Replacing .gnu.attributes in $1"; \
+  $(OBJCOPY) --update-section=.gnu.attributes=$(common-objpfx)no_ldbl_gnu_attribute.bin $1; \
+fi
+endef
+
+endif # ifeq ($(build-shared),yes)
+endif # ifeq ($(ibm128-fcts),yes)
 
 # All _Float128 files should be built assuming an ibm128 long double.
 # Likewise, this avoids some old GCC 7 compiler bugs whereby calls
diff --git a/sysdeps/powerpc/powerpc64/le/no_ldbl_gnu_attribute.c b/sysdeps/powerpc/powerpc64/le/no_ldbl_gnu_attribute.c
new file mode 100644
index 0000000000..8ffee30560
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/le/no_ldbl_gnu_attribute.c
@@ -0,0 +1,30 @@
+/* File to generate desired .gnu.attribute section
+   Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <https://www.gnu.org/licenses/>.  */
+
+/* This generates a .gnu.attributes sections with
+   the default toolchain settings and an indeterminate
+   long double format.  */
+long double _not_used;
+
+/* Some older GCC versions need a little more convincing to
+   generate .gnu.attributes.  */
+double
+foo (double d)
+{
+  return d;
+}
-- 
2.21.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v2 09/10] powerpc64le: blacklist broken GCC compilers (e.g GCC 7.5.0)
  2020-03-27 21:17 [PATCH v2 00/10] IEEE binary128 long double on powerpc64le Paul E. Murphy via Libc-alpha
                   ` (7 preceding siblings ...)
  2020-03-27 21:17 ` [PATCH v2 08/10] powerpc64le: enforce non-specific long double in .gnu.attributes section Paul E. Murphy via Libc-alpha
@ 2020-03-27 21:18 ` Paul E. Murphy via Libc-alpha
  2020-04-03 20:38   ` Adhemerval Zanella via Libc-alpha
  2020-03-27 21:18 ` [PATCH v2 10/10] powerpc64le: Enable support for IEEE long double Paul E. Murphy via Libc-alpha
  9 siblings, 1 reply; 27+ messages in thread
From: Paul E. Murphy via Libc-alpha @ 2020-03-27 21:18 UTC (permalink / raw
  To: libc-alpha

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(-)

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,
-- 
2.21.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v2 10/10] powerpc64le: Enable support for IEEE long double
  2020-03-27 21:17 [PATCH v2 00/10] IEEE binary128 long double on powerpc64le Paul E. Murphy via Libc-alpha
                   ` (8 preceding siblings ...)
  2020-03-27 21:18 ` [PATCH v2 09/10] powerpc64le: blacklist broken GCC compilers (e.g GCC 7.5.0) Paul E. Murphy via Libc-alpha
@ 2020-03-27 21:18 ` Paul E. Murphy via Libc-alpha
  9 siblings, 0 replies; 27+ messages in thread
From: Paul E. Murphy via Libc-alpha @ 2020-03-27 21:18 UTC (permalink / raw
  To: libc-alpha

From: "Gabriel F. T. Gomes" <gabrielftg@linux.ibm.com>

Changes since v5:

  - Rebase against inline math test removal

Changes since v4:

  - More Makefile massaging
  - Add ULPs for ieee128 only _Float128 redirects
  - Update for glibc 2.32
  - Add short NEWS entry

Changes since v4:

  - Removed the redirections code (moved to a separate commit).

No changes since v3.

Changes since v2:

  - Added definition of LDBL_IBM128_COMPAT_VERSION and
    LDBL_IBM128_VERSION (moved from a previous commit).

Changes since v1:

  - Use __LONG_DOUBLE_USES_FLOAT128 directly.

-- 8< --
On platforms where long double may have two different formats, i.e.: the
same format as double (64-bits) or something else (128-bits), building
with -mlong-double-128 is the default and function calls in the user
program match the name of the function in Glibc.  When building with
-mlong-double-64, Glibc installed headers redirect such calls to the
appropriate function.

Likewise, the internals of glibc are now built against IEEE long double.
However, the only (minimally) notable usage of long double is difftime.
---
 NEWS                                          |   5 +
 sysdeps/powerpc/fpu/libm-test-ulps            |   4 +
 sysdeps/powerpc/powerpc64/le/Implies-before   |   1 +
 sysdeps/powerpc/powerpc64/le/Makefile         |   4 +
 .../powerpc64/le/ldbl-128ibm-compat-abi.h     |   8 ++
 .../linux/powerpc/powerpc64/le/libc.abilist   |  93 ++++++++++++++
 .../linux/powerpc/powerpc64/le/libm.abilist   | 117 ++++++++++++++++++
 7 files changed, 232 insertions(+)
 create mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc64/le/ldbl-128ibm-compat-abi.h

diff --git a/NEWS b/NEWS
index 1c88c95d1c..d74a74fccb 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,11 @@ Major new features:
 
   * New locale added: ckb_IQ (Kurdish/Sorani spoken in Iraq)
 
+  * powerpc64le supports IEEE128 long double libm/libc redirects when
+    using the -mabi=ieeelongdouble to compile C code on supported GCC
+    toolchains.  It is recommended to use GCC 8 or newer when testing
+    this option.
+
 Deprecated and removed features, and other changes affecting compatibility:
 
   [Add deprecations, removals and changes affecting compatibility here]
diff --git a/sysdeps/powerpc/fpu/libm-test-ulps b/sysdeps/powerpc/fpu/libm-test-ulps
index 73f18cf1df..695c5eee7e 100644
--- a/sysdeps/powerpc/fpu/libm-test-ulps
+++ b/sysdeps/powerpc/fpu/libm-test-ulps
@@ -1264,21 +1264,25 @@ ldouble: 1
 Function: "gamma":
 double: 3
 float: 4
+float128: 5
 ldouble: 3
 
 Function: "gamma_downward":
 double: 4
 float: 4
+float128: 8
 ldouble: 15
 
 Function: "gamma_towardzero":
 double: 4
 float: 3
+float128: 5
 ldouble: 16
 
 Function: "gamma_upward":
 double: 4
 float: 5
+float128: 8
 ldouble: 11
 
 Function: "hypot":
diff --git a/sysdeps/powerpc/powerpc64/le/Implies-before b/sysdeps/powerpc/powerpc64/le/Implies-before
index 7c20db4e97..2139f4dae8 100644
--- a/sysdeps/powerpc/powerpc64/le/Implies-before
+++ b/sysdeps/powerpc/powerpc64/le/Implies-before
@@ -1,4 +1,5 @@
 # On PowerPC we use the IBM extended long double format.
+ieee754/ldbl-128ibm-compat
 ieee754/ldbl-128ibm
 ieee754/ldbl-opt
 ieee754/dbl-64
diff --git a/sysdeps/powerpc/powerpc64/le/Makefile b/sysdeps/powerpc/powerpc64/le/Makefile
index 55e0c48f5d..2fdee66efd 100644
--- a/sysdeps/powerpc/powerpc64/le/Makefile
+++ b/sysdeps/powerpc/powerpc64/le/Makefile
@@ -20,6 +20,10 @@ no-gnu-attribute-CFLAGS = -mno-gnu-attribute
 # We built an object file and extract the desired .gnu.attributes section
 # to be inserted into lib{c,m}.so.
 ifeq ($(build-shared),yes)
+
+# Build everything with IEEE 128-bit long double.
+sysdep-CFLAGS += -mabi=ieeelongdouble -Wno-psabi $(no-gnu-attribute-CFLAGS)
+
 before-compile += $(common-objpfx)no_ldbl_gnu_attribute.bin
 
 $(common-objpfx)no_ldbl_gnu_attribute.bin: $(..)sysdeps/powerpc/powerpc64/le/no_ldbl_gnu_attribute.c
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/ldbl-128ibm-compat-abi.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/ldbl-128ibm-compat-abi.h
new file mode 100644
index 0000000000..34c7b6bed6
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/ldbl-128ibm-compat-abi.h
@@ -0,0 +1,8 @@
+/* ABI version for long double switch to IEEE 128-bit floating point..
+   This is used by the Versions and math_ldbl_opt.h files in
+   sysdeps/ieee754/ldbl-128ibm-compat/.  It gives the ABI version where
+   long double == ibm128 was replaced with long double == _Float128
+   for libm *l functions and libc functions using long double.  */
+
+#define LDBL_IBM128_VERSION		GLIBC_2.32
+#define LDBL_IBM128_COMPAT_VERSION	GLIBC_2_32
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
index 2229a1dcc0..c0ca0d6907 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
@@ -2247,3 +2247,96 @@ GLIBC_2.30 getdents64 F
 GLIBC_2.30 gettid F
 GLIBC_2.30 tgkill F
 GLIBC_2.30 twalk_r F
+GLIBC_2.32 __argp_errorieee128 F
+GLIBC_2.32 __argp_failureieee128 F
+GLIBC_2.32 __asprintf_chkieee128 F
+GLIBC_2.32 __asprintfieee128 F
+GLIBC_2.32 __dprintf_chkieee128 F
+GLIBC_2.32 __dprintfieee128 F
+GLIBC_2.32 __errieee128 F
+GLIBC_2.32 __error_at_lineieee128 F
+GLIBC_2.32 __errorieee128 F
+GLIBC_2.32 __errxieee128 F
+GLIBC_2.32 __fprintf_chkieee128 F
+GLIBC_2.32 __fprintfieee128 F
+GLIBC_2.32 __fscanfieee128 F
+GLIBC_2.32 __fwprintf_chkieee128 F
+GLIBC_2.32 __fwprintfieee128 F
+GLIBC_2.32 __fwscanfieee128 F
+GLIBC_2.32 __isoc99_fscanfieee128 F
+GLIBC_2.32 __isoc99_fwscanfieee128 F
+GLIBC_2.32 __isoc99_scanfieee128 F
+GLIBC_2.32 __isoc99_sscanfieee128 F
+GLIBC_2.32 __isoc99_swscanfieee128 F
+GLIBC_2.32 __isoc99_vfscanfieee128 F
+GLIBC_2.32 __isoc99_vfwscanfieee128 F
+GLIBC_2.32 __isoc99_vscanfieee128 F
+GLIBC_2.32 __isoc99_vsscanfieee128 F
+GLIBC_2.32 __isoc99_vswscanfieee128 F
+GLIBC_2.32 __isoc99_vwscanfieee128 F
+GLIBC_2.32 __isoc99_wscanfieee128 F
+GLIBC_2.32 __obstack_printf_chkieee128 F
+GLIBC_2.32 __obstack_printfieee128 F
+GLIBC_2.32 __obstack_vprintf_chkieee128 F
+GLIBC_2.32 __obstack_vprintfieee128 F
+GLIBC_2.32 __printf_chkieee128 F
+GLIBC_2.32 __printf_sizeieee128 F
+GLIBC_2.32 __printfieee128 F
+GLIBC_2.32 __qecvtieee128 F
+GLIBC_2.32 __qecvtieee128_r F
+GLIBC_2.32 __qfcvtieee128 F
+GLIBC_2.32 __qfcvtieee128_r F
+GLIBC_2.32 __qgcvtieee128 F
+GLIBC_2.32 __scanfieee128 F
+GLIBC_2.32 __snprintf_chkieee128 F
+GLIBC_2.32 __snprintfieee128 F
+GLIBC_2.32 __sprintf_chkieee128 F
+GLIBC_2.32 __sprintfieee128 F
+GLIBC_2.32 __sscanfieee128 F
+GLIBC_2.32 __strfmon_lieee128 F
+GLIBC_2.32 __strfmonieee128 F
+GLIBC_2.32 __strfromieee128 F
+GLIBC_2.32 __strtoieee128 F
+GLIBC_2.32 __strtoieee128_l F
+GLIBC_2.32 __swprintf_chkieee128 F
+GLIBC_2.32 __swprintfieee128 F
+GLIBC_2.32 __swscanfieee128 F
+GLIBC_2.32 __syslog_chkieee128 F
+GLIBC_2.32 __syslogieee128 F
+GLIBC_2.32 __vasprintf_chkieee128 F
+GLIBC_2.32 __vasprintfieee128 F
+GLIBC_2.32 __vdprintf_chkieee128 F
+GLIBC_2.32 __vdprintfieee128 F
+GLIBC_2.32 __verrieee128 F
+GLIBC_2.32 __verrxieee128 F
+GLIBC_2.32 __vfprintf_chkieee128 F
+GLIBC_2.32 __vfprintfieee128 F
+GLIBC_2.32 __vfscanfieee128 F
+GLIBC_2.32 __vfwprintf_chkieee128 F
+GLIBC_2.32 __vfwprintfieee128 F
+GLIBC_2.32 __vfwscanfieee128 F
+GLIBC_2.32 __vprintf_chkieee128 F
+GLIBC_2.32 __vprintfieee128 F
+GLIBC_2.32 __vscanfieee128 F
+GLIBC_2.32 __vsnprintf_chkieee128 F
+GLIBC_2.32 __vsnprintfieee128 F
+GLIBC_2.32 __vsprintf_chkieee128 F
+GLIBC_2.32 __vsprintfieee128 F
+GLIBC_2.32 __vsscanfieee128 F
+GLIBC_2.32 __vswprintf_chkieee128 F
+GLIBC_2.32 __vswprintfieee128 F
+GLIBC_2.32 __vswscanfieee128 F
+GLIBC_2.32 __vsyslog_chkieee128 F
+GLIBC_2.32 __vsyslogieee128 F
+GLIBC_2.32 __vwarnieee128 F
+GLIBC_2.32 __vwarnxieee128 F
+GLIBC_2.32 __vwprintf_chkieee128 F
+GLIBC_2.32 __vwprintfieee128 F
+GLIBC_2.32 __vwscanfieee128 F
+GLIBC_2.32 __warnieee128 F
+GLIBC_2.32 __warnxieee128 F
+GLIBC_2.32 __wcstoieee128 F
+GLIBC_2.32 __wcstoieee128_l F
+GLIBC_2.32 __wprintf_chkieee128 F
+GLIBC_2.32 __wprintfieee128 F
+GLIBC_2.32 __wscanfieee128 F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libm.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libm.abilist
index d479a64fca..aa45e2639c 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libm.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libm.abilist
@@ -1097,3 +1097,120 @@ GLIBC_2.31 totalordermagf32x F
 GLIBC_2.31 totalordermagf64 F
 GLIBC_2.31 totalordermagf64x F
 GLIBC_2.31 totalordermagl F
+GLIBC_2.32 __acoshieee128 F
+GLIBC_2.32 __acosieee128 F
+GLIBC_2.32 __asinhieee128 F
+GLIBC_2.32 __asinieee128 F
+GLIBC_2.32 __atan2ieee128 F
+GLIBC_2.32 __atanhieee128 F
+GLIBC_2.32 __atanieee128 F
+GLIBC_2.32 __cabsieee128 F
+GLIBC_2.32 __cacoshieee128 F
+GLIBC_2.32 __cacosieee128 F
+GLIBC_2.32 __canonicalizeieee128 F
+GLIBC_2.32 __cargieee128 F
+GLIBC_2.32 __casinhieee128 F
+GLIBC_2.32 __casinieee128 F
+GLIBC_2.32 __catanhieee128 F
+GLIBC_2.32 __catanieee128 F
+GLIBC_2.32 __cbrtieee128 F
+GLIBC_2.32 __ccoshieee128 F
+GLIBC_2.32 __ccosieee128 F
+GLIBC_2.32 __ceilieee128 F
+GLIBC_2.32 __cexpieee128 F
+GLIBC_2.32 __cimagieee128 F
+GLIBC_2.32 __clog10ieee128 F
+GLIBC_2.32 __clogieee128 F
+GLIBC_2.32 __conjieee128 F
+GLIBC_2.32 __copysignieee128 F
+GLIBC_2.32 __coshieee128 F
+GLIBC_2.32 __cosieee128 F
+GLIBC_2.32 __cpowieee128 F
+GLIBC_2.32 __cprojieee128 F
+GLIBC_2.32 __crealieee128 F
+GLIBC_2.32 __csinhieee128 F
+GLIBC_2.32 __csinieee128 F
+GLIBC_2.32 __csqrtieee128 F
+GLIBC_2.32 __ctanhieee128 F
+GLIBC_2.32 __ctanieee128 F
+GLIBC_2.32 __erfcieee128 F
+GLIBC_2.32 __erfieee128 F
+GLIBC_2.32 __exp10ieee128 F
+GLIBC_2.32 __exp2ieee128 F
+GLIBC_2.32 __expieee128 F
+GLIBC_2.32 __expm1ieee128 F
+GLIBC_2.32 __f32addieee128 F
+GLIBC_2.32 __f32divieee128 F
+GLIBC_2.32 __f32mulieee128 F
+GLIBC_2.32 __f32subieee128 F
+GLIBC_2.32 __f64addieee128 F
+GLIBC_2.32 __f64divieee128 F
+GLIBC_2.32 __f64mulieee128 F
+GLIBC_2.32 __f64subieee128 F
+GLIBC_2.32 __fabsieee128 F
+GLIBC_2.32 __fdimieee128 F
+GLIBC_2.32 __floorieee128 F
+GLIBC_2.32 __fmaieee128 F
+GLIBC_2.32 __fmaxieee128 F
+GLIBC_2.32 __fmaxmagieee128 F
+GLIBC_2.32 __fminieee128 F
+GLIBC_2.32 __fminmagieee128 F
+GLIBC_2.32 __fmodieee128 F
+GLIBC_2.32 __frexpieee128 F
+GLIBC_2.32 __fromfpieee128 F
+GLIBC_2.32 __fromfpxieee128 F
+GLIBC_2.32 __getpayloadieee128 F
+GLIBC_2.32 __hypotieee128 F
+GLIBC_2.32 __ilogbieee128 F
+GLIBC_2.32 __j0ieee128 F
+GLIBC_2.32 __j1ieee128 F
+GLIBC_2.32 __jnieee128 F
+GLIBC_2.32 __ldexpieee128 F
+GLIBC_2.32 __lgammaieee128 F
+GLIBC_2.32 __lgammaieee128_r F
+GLIBC_2.32 __llogbieee128 F
+GLIBC_2.32 __llrintieee128 F
+GLIBC_2.32 __llroundieee128 F
+GLIBC_2.32 __log10ieee128 F
+GLIBC_2.32 __log1pieee128 F
+GLIBC_2.32 __log2ieee128 F
+GLIBC_2.32 __logbieee128 F
+GLIBC_2.32 __logieee128 F
+GLIBC_2.32 __lrintieee128 F
+GLIBC_2.32 __lroundieee128 F
+GLIBC_2.32 __modfieee128 F
+GLIBC_2.32 __nanieee128 F
+GLIBC_2.32 __nearbyintieee128 F
+GLIBC_2.32 __nextafterieee128 F
+GLIBC_2.32 __nextdownieee128 F
+GLIBC_2.32 __nexttoward_to_ieee128 F
+GLIBC_2.32 __nexttowardf_to_ieee128 F
+GLIBC_2.32 __nexttowardieee128 F
+GLIBC_2.32 __nextupieee128 F
+GLIBC_2.32 __powieee128 F
+GLIBC_2.32 __remainderieee128 F
+GLIBC_2.32 __remquoieee128 F
+GLIBC_2.32 __rintieee128 F
+GLIBC_2.32 __roundevenieee128 F
+GLIBC_2.32 __roundieee128 F
+GLIBC_2.32 __scalbieee128 F
+GLIBC_2.32 __scalblnieee128 F
+GLIBC_2.32 __scalbnieee128 F
+GLIBC_2.32 __setpayloadieee128 F
+GLIBC_2.32 __setpayloadsigieee128 F
+GLIBC_2.32 __significandieee128 F
+GLIBC_2.32 __sincosieee128 F
+GLIBC_2.32 __sinhieee128 F
+GLIBC_2.32 __sinieee128 F
+GLIBC_2.32 __sqrtieee128 F
+GLIBC_2.32 __tanhieee128 F
+GLIBC_2.32 __tanieee128 F
+GLIBC_2.32 __tgammaieee128 F
+GLIBC_2.32 __totalorderieee128 F
+GLIBC_2.32 __totalordermagieee128 F
+GLIBC_2.32 __truncieee128 F
+GLIBC_2.32 __ufromfpieee128 F
+GLIBC_2.32 __ufromfpxieee128 F
+GLIBC_2.32 __y0ieee128 F
+GLIBC_2.32 __y1ieee128 F
+GLIBC_2.32 __ynieee128 F
-- 
2.21.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* Re: [PATCH v2 01/10] ldbl-128ibm-compat: workaround C++ redirect limitations
  2020-03-27 21:17 ` [PATCH v2 01/10] ldbl-128ibm-compat: workaround C++ redirect limitations Paul E. Murphy via Libc-alpha
@ 2020-03-27 21:34   ` Joseph Myers
  2020-04-01 20:29     ` Paul E Murphy via Libc-alpha
  0 siblings, 1 reply; 27+ messages in thread
From: Joseph Myers @ 2020-03-27 21:34 UTC (permalink / raw
  To: Paul E. Murphy; +Cc: libc-alpha

On Fri, 27 Mar 2020, Paul E. Murphy via Libc-alpha wrote:

> GCC 8+ is more pedantic about type checking the redirect declarations
> for non-system headers.  I am not sure if there is less obtrusive way
> to dodge these warnings when building C++ tests using the headers from
> the glibc under construction.

The first thing you need to include in the commit message for such a 
change is *the exact diagnostics you're trying to avoid*.  Only given 
those diagnostics can we try to work out a better fix.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v2 06/10] powerpc64le: raise GCC requirement to 7.3 for long double transition
  2020-03-27 21:17 ` [PATCH v2 06/10] powerpc64le: raise GCC requirement to 7.3 for long double transition Paul E. Murphy via Libc-alpha
@ 2020-03-31 20:47   ` Paul E Murphy via Libc-alpha
  0 siblings, 0 replies; 27+ messages in thread
From: Paul E Murphy via Libc-alpha @ 2020-03-31 20:47 UTC (permalink / raw
  To: libc-alpha



On 3/27/20 4:17 PM, Paul E. Murphy via Libc-alpha wrote:
> 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.

It turns out this is incorrect.  Based on testing and feedback in the 
BZ, this fix arrived in GCC 7.4.  While GCC 7.3 can build glibc, it will 
fail to build several ldouble related tests.  Thus, the actual minimum 
is GCC 7.4.

I will update the commit message, and configure error to reflect this, 
and post new patches once the preparatory patches are submitted.

> 
> 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

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v2 01/10] ldbl-128ibm-compat: workaround C++ redirect limitations
  2020-03-27 21:34   ` Joseph Myers
@ 2020-04-01 20:29     ` Paul E Murphy via Libc-alpha
  2020-04-01 20:41       ` DJ Delorie via Libc-alpha
  2020-04-01 23:07       ` Joseph Myers
  0 siblings, 2 replies; 27+ messages in thread
From: Paul E Murphy via Libc-alpha @ 2020-04-01 20:29 UTC (permalink / raw
  To: Joseph Myers; +Cc: libc-alpha



On 3/27/20 4:34 PM, Joseph Myers wrote:
> On Fri, 27 Mar 2020, Paul E. Murphy via Libc-alpha wrote:
> 
>> GCC 8+ is more pedantic about type checking the redirect declarations
>> for non-system headers.  I am not sure if there is less obtrusive way
>> to dodge these warnings when building C++ tests using the headers from
>> the glibc under construction.

How about the following commit message body?

GCC 9.2 is more pedantic about type checking the redirect declarations
for non-system headers.  I am not sure if there is less obtrusive way
to dodge these warnings when building C++ tests using the headers from
the glibc under construction.

Many errors of the following form appear:

In file included from ../include/sys/cdefs.h:3,
                  from ../include/features.h:465,
                  from ../bits/libc-header-start.h:33,
                  from ../math/math.h:27,
                  from ../include/math.h:7,
                  from test-math-isinff.cc:21:
../libio/bits/stdio-ldbl.h:25:20: error: declaration of ‘int 
sprintf(char*, const char*, ...)’ has a different exception specifier
    25 | __LDBL_REDIR_DECL (sprintf)
       |                    ^~~~~~~
../misc/sys/cdefs.h:461:26: note: in definition of macro ‘__LDBL_REDIR_DECL’
   461 |   extern __typeof (name) name __asm (__ASMNAME ("__" #name 
"ieee128"));
       |                          ^~~~
In file included from ../include/stdio.h:5,
                  from test-math-isinff.cc:22:
../libio/stdio.h:334:12: note: from previous declaration ‘int 
sprintf(char*, const char*, ...) throw ()’
   334 | extern int sprintf (char *__restrict __s,
       |            ^~~~~~~


> 
> The first thing you need to include in the commit message for such a
> change is *the exact diagnostics you're trying to avoid*.  Only given
> those diagnostics can we try to work out a better fix.
> 
I noticed this occurs on FSF GCC 9.2, but not 9.3 and newer.  The 
documentation is vague about which warnings and errors are disabled by 
system_header pragma.

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v2 01/10] ldbl-128ibm-compat: workaround C++ redirect limitations
  2020-04-01 20:29     ` Paul E Murphy via Libc-alpha
@ 2020-04-01 20:41       ` DJ Delorie via Libc-alpha
  2020-04-01 23:07       ` Joseph Myers
  1 sibling, 0 replies; 27+ messages in thread
From: DJ Delorie via Libc-alpha @ 2020-04-01 20:41 UTC (permalink / raw
  To: Paul E Murphy; +Cc: libc-alpha, joseph

Paul E Murphy <murphyp@linux.ibm.com> writes:
> How about the following commit message body?
>
> GCC 9.2 is more pedantic about type checking the redirect declarations
> for non-system headers.

More pedantic than what?  Older compilers?  Newer compilers?  English majors?


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v2 01/10] ldbl-128ibm-compat: workaround C++ redirect limitations
  2020-04-01 20:29     ` Paul E Murphy via Libc-alpha
  2020-04-01 20:41       ` DJ Delorie via Libc-alpha
@ 2020-04-01 23:07       ` Joseph Myers
  2020-04-02 16:48         ` Paul E Murphy via Libc-alpha
  1 sibling, 1 reply; 27+ messages in thread
From: Joseph Myers @ 2020-04-01 23:07 UTC (permalink / raw
  To: Paul E Murphy; +Cc: libc-alpha

On Wed, 1 Apr 2020, Paul E Murphy via Libc-alpha wrote:

> GCC 9.2 is more pedantic about type checking the redirect declarations
> for non-system headers.  I am not sure if there is less obtrusive way
> to dodge these warnings when building C++ tests using the headers from
> the glibc under construction.

Warnings about inconsistency of attributes for aliases were addressed by 
using __attribute_copy__ in alias macros.  Those warnings typically 
indicated that code using the aliases would be suboptimal in some way (not 
fully optimized based on attributes, or with diagnostics based on those 
attributes potentially missing).

This seems like something similar, but about C++ exception specifications 
instead of attributes.  If there isn't some way to copy exception 
specifications, maybe there needs to be a variant of __LDBL_REDIR_DECL 
where attributes / exception specifications / ... can be passed in 
explicitly.  Then you can include __THROWNL in that call to 
__LDBL_REDIR_DECL and similarly for all other such redirected functions 
where __THROWNL is part of the declaration of the original function.

> I noticed this occurs on FSF GCC 9.2, but not 9.3 and newer.  The
> documentation is vague about which warnings and errors are disabled by
> system_header pragma.

Or if it's a GCC bug it would be useful to identify exactly which bug in 
GCC Bugzilla it is / which commit fixed it (and potentially have a 
workaround that is explicitly conditioned on the buggy GCC versions with a 
comment referencing the exact bug and fixed versions).

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v2 01/10] ldbl-128ibm-compat: workaround C++ redirect limitations
  2020-04-01 23:07       ` Joseph Myers
@ 2020-04-02 16:48         ` Paul E Murphy via Libc-alpha
  0 siblings, 0 replies; 27+ messages in thread
From: Paul E Murphy via Libc-alpha @ 2020-04-02 16:48 UTC (permalink / raw
  To: Joseph Myers; +Cc: libc-alpha



On 4/1/20 6:07 PM, Joseph Myers wrote:
> On Wed, 1 Apr 2020, Paul E Murphy via Libc-alpha wrote:
> 
>> GCC 9.2 is more pedantic about type checking the redirect declarations
>> for non-system headers.  I am not sure if there is less obtrusive way
>> to dodge these warnings when building C++ tests using the headers from
>> the glibc under construction.
> 
> Warnings about inconsistency of attributes for aliases were addressed by
> using __attribute_copy__ in alias macros.  Those warnings typically
> indicated that code using the aliases would be suboptimal in some way (not
> fully optimized based on attributes, or with diagnostics based on those
> attributes potentially missing).
> 
> This seems like something similar, but about C++ exception specifications
> instead of attributes.  If there isn't some way to copy exception
> specifications, maybe there needs to be a variant of __LDBL_REDIR_DECL
> where attributes / exception specifications / ... can be passed in
> explicitly.  Then you can include __THROWNL in that call to
> __LDBL_REDIR_DECL and similarly for all other such redirected functions
> where __THROWNL is part of the declaration of the original function.
> 
>> I noticed this occurs on FSF GCC 9.2, but not 9.3 and newer.  The
>> documentation is vague about which warnings and errors are disabled by
>> system_header pragma.
> 
> Or if it's a GCC bug it would be useful to identify exactly which bug in
> GCC Bugzilla it is / which commit fixed it (and potentially have a
> workaround that is explicitly conditioned on the buggy GCC versions with a
> comment referencing the exact bug and fixed versions).
> 

On second thought, this is surely a bug.  With some exploration, I found 
GCC PR 90731 fixed it between 9.2 and 9.3.  I will seek a lower bound 
and update the patch.

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v2 05/10] powerpc64le: workaround ieee long double / _Float128 stdc++ bug
  2020-03-27 21:17 ` [PATCH v2 05/10] powerpc64le: workaround ieee long double / _Float128 stdc++ bug Paul E. Murphy via Libc-alpha
@ 2020-04-03 19:03   ` Tulio Magno Quites Machado Filho
  0 siblings, 0 replies; 27+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2020-04-03 19:03 UTC (permalink / raw
  To: Paul E. Murphy, libc-alpha

"Paul E. Murphy via Libc-alpha" <libc-alpha@sourceware.org> writes:

> diff --git a/sysdeps/powerpc/powerpc64/le/Makefile b/sysdeps/powerpc/powerpc64/le/Makefile
> index 441a8a14e5..9ba7f850ad 100644
> --- a/sysdeps/powerpc/powerpc64/le/Makefile
> +++ b/sysdeps/powerpc/powerpc64/le/Makefile
> @@ -140,3 +140,14 @@ $(foreach suf,$(all-object-suffixes), $(ldbl-ibm128-files)) \
>  	  $(foreach r,$(ldbl-128ibm-routines) $(ldbl-tests), \
>  		    $(objpfx)$(r)$(suf)): \
>    sysdep-CFLAGS := $(filter-out -mabi=ieeelongdouble,$(sysdep-CFLAGS))
> +
> +# TODO: a bug in stdc++ will fail if -mabi=ieeelongdouble and -mfloat128
> +# are both enabled. The latter is enabled by default in GCC 8+.  This is

2 spaces -------------^

LGTM with that fix.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>

-- 
Tulio Magno


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v2 03/10] Rename __LONG_DOUBLE_USES_FLOAT128 to
  2020-03-27 21:17 ` [PATCH v2 03/10] Rename __LONG_DOUBLE_USES_FLOAT128 to Paul E. Murphy via Libc-alpha
@ 2020-04-03 19:22   ` Tulio Magno Quites Machado Filho
  0 siblings, 0 replies; 27+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2020-04-03 19:22 UTC (permalink / raw
  To: Paul E. Murphy, libc-alpha

"Paul E. Murphy via Libc-alpha" <libc-alpha@sourceware.org> writes:

> __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI per feedback and disucssion

It seems the subject of the commit and the initial explanation got mixed up.

> diff --git a/bits/long-double.h b/bits/long-double.h
> index 6e16447e65..bdde78f49a 100644
> --- a/bits/long-double.h
> +++ b/bits/long-double.h
> @@ -37,4 +37,17 @@
>  #ifndef __NO_LONG_DOUBLE_MATH
>  # define __NO_LONG_DOUBLE_MATH	1
>  #endif
> -#define __LONG_DOUBLE_USES_FLOAT128 0
> +
> +/* The macro __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI is used to determine the
> +   choice of the underlying ABI of long double.  It will always assume
> +   a constant value for each translation unit.
> +
> +   If the value is non-zero, any API which is parameterized by the long
> +   double type (i.e the scanf/printf family of functions or the explicitly
> +   parameterized math.h functions) will be redirected to a compatible
> +   implementation using _Float128 ABI via symbols suffixed with ieee128.
> +
> +   The mechanism this macro uses to acquire may be a function
> +   of architecture, or target specific options used to invoke the
> +   compiler.  */
> +#define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 0

OK.

> diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/bits/long-double.h b/sysdeps/ieee754/ldbl-128ibm-compat/bits/long-double.h
> index 91dddbdc8b..ef834c7748 100644
> --- a/sysdeps/ieee754/ldbl-128ibm-compat/bits/long-double.h
> +++ b/sysdeps/ieee754/ldbl-128ibm-compat/bits/long-double.h
> @@ -22,8 +22,5 @@
>  #  define __NO_LONG_DOUBLE_MATH		1
>  # endif
>  #endif
> -/* On platforms that reuse the _Float128 implementation for IEEE long
> -   double, access to the correct long double functions is selected based
> -   on the long double mode being used during the compilation.  On
> -   powerpc64le, this is true when -mabi=ieeelongdouble is in use.  */
> -#define __LONG_DOUBLE_USES_FLOAT128 (__LDBL_MANT_DIG__ == 113)
> +
> +#define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI (__LDBL_MANT_DIG__ == 113)

OK.

LGTM with a fixed subject

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>

-- 
Tulio Magno


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v2 04/10] powerpc64le: Enforce -mabi=ibmlongdouble when -mfloat128 used
  2020-03-27 21:17 ` [PATCH v2 04/10] powerpc64le: Enforce -mabi=ibmlongdouble when -mfloat128 used Paul E. Murphy via Libc-alpha
@ 2020-04-03 19:29   ` Tulio Magno Quites Machado Filho
  2020-04-06 16:49     ` Paul E Murphy via Libc-alpha
  0 siblings, 1 reply; 27+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2020-04-03 19:29 UTC (permalink / raw
  To: Paul E. Murphy, libc-alpha

"Paul E. Murphy via Libc-alpha" <libc-alpha@sourceware.org> writes:

> I have observed a bug on 7.4.0 whereby __mulkc3 calls are
> swapped with __multc3 depending on ABI selection.  For the
> sake of being overly cautious, build all _Float128 files
> with ibm128 to workaround these compilers.  This has been
> noted in GCC BZ 84914, and will not be fixed for GCC 7.
>
> Likewise, non-math files built with _Float128 are assumed
> to have ibm long double.  Explicilty preserve this
> assumption.
>
> Finally, add some bootstrapping code to avoid applying
> these options until IEEE long double is enabled as they
> require GCC 7 and above.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>

-- 
Tulio Magno


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v2 07/10] powerpc64le: bump binutils version requirement to >= 2.26
  2020-03-27 21:17 ` [PATCH v2 07/10] powerpc64le: bump binutils version requirement to >= 2.26 Paul E. Murphy via Libc-alpha
@ 2020-04-03 19:36   ` Tulio Magno Quites Machado Filho
  0 siblings, 0 replies; 27+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2020-04-03 19:36 UTC (permalink / raw
  To: Paul E. Murphy, libc-alpha

"Paul E. Murphy via Libc-alpha" <libc-alpha@sourceware.org> writes:

> This is a small step up from 2.25 which brings in support for
> rewriting the .gnu.attributes section of libc/libm.so.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>

-- 
Tulio Magno


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v2 08/10] powerpc64le: enforce non-specific long double in .gnu.attributes section
  2020-03-27 21:17 ` [PATCH v2 08/10] powerpc64le: enforce non-specific long double in .gnu.attributes section Paul E. Murphy via Libc-alpha
@ 2020-04-03 19:49   ` Tulio Magno Quites Machado Filho
  0 siblings, 0 replies; 27+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2020-04-03 19:49 UTC (permalink / raw
  To: Paul E. Murphy, libc-alpha

"Paul E. Murphy via Libc-alpha" <libc-alpha@sourceware.org> writes:

> We turn off this feature to avoid polluting our shared libary with
> a specific value.  However, static libgcc is not under our control,
> and has enabled this for ibm128 routines.  This pollutes the
> resulting shared libraries with it.
>
> Attach a post-linking hook to replace this section with one crafted
> as hard-float + indeterminate ldbl.  This allows IEEE ldbl users to
> avoid having to disable the gnu attributes feature which should
> protect them from linking ibm ldbl libraries using the gnu attributes
> feature.
>
> Currently, this only replaces only libc and libm which support both

s/only replaces only/only replaces/

> diff --git a/sysdeps/powerpc/powerpc64/le/Makefile b/sysdeps/powerpc/powerpc64/le/Makefile
> index 9ba7f850ad..55e0c48f5d 100644
> --- a/sysdeps/powerpc/powerpc64/le/Makefile
> +++ b/sysdeps/powerpc/powerpc64/le/Makefile
> @@ -10,7 +10,32 @@ ifeq ($(ibm128-fcts),yes)
>  ibm128-abi-CFLAGS := -mabi=ibmlongdouble
>  type-ldouble-CFLAGS += $(ibm128-abi-CFLAGS)
>  no-gnu-attribute-CFLAGS = -mno-gnu-attribute
> -endif
> +
> +# This is a very gnarly workaround to static libgcc providing a .gnu.attribute
> +# in ibm128 functions.  This is not a bug in static libgcc as normal users
> +# should only ever link ibm128 or ieee128 routines, never both.  We are the
> +# exception which allows the decision to be deferred to user libraries or
> +# applications.
> +#
> +# We built an object file and extract the desired .gnu.attributes section
> +# to be inserted into lib{c,m}.so.
> +ifeq ($(build-shared),yes)
> +before-compile += $(common-objpfx)no_ldbl_gnu_attribute.bin
> +
> +$(common-objpfx)no_ldbl_gnu_attribute.bin: $(..)sysdeps/powerpc/powerpc64/le/no_ldbl_gnu_attribute.c
> +	$(filter-out $(no-gnu-attribute-CFLAGS),$(compile.c)) -o $(basename $@).o
> +	$(OBJCOPY) --dump-section=.gnu.attributes=$@.tmp $(basename $@).o
> +	mv $@.tmp $@
> +
> +define after-link
> +if [ ! -z "$(filter libm.so libc.so,$(notdir $1))" ]; then \
> +  echo "Replacing .gnu.attributes in $1"; \
> +  $(OBJCOPY) --update-section=.gnu.attributes=$(common-objpfx)no_ldbl_gnu_attribute.bin $1; \
> +fi
> +endef

OK.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>

-- 
Tulio Magno


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v2 02/10] ldbl-128ibm: simplify iscanonical.h
  2020-03-27 21:17 ` [PATCH v2 02/10] ldbl-128ibm: simplify iscanonical.h Paul E. Murphy via Libc-alpha
@ 2020-04-03 20:12   ` Tulio Magno Quites Machado Filho
  2020-04-06 16:46     ` Paul E Murphy via Libc-alpha
  0 siblings, 1 reply; 27+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2020-04-03 20:12 UTC (permalink / raw
  To: Paul E. Murphy, libc-alpha

"Paul E. Murphy via Libc-alpha" <libc-alpha@sourceware.org> writes:

> The test for enabling _Float128 or IEEE 128 long double can be
> greatly simplified knowing that there is no ibm128, thus we require
> no special cases, and everything is canonical.
>
> This reverts the changes to ldbl-128ibm iscanonical.h from commit
> 8dbfea3a2094798a52cebddde01d255483f49665 and extends the check
> for __NO_LONG_DOUBLE_MATH to include a check for float128 redirects
> to long double.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>

-- 
Tulio Magno


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v2 09/10] powerpc64le: blacklist broken GCC compilers (e.g GCC 7.5.0)
  2020-03-27 21:18 ` [PATCH v2 09/10] powerpc64le: blacklist broken GCC compilers (e.g GCC 7.5.0) Paul E. Murphy via Libc-alpha
@ 2020-04-03 20:38   ` Adhemerval Zanella via Libc-alpha
  2020-04-07 19:57     ` Paul E Murphy via Libc-alpha
  0 siblings, 1 reply; 27+ messages in thread
From: Adhemerval Zanella via Libc-alpha @ 2020-04-03 20:38 UTC (permalink / raw
  To: libc-alpha



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?

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v2 02/10] ldbl-128ibm: simplify iscanonical.h
  2020-04-03 20:12   ` Tulio Magno Quites Machado Filho
@ 2020-04-06 16:46     ` Paul E Murphy via Libc-alpha
  0 siblings, 0 replies; 27+ messages in thread
From: Paul E Murphy via Libc-alpha @ 2020-04-06 16:46 UTC (permalink / raw
  To: Tulio Magno Quites Machado Filho, Paul E. Murphy, libc-alpha

Pushed.  Thanks!

On 4/3/20 3:12 PM, Tulio Magno Quites Machado Filho wrote:
> "Paul E. Murphy via Libc-alpha" <libc-alpha@sourceware.org> writes:
> 
>> The test for enabling _Float128 or IEEE 128 long double can be
>> greatly simplified knowing that there is no ibm128, thus we require
>> no special cases, and everything is canonical.
>>
>> This reverts the changes to ldbl-128ibm iscanonical.h from commit
>> 8dbfea3a2094798a52cebddde01d255483f49665 and extends the check
>> for __NO_LONG_DOUBLE_MATH to include a check for float128 redirects
>> to long double.
> 
> Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
> 

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v2 04/10] powerpc64le: Enforce -mabi=ibmlongdouble when -mfloat128 used
  2020-04-03 19:29   ` Tulio Magno Quites Machado Filho
@ 2020-04-06 16:49     ` Paul E Murphy via Libc-alpha
  0 siblings, 0 replies; 27+ messages in thread
From: Paul E Murphy via Libc-alpha @ 2020-04-06 16:49 UTC (permalink / raw
  To: Tulio Magno Quites Machado Filho, Paul E. Murphy, libc-alpha

Pushed with patch 5, 8 and all requested changes.  Thanks!

On 4/3/20 2:29 PM, Tulio Magno Quites Machado Filho wrote:
> "Paul E. Murphy via Libc-alpha" <libc-alpha@sourceware.org> writes:
> 
>> I have observed a bug on 7.4.0 whereby __mulkc3 calls are
>> swapped with __multc3 depending on ABI selection.  For the
>> sake of being overly cautious, build all _Float128 files
>> with ibm128 to workaround these compilers.  This has been
>> noted in GCC BZ 84914, and will not be fixed for GCC 7.
>>
>> Likewise, non-math files built with _Float128 are assumed
>> to have ibm long double.  Explicilty preserve this
>> assumption.
>>
>> Finally, add some bootstrapping code to avoid applying
>> these options until IEEE long double is enabled as they
>> require GCC 7 and above.
> 
> Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
> 

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v2 09/10] powerpc64le: blacklist broken GCC compilers (e.g GCC 7.5.0)
  2020-04-03 20:38   ` Adhemerval Zanella via Libc-alpha
@ 2020-04-07 19:57     ` Paul E Murphy via Libc-alpha
  0 siblings, 0 replies; 27+ messages in thread
From: Paul E Murphy via Libc-alpha @ 2020-04-07 19:57 UTC (permalink / raw
  To: Adhemerval Zanella, libc-alpha



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.


^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2020-04-07 19:57 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-27 21:17 [PATCH v2 00/10] IEEE binary128 long double on powerpc64le Paul E. Murphy via Libc-alpha
2020-03-27 21:17 ` [PATCH v2 01/10] ldbl-128ibm-compat: workaround C++ redirect limitations Paul E. Murphy via Libc-alpha
2020-03-27 21:34   ` Joseph Myers
2020-04-01 20:29     ` Paul E Murphy via Libc-alpha
2020-04-01 20:41       ` DJ Delorie via Libc-alpha
2020-04-01 23:07       ` Joseph Myers
2020-04-02 16:48         ` Paul E Murphy via Libc-alpha
2020-03-27 21:17 ` [PATCH v2 02/10] ldbl-128ibm: simplify iscanonical.h Paul E. Murphy via Libc-alpha
2020-04-03 20:12   ` Tulio Magno Quites Machado Filho
2020-04-06 16:46     ` Paul E Murphy via Libc-alpha
2020-03-27 21:17 ` [PATCH v2 03/10] Rename __LONG_DOUBLE_USES_FLOAT128 to Paul E. Murphy via Libc-alpha
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 via Libc-alpha
2020-04-03 19:29   ` Tulio Magno Quites Machado Filho
2020-04-06 16:49     ` Paul E Murphy via Libc-alpha
2020-03-27 21:17 ` [PATCH v2 05/10] powerpc64le: workaround ieee long double / _Float128 stdc++ bug Paul E. Murphy via Libc-alpha
2020-04-03 19:03   ` Tulio Magno Quites Machado Filho
2020-03-27 21:17 ` [PATCH v2 06/10] powerpc64le: raise GCC requirement to 7.3 for long double transition Paul E. Murphy via Libc-alpha
2020-03-31 20:47   ` Paul E Murphy via Libc-alpha
2020-03-27 21:17 ` [PATCH v2 07/10] powerpc64le: bump binutils version requirement to >= 2.26 Paul E. Murphy via Libc-alpha
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 via Libc-alpha
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 via Libc-alpha
2020-04-03 20:38   ` Adhemerval Zanella via Libc-alpha
2020-04-07 19:57     ` Paul E Murphy via Libc-alpha
2020-03-27 21:18 ` [PATCH v2 10/10] powerpc64le: Enable support for IEEE long double Paul E. Murphy via Libc-alpha

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).