public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 05/13] powerpc64le: link tests against ld.so
  2020-03-06 20:37 [PATCH 00/13] Enable IEEE binary128 long double on powerpc64le Paul E. Murphy
                   ` (6 preceding siblings ...)
  2020-03-06 20:37 ` [PATCH 04/13] powerpc64le: Ensure correct ldouble compiler flags are used Paul E. Murphy
@ 2020-03-06 20:37 ` Paul E. Murphy
       [not found]   ` <alpine.DEB.2.21.2003070026090.26274@digraph.polyomino.org.uk>
  2020-03-06 20:37 ` [PATCH 01/13] ldbl-128ibm-compat: PLT redirects for using ldbl redirects internally Paul E. Murphy
                   ` (4 subsequent siblings)
  12 siblings, 1 reply; 30+ messages in thread
From: Paul E. Murphy @ 2020-03-06 20:37 UTC (permalink / raw)
  To: libc-alpha

From: "Gabriel F. T. Gomes" <gabriel@inconstante.eti.br>

As noted in the following commit

commit 91ac3a7d8474480685632cd25f844d3154c69fdf
Author: Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
Date:   Mon Jul 17 17:48:59 2017 -0300

    powerpc: Fix float128 IFUNC relocations [BZ #21707]

libgcc depends on a symbol, __parse_hwcap_and_convert_at_platform,
provided by the loaders.  This dependency reflected on the need to link
some float128 tests against the loader.

In preparation for the transition of the format of long double - from
IBM Extended Precision to IEEE 754 128-bits floating-point - on
powerpc64le, this patch adds the linking of the loader to the tests for
long double, since after the switch they will also depend on
__parse_hwcap_and_convert_at_platform.

Tested on powerpc64le.
---
 sysdeps/powerpc/powerpc64/le/Makefile | 55 ++++++++++++++++++++++-----
 1 file changed, 45 insertions(+), 10 deletions(-)

diff --git a/sysdeps/powerpc/powerpc64/le/Makefile b/sysdeps/powerpc/powerpc64/le/Makefile
index 480e113637..ee2b78bb5f 100644
--- a/sysdeps/powerpc/powerpc64/le/Makefile
+++ b/sysdeps/powerpc/powerpc64/le/Makefile
@@ -35,12 +35,29 @@ 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 test, \
-	  test-float128% test-ifloat128% test-float64x% test-ifloat64x% \
+$(foreach test,\
+	  basic-test \
+	  bug-nextafter \
+	  bug-nexttoward \
+	  test-fenv-clear \
+	  test-iszero-excess-precision \
+	  test-math-iscanonical \
+	  test-math-iseqsig \
+	  test-math-issignaling \
+	  test-math-iszero \
+	  test-misc \
+	  test-nan-overflow \
+	  test-nan-payload \
+	  test-snan \
+	  test-tgmath \
+	  test-tgmath2 \
+	  tst-CMPLX2 \
+	  test-%-ldbl-128ibm \
+	  test-ldouble% test-ildouble% \
+	  test-float128% test-ifloat128% \
+	  test-float64x% test-ifloat64x% \
 	  $(foreach pair,$(f128-pairs),test-$(pair)%) \
-	  test-math-iscanonical test-math-iseqsig test-math-issignaling \
-	  test-math-iszero, \
-	  $(objpfx)$(test)): \
+	  ,$(objpfx)$(test)): \
   gnulib-tests += $(f128-loader-link)
 
 CFLAGS-s_logbl-power7.c += $(type-ldouble-CFLAGS)
@@ -99,11 +116,23 @@ 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 test,bug-strtod bug-strtod2 bug-strtod2 tst-strtod-round \
-tst-wcstod-round tst-strtod6 tst-strrom tst-strfrom-locale \
-tst-strtod-nan-locale tst-wcstod-nan-locale \
-strfrom-skeleton tst-strtod-nan-sign tst-wcstod-nan-sign, \
-$(objpfx)$(test)): gnulib-tests += $(f128-loader-link)
+
+$(foreach test, \
+	  bug-strtod \
+	  bug-strtod2 \
+	  strfrom-skeleton \
+	  tst-strfrom-locale \
+	  tst-strrom \
+	  tst-strtod \
+	  tst-strtod-nan-locale \
+	  tst-strtod-nan-sign \
+	  tst-strtod-round \
+	  tst-strtod6 \
+	  tst-wcstod-nan-locale \
+	  tst-wcstod-nan-sign \
+	  tst-wcstod-round \
+	  ,$(objpfx)$(test)): \
+  gnulib-tests += $(f128-loader-link)
 
 # 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
@@ -124,6 +153,12 @@ ifeq ($(subdir),stdio-common)
 CFLAGS-printf_fp.c = -mfloat128
 CFLAGS-printf_fphex.c = -mfloat128
 CFLAGS-printf_size.c = -mfloat128
+$(foreach test, \
+	  tst-sprintf2 \
+	  tst-sprintf3 \
+	  tstdiomisc \
+	  ,$(objpfx)$(test)): \
+  gnulib-tests += $(f128-loader-link)
 endif
 
 
-- 
2.21.1

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

* [PATCH 10/13] powerpc64le: raise GCC requirement to 7.3 for long double transition
  2020-03-06 20:37 [PATCH 00/13] Enable IEEE binary128 long double on powerpc64le Paul E. Murphy
@ 2020-03-06 20:37 ` Paul E. Murphy
  2020-03-06 20:37 ` [PATCH 08/13] powerpc64le: Enforce -mabi=ibmlongdouble when -mfloat128 used Paul E. Murphy
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 30+ messages in thread
From: Paul E. Murphy @ 2020-03-06 20:37 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..4344e30a93 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.3 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 77631ca707..755c61e334 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..a396308561 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 -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	[flat|nested] 30+ messages in thread

* [PATCH 01/13] ldbl-128ibm-compat: PLT redirects for using ldbl redirects internally
  2020-03-06 20:37 [PATCH 00/13] Enable IEEE binary128 long double on powerpc64le Paul E. Murphy
                   ` (7 preceding siblings ...)
  2020-03-06 20:37 ` [PATCH 05/13] powerpc64le: link tests against ld.so Paul E. Murphy
@ 2020-03-06 20:37 ` Paul E. Murphy
  2020-03-16 17:29   ` Paul E Murphy
  2020-03-24 18:28   ` Tulio Magno Quites Machado Filho
  2020-03-06 20:37 ` [PATCH 09/13] powerpc64le: workaround ieee long double / _Float128 stdc++ bug Paul E. Murphy
                   ` (3 subsequent siblings)
  12 siblings, 2 replies; 30+ messages in thread
From: Paul E. Murphy @ 2020-03-06 20:37 UTC (permalink / raw)
  To: libc-alpha

Tweak the PLT bypass magic when building glibc with long double
redirects.  This is made more difficult by the fact we only get
one chance to redirect functions.  This happens via the public
headers.

There are roughly three classes of redirect we need to attend to
today:

 1. Simple redirects, redirected via cdef macro overrides and
    and new libc_hidden_ldbl_proto macro.
 2. Internal usage of internal API, e.g __snprintf, which has
    no direct analogue.  This is bypassed directly on case-by-
    case basis.
 3. Double redirects, e.g sscanf and related.  These require
    a heavier handed approach of macro renaming to existing
    symbols.

Most simple redirects are handled via 1.  Ideally, the libc_*
macro would live in libc-symbols.h, but in practice the macros
needed for it to do anything useful live in cdefs.h, so they
are defined in the local override.

Notably, the internal name of the asprintf generated for ieee ldbl
redirects is renamed to work with internal prefixed usage.

This resolves the local plt usage introduced when building glibc
with ldbl == ieee128 on ppc64le.
---
 include/err.h                                 | 12 ++---
 include/libc-symbols.h                        |  2 +
 include/stdio.h                               | 52 +++++++++++++------
 include/sys/cdefs.h                           | 20 +++++++
 include/sys/syslog.h                          |  2 +-
 include/wchar.h                               |  2 +-
 .../ldbl-128ibm-compat/ieee128-asprintf.c     |  5 +-
 .../ldbl-128ibm-compat/ieee128-dprintf.c      |  1 +
 .../ieee754/ldbl-128ibm-compat/ieee128-err.c  |  7 +++
 .../ldbl-128ibm-compat/ieee128-fprintf.c      |  1 +
 .../ieee128-isoc99_sscanf.c                   |  1 +
 .../ieee128-isoc99_vfscanf.c                  |  2 +
 .../ieee128-isoc99_vsscanf.c                  |  1 +
 .../ldbl-128ibm-compat/ieee128-sprintf.c      |  1 +
 .../ldbl-128ibm-compat/ieee128-syslog.c       |  1 +
 .../ldbl-128ibm-compat/ieee128-vfprintf.c     |  1 +
 .../ldbl-128ibm/include/bits/iscanonical.h    |  2 +-
 17 files changed, 87 insertions(+), 26 deletions(-)

diff --git a/include/err.h b/include/err.h
index 7c05cd1dbb..b9b7516287 100644
--- a/include/err.h
+++ b/include/err.h
@@ -12,12 +12,12 @@ __vwarn_internal (const char *format, __gnuc_va_list ap,
 
 # ifndef _ISOMAC
 
-libc_hidden_proto (warn)
-libc_hidden_proto (warnx)
-libc_hidden_proto (vwarn)
-libc_hidden_proto (vwarnx)
-libc_hidden_proto (verr)
-libc_hidden_proto (verrx)
+libc_hidden_ldbl_proto (warn)
+libc_hidden_ldbl_proto (warnx)
+libc_hidden_ldbl_proto (vwarn)
+libc_hidden_ldbl_proto (vwarnx)
+libc_hidden_ldbl_proto (verr)
+libc_hidden_ldbl_proto (verrx)
 
 # endif /* !_ISOMAC */
 #endif /* err.h */
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index b0b75a087e..3555cb6f3d 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -885,6 +885,8 @@ for linking")
 #define libc_hidden_builtin_def(name) libc_hidden_def (name)
 #define libc_hidden_builtin_weak(name) libc_hidden_weak (name)
 #define libc_hidden_builtin_ver(local, name) libc_hidden_ver (local, name)
+
+#define libc_hidden_ldbl_proto(name, attrs...) libc_hidden_proto (name, ##attrs)
 #ifdef __ASSEMBLER__
 # define HIDDEN_BUILTIN_JUMPTARGET(name) HIDDEN_JUMPTARGET(name)
 #endif
diff --git a/include/stdio.h b/include/stdio.h
index dffa7765dd..6718af4108 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -9,13 +9,24 @@
 
 /* Now define the internal interfaces.  */
 
+/*  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)
+#  define stdio_hidden_ldbl_proto(p, f) \
+  extern __typeof (p ## f) p ## f __asm (__ASMNAME ("___ieee128_" #f));
+# elif __LONG_DOUBLE_USES_FLOAT128 == 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)
+# endif
+
 extern int __fcloseall (void) attribute_hidden;
 extern int __snprintf (char *__restrict __s, size_t __maxlen,
 		       const char *__restrict __format, ...)
      __attribute__ ((__format__ (__printf__, 3, 4)));
-#  if __LONG_DOUBLE_USES_FLOAT128 == 0
-libc_hidden_proto (__snprintf)
-#  endif
+stdio_hidden_ldbl_proto (__, snprintf)
+
 extern int __vfscanf (FILE *__restrict __s,
 		      const char *__restrict __format,
 		      __gnuc_va_list __arg)
@@ -66,6 +77,7 @@ extern int __isoc99_vscanf (const char *__restrict __format,
 extern int __isoc99_vsscanf (const char *__restrict __s,
 			     const char *__restrict __format,
 			     __gnuc_va_list __arg) __THROW;
+
 libc_hidden_proto (__isoc99_sscanf)
 libc_hidden_proto (__isoc99_vsscanf)
 libc_hidden_proto (__isoc99_vfscanf)
@@ -74,12 +86,25 @@ libc_hidden_proto (__isoc99_vfscanf)
    Unfortunately, symbol redirection is not transitive, so the
    __REDIRECT in the public header does not link up with the above
    libc_hidden_proto.  Bridge the gap with a macro.  */
-#  if !__GLIBC_USE (DEPRECATED_SCANF) \
-      && __LONG_DOUBLE_USES_FLOAT128 == 0
+#  if !__GLIBC_USE (DEPRECATED_SCANF)
 #   undef sscanf
 #   define sscanf __isoc99_sscanf
 #  endif
 
+#  if __LONG_DOUBLE_USES_FLOAT128 == 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;
+extern __typeof (__isoc99_vsscanf) ___ieee128_isoc99_vsscanf __THROW;
+extern __typeof (__isoc99_vfscanf) ___ieee128_isoc99_vfscanf __THROW;
+libc_hidden_proto (___ieee128_isoc99_sscanf)
+libc_hidden_proto (___ieee128_isoc99_vsscanf)
+libc_hidden_proto (___ieee128_isoc99_vfscanf)
+#define __isoc99_sscanf ___ieee128_isoc99_sscanf
+#define __isoc99_vsscanf ___ieee128_isoc99_vsscanf
+#define __isoc99_vfscanf ___ieee128_isoc99_vfscanf
+#  endif
+
 /* Prototypes for compatibility functions.  */
 extern FILE *__new_tmpfile (void);
 extern FILE *__old_tmpfile (void);
@@ -153,9 +178,8 @@ libc_hidden_proto (__libc_readline_unlocked);
 extern const char *const _sys_errlist_internal[] attribute_hidden;
 extern int _sys_nerr_internal attribute_hidden;
 
-#if __LONG_DOUBLE_USES_FLOAT128 == 0
-libc_hidden_proto (__asprintf)
-#endif
+libc_hidden_ldbl_proto (__asprintf)
+
 #  if IS_IN (libc)
 extern FILE *_IO_new_fopen (const char*, const char*);
 #   define fopen(fname, mode) _IO_new_fopen (fname, mode)
@@ -178,13 +202,11 @@ extern int _IO_new_fgetpos (FILE *, __fpos_t *);
 
 extern __typeof (dprintf) __dprintf
      __attribute__ ((__format__ (__printf__, 2, 3)));
-libc_hidden_proto (__dprintf)
-#if __LONG_DOUBLE_USES_FLOAT128 == 0
-libc_hidden_proto (dprintf)
-libc_hidden_proto (fprintf)
-libc_hidden_proto (vfprintf)
-libc_hidden_proto (sprintf)
-#endif
+stdio_hidden_ldbl_proto (__, dprintf)
+libc_hidden_ldbl_proto (dprintf)
+libc_hidden_ldbl_proto (fprintf)
+libc_hidden_ldbl_proto (vfprintf)
+libc_hidden_ldbl_proto (sprintf)
 libc_hidden_proto (fwrite)
 libc_hidden_proto (perror)
 libc_hidden_proto (remove)
diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h
index 524fe57a25..9f44ac5a0a 100644
--- a/include/sys/cdefs.h
+++ b/include/sys/cdefs.h
@@ -13,6 +13,26 @@ extern void __chk_fail (void) __attribute__ ((__noreturn__));
 libc_hidden_proto (__chk_fail)
 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
+
+# undef __LDBL_REDIR_DECL
+# define __LDBL_REDIR_DECL(func) \
+   extern __typeof(func) func __asm (__ASMNAME ("__GI____ieee128_" #func));
+
+# undef libc_hidden_ldbl_proto
+# define libc_hidden_ldbl_proto(func, attrs...) \
+   extern __typeof(func) ___ieee128_ ## func; \
+   libc_hidden_proto (___ieee128_ ## func, ##attrs);
+
+# undef __LDBL_REDIR2_DECL
+# define __LDBL_REDIR2_DECL(func) \
+   extern __typeof(__ ## func) __ ## func __asm (__ASMNAME ("__GI____ieee128___" #func));
+
 #endif
 
+#endif /* !defined _ISOMAC */
+
 #endif
diff --git a/include/sys/syslog.h b/include/sys/syslog.h
index 89d3479ebc..44422eab13 100644
--- a/include/sys/syslog.h
+++ b/include/sys/syslog.h
@@ -3,7 +3,7 @@
 #include <misc/sys/syslog.h>
 #ifndef _ISOMAC
 
-libc_hidden_proto (syslog)
+libc_hidden_ldbl_proto (syslog)
 
 /* __vsyslog_internal uses the same mode_flags bits as
    __v*printf_internal; see libio/libioP.h.  */
diff --git a/include/wchar.h b/include/wchar.h
index c792b38943..617906eb14 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -64,7 +64,7 @@ libc_hidden_proto (__wcstoul_internal)
 libc_hidden_proto (__wcstoull_internal)
 libc_hidden_proto (wcstof)
 libc_hidden_proto (wcstod)
-libc_hidden_proto (wcstold)
+libc_hidden_ldbl_proto (wcstold)
 libc_hidden_proto (wcstol)
 libc_hidden_proto (wcstoll)
 libc_hidden_proto (wcstoul)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
index 68cafbb2fa..2a6ed2f813 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
@@ -20,7 +20,7 @@
 #include <libio/libioP.h>
 
 extern int
-___ieee128_asprintf (char **string_ptr, const char *format, ...)
+___ieee128___asprintf (char **string_ptr, const char *format, ...)
 {
   va_list ap;
   int done;
@@ -32,4 +32,5 @@ ___ieee128_asprintf (char **string_ptr, const char *format, ...)
 
   return done;
 }
-strong_alias (___ieee128_asprintf, __asprintfieee128)
+hidden_def (___ieee128___asprintf)
+strong_alias (___ieee128___asprintf, __asprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
index 9dc65309bd..87440c9850 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
@@ -32,3 +32,4 @@ ___ieee128_dprintf (int d, const char *format, ...)
   return done;
 }
 strong_alias (___ieee128_dprintf, __dprintfieee128)
+hidden_def (___ieee128_dprintf);
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-err.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-err.c
index eae071b9c4..f81d3edcbf 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-err.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-err.c
@@ -91,3 +91,10 @@ IEEE128_DECL (errx) (int status, const char *format, ...)
   VA (verrx (status, format, ap))
 }
 IEEE128_ALIAS (errx)
+
+hidden_def (___ieee128_warn)
+hidden_def (___ieee128_warnx)
+hidden_def (___ieee128_vwarn)
+hidden_def (___ieee128_vwarnx)
+hidden_def (___ieee128_verr)
+hidden_def (___ieee128_verrx)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
index e1c989643e..b05e6f1bc6 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
@@ -32,3 +32,4 @@ ___ieee128_fprintf (FILE *fp, const char *format, ...)
   return done;
 }
 strong_alias (___ieee128_fprintf, __fprintfieee128)
+hidden_def (___ieee128_fprintf)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-isoc99_sscanf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-isoc99_sscanf.c
index bfc7270a78..cd1c9fa333 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-isoc99_sscanf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-isoc99_sscanf.c
@@ -37,3 +37,4 @@ ___ieee128_isoc99_sscanf (const char *string, const char *format, ...)
   return done;
 }
 strong_alias (___ieee128_isoc99_sscanf, __isoc99_sscanfieee128)
+hidden_def (___ieee128_isoc99_sscanf)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-isoc99_vfscanf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-isoc99_vfscanf.c
index b561fa3044..2a11f49ea6 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-isoc99_vfscanf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-isoc99_vfscanf.c
@@ -17,6 +17,7 @@
    <https://www.gnu.org/licenses/>.  */
 
 #include <libio/libioP.h>
+#include <stdio.h>
 
 extern int
 ___ieee128_isoc99_vfscanf (FILE *fp, const char *format, va_list ap)
@@ -25,3 +26,4 @@ ___ieee128_isoc99_vfscanf (FILE *fp, const char *format, va_list ap)
   return __vfscanf_internal (fp, format, ap, mode_flags);
 }
 strong_alias (___ieee128_isoc99_vfscanf, __isoc99_vfscanfieee128)
+hidden_def (___ieee128_isoc99_vfscanf)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-isoc99_vsscanf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-isoc99_vsscanf.c
index bef6ebcce0..d976cdbe1f 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-isoc99_vsscanf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-isoc99_vsscanf.c
@@ -28,3 +28,4 @@ ___ieee128_isoc99_vsscanf (const char *string, const char *format, va_list ap)
   return __vfscanf_internal (fp, format, ap, mode_flags);
 }
 strong_alias (___ieee128_isoc99_vsscanf, __isoc99_vsscanfieee128)
+hidden_def (___ieee128_isoc99_vsscanf)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
index 52088cd576..690dc3abf1 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
@@ -33,3 +33,4 @@ ___ieee128_sprintf (char *s, const char *format, ...)
   return done;
 }
 strong_alias (___ieee128_sprintf, __sprintfieee128)
+hidden_def (___ieee128_sprintf)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-syslog.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-syslog.c
index 914f24aebd..4af546326c 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-syslog.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-syslog.c
@@ -30,6 +30,7 @@ ___ieee128_syslog (int pri, const char *fmt, ...)
   va_end (ap);
 }
 strong_alias (___ieee128_syslog, __syslogieee128)
+hidden_def (___ieee128_syslog)
 
 void
 ___ieee128_vsyslog (int pri, const char *fmt, va_list ap)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
index 234cd9de8d..b407eae969 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
@@ -24,3 +24,4 @@ ___ieee128_vfprintf (FILE *fp, const char *format, va_list ap)
   return __vfprintf_internal (fp, format, ap, PRINTF_LDBL_USES_FLOAT128);
 }
 strong_alias (___ieee128_vfprintf, __vfprintfieee128)
+hidden_def (___ieee128_vfprintf)
diff --git a/sysdeps/ieee754/ldbl-128ibm/include/bits/iscanonical.h b/sysdeps/ieee754/ldbl-128ibm/include/bits/iscanonical.h
index bee080bd29..8cbd6f74bf 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>
 
-#ifndef _ISOMAC
+#if !defined _ISOMAC && (__LONG_DOUBLE_USES_FLOAT128 == 0)
 libm_hidden_proto (__iscanonicall)
 #endif
-- 
2.21.1

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

* [PATCH 06/13] powerpc64le: add -mno-gnu-attribute to *f128 objects and difftime
  2020-03-06 20:37 [PATCH 00/13] Enable IEEE binary128 long double on powerpc64le Paul E. Murphy
                   ` (2 preceding siblings ...)
  2020-03-06 20:37 ` [PATCH 12/13] powerpc64le: enforce non-specific long double in .gnu.attributes section Paul E. Murphy
@ 2020-03-06 20:37 ` Paul E. Murphy
  2020-03-24 20:42   ` Tulio Magno Quites Machado Filho
  2020-03-06 20:37 ` [PATCH 02/13] Fix tests which expose ldbl -> _Float128 redirects Paul E. Murphy
                   ` (8 subsequent siblings)
  12 siblings, 1 reply; 30+ messages in thread
From: Paul E. Murphy @ 2020-03-06 20:37 UTC (permalink / raw)
  To: libc-alpha

In practice, this flag should be applied globally, but it makes a good
sanity check to ensure ibm128 and ieee128 long double files are not
getting mismatched.  _Float128 files use no long double, thus are
always safe to use this option.

Similarly, when investigating the linker complaints, difftime
makes trivial, self contained, usage of long double, so thus it
is also explicitly marked as such.
---
 sysdeps/powerpc/powerpc64/le/Makefile         | 21 ++++++++++++-------
 .../powerpc64/le/fpu/multiarch/Makefile       |  4 ++--
 2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/sysdeps/powerpc/powerpc64/le/Makefile b/sysdeps/powerpc/powerpc64/le/Makefile
index ee2b78bb5f..f23e2782f0 100644
--- a/sysdeps/powerpc/powerpc64/le/Makefile
+++ b/sysdeps/powerpc/powerpc64/le/Makefile
@@ -9,8 +9,10 @@ f128-loader-link = -Wl,--as-needed $(elf-objpfx)ld.so -Wl,--no-as-needed
 # Bootstrapping code for enabling IEEE 128.  This can be removed and
 # any indirections simplified once IEEE 128 long double is enabled.
 type-ldouble-CFLAGS =
+no-gnu-attribute-CFLAGS =
 ifeq ($(ibm128-fcts),yes)
 type-ldouble-CFLAGS += -mabi=ibmlongdouble
+no-gnu-attribute-CFLAGS = -mno-gnu-attribute
 endif
 
 ifeq ($(subdir),math)
@@ -18,8 +20,9 @@ ifeq ($(subdir),math)
 CPPFLAGS += -I../soft-fp
 
 # float128 requires adding a handful of extra flags.
-$(foreach suf,$(all-object-suffixes),%f128$(suf)): CFLAGS += -mfloat128
-$(foreach suf,$(all-object-suffixes),%f128_r$(suf)): CFLAGS += -mfloat128
+# 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),$(objpfx)test-ifloat128%$(suf)): CFLAGS += -mfloat128
@@ -99,11 +102,11 @@ endif
 
 # Append flags to string <-> _Float128 routines.
 ifneq ($(filter $(subdir),wcsmbs stdlib),)
-$(foreach suf,$(all-object-suffixes),%f128$(suf)): CFLAGS += -mfloat128
-$(foreach suf,$(all-object-suffixes),%f128_l$(suf)): CFLAGS += -mfloat128
-$(foreach suf,$(all-object-suffixes),%f128_nan$(suf)): CFLAGS += -mfloat128
-$(foreach suf,$(all-object-suffixes),%float1282mpn$(suf)): CFLAGS += -mfloat128
-$(foreach suf,$(all-object-suffixes),%mpn2float128$(suf)): CFLAGS += -mfloat128
+$(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
@@ -161,6 +164,10 @@ $(foreach test, \
   gnulib-tests += $(f128-loader-link)
 endif
 
+# Disable linker noise on files using ieee128 long double internally
+ifeq ($(subdir),time)
+CFLAGS-difftime.c = $(no-gnu-attribute-CFLAGS)
+endif
 
 $(foreach suf,$(all-object-suffixes),$(objpfx)nldbl-%$(suf)): \
   CFLAGS += $(type-ldouble-CFLAGS)
diff --git a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/Makefile
index a32f3d8b81..c6ca872a4b 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
-CFLAGS-w_sqrtf128-power9.c += -mfloat128 -mcpu=power9
+CFLAGS-w_sqrtf128-ppc64le.c += -mfloat128 $(no-gnu-attribute-CFLAGS)
+CFLAGS-w_sqrtf128-power9.c += -mfloat128 -mcpu=power9 $(no-gnu-attribute-CFLAGS)
 endif
-- 
2.21.1

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

* [PATCH 04/13] powerpc64le: Ensure correct ldouble compiler flags are used
  2020-03-06 20:37 [PATCH 00/13] Enable IEEE binary128 long double on powerpc64le Paul E. Murphy
                   ` (5 preceding siblings ...)
  2020-03-06 20:37 ` [PATCH 11/13] powerpc64le: bump binutils version requirement to >= 2.26 Paul E. Murphy
@ 2020-03-06 20:37 ` Paul E. Murphy
  2020-03-24 20:32   ` Tulio Magno Quites Machado Filho
  2020-03-06 20:37 ` [PATCH 05/13] powerpc64le: link tests against ld.so Paul E. Murphy
                   ` (5 subsequent siblings)
  12 siblings, 1 reply; 30+ messages in thread
From: Paul E. Murphy @ 2020-03-06 20:37 UTC (permalink / raw)
  To: libc-alpha

From: "Gabriel F. T. Gomes" <gabriel@inconstante.eti.br>

Ensure the correct ldouble abi flags are applied to ibm128 files and
nldbl files.  Remove the IEEE options if used, and apply the flags
used to build ldouble files which are ibm128 abi.

nldbl tests are a little tricky.  To use the support, we must remove
all ldouble abi flags, and ensure -mlong-double-64 is used.

Co-authored-by: Rajalakshmi Srinivasaraghavan  <raji@linux.vnet.ibm.com>
Co-authored-by: Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>
Co-authored-by: Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
---
 sysdeps/powerpc/powerpc64/le/Makefile | 58 +++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/sysdeps/powerpc/powerpc64/le/Makefile b/sysdeps/powerpc/powerpc64/le/Makefile
index 0ce3868c3c..480e113637 100644
--- a/sysdeps/powerpc/powerpc64/le/Makefile
+++ b/sysdeps/powerpc/powerpc64/le/Makefile
@@ -6,6 +6,13 @@
 # linked executables, forcing to link the loader after libgcc link.
 f128-loader-link = -Wl,--as-needed $(elf-objpfx)ld.so -Wl,--no-as-needed
 
+# Bootstrapping code for enabling IEEE 128.  This can be removed and
+# any indirections simplified once IEEE 128 long double is enabled.
+type-ldouble-CFLAGS =
+ifeq ($(ibm128-fcts),yes)
+type-ldouble-CFLAGS += -mabi=ibmlongdouble
+endif
+
 ifeq ($(subdir),math)
 # sqrtf128 requires emulation before POWER9.
 CPPFLAGS += -I../soft-fp
@@ -35,6 +42,42 @@ $(foreach test, \
 	  test-math-iszero, \
 	  $(objpfx)$(test)): \
   gnulib-tests += $(f128-loader-link)
+
+CFLAGS-s_logbl-power7.c += $(type-ldouble-CFLAGS)
+CFLAGS-s_logbl-ppc64.c += $(type-ldouble-CFLAGS)
+
+$(foreach suf,$(all-object-suffixes),\
+          $(objpfx)s_copysignl$(suf) \
+          $(objpfx)s_fabsl$(suf)): \
+  ASFLAGS += $(type-ldouble-CFLAGS)
+
+$(foreach suf,$(all-object-suffixes),\
+         $(objpfx)libm-test-%ibm128$(suf) \
+         $(objpfx)test-iibm128%$(suf) $(objpfx)test-ibm128%$(suf)): \
+  CFLAGS += $(type-ldouble-CFLAGS)
+
+# Newer GCC (>7) doesn't like -mabi=* and -mlong-double-64
+$(foreach suf,$(all-object-suffixes),\
+         $(objpfx)test-narrow-macros-ldbl-64$(suf) \
+         $(objpfx)test-nldbl-redirect$(suf) \
+         $(objpfx)test-redirection-ldbl-64$(suf) \
+         ): sysdep-CFLAGS := $(filter-out -mabi=ieeelongdouble,$(sysdep-CFLAGS))
+
+endif
+
+# Newer GCC (>7) doesn't like -mabi=* and -mlong-double-64
+ifeq ($(subdir),misc)
+$(foreach suf,$(all-object-suffixes),\
+         $(objpfx)tst-nldbl-warn$(suf) \
+         $(objpfx)tst-nldbl-error$(suf) \
+         ): sysdep-CFLAGS := $(filter-out -mabi=ieeelongdouble,$(sysdep-CFLAGS))
+endif
+
+# Newer GCC (>7) doesn't like -mabi=* and -mlong-double-64
+ifeq ($(subdir),argp)
+$(foreach suf,$(all-object-suffixes),\
+         $(objpfx)tst-nldbl-argp$(suf) \
+         ): sysdep-CFLAGS := $(filter-out -mabi=ieeelongdouble,$(sysdep-CFLAGS))
 endif
 
 # Append flags to string <-> _Float128 routines.
@@ -82,3 +125,18 @@ CFLAGS-printf_fp.c = -mfloat128
 CFLAGS-printf_fphex.c = -mfloat128
 CFLAGS-printf_size.c = -mfloat128
 endif
+
+
+$(foreach suf,$(all-object-suffixes),$(objpfx)nldbl-%$(suf)): \
+  CFLAGS += $(type-ldouble-CFLAGS)
+
+ldbl-ibm128-files = $(objpfx)nldbl-%$(suf) \
+		    $(objpfx)libm-test-%ibm128$(suf) \
+		    $(objpfx)test-iibm128%$(suf) $(objpfx)test-ibm128%$(suf) \
+		    $(objpfx)test-tgmath3-%$(suf)
+
+# Remove -mabi=ieeelongdouble from ldbl-ibm128 files.
+$(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))
-- 
2.21.1

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

* [PATCH 00/13] Enable IEEE binary128 long double on powerpc64le
@ 2020-03-06 20:37 Paul E. Murphy
  2020-03-06 20:37 ` [PATCH 10/13] powerpc64le: raise GCC requirement to 7.3 for long double transition Paul E. Murphy
                   ` (12 more replies)
  0 siblings, 13 replies; 30+ messages in thread
From: Paul E. Murphy @ 2020-03-06 20:37 UTC (permalink / raw)
  To: libc-alpha

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 (3):
  powerpc64le: Ensure correct ldouble compiler flags are used
  powerpc64le: link tests against ld.so
  powerpc64le: Enable support for IEEE long double

Paul E. Murphy (10):
  ldbl-128ibm-compat: PLT redirects for using ldbl redirects internally
  Fix tests which expose ldbl -> _Float128 redirects
  RFC: ldbl-128ibm-compat: workaround C++ redirect limitations
  powerpc64le: add -mno-gnu-attribute to *f128 objects and difftime
  powerpc64: apply -mabi=ibmlongdouble to special files
  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

 INSTALL                                       |   5 +
 NEWS                                          |   8 +-
 elf/tst-addr1.c                               |  11 +
 include/err.h                                 |  12 +-
 include/libc-symbols.h                        |   2 +
 include/monetary.h                            |   8 +
 include/printf.h                              |   8 +
 include/stdio.h                               |  62 +++--
 include/stdlib.h                              |   9 +
 include/sys/cdefs.h                           |  20 ++
 include/sys/syslog.h                          |   2 +-
 include/wchar.h                               |  11 +-
 manual/install.texi                           |   9 +
 stdio-common/tst-vfprintf-user-type.c         |   4 +
 .../ldbl-128ibm-compat/ieee128-asprintf.c     |   5 +-
 .../ldbl-128ibm-compat/ieee128-dprintf.c      |   1 +
 .../ieee754/ldbl-128ibm-compat/ieee128-err.c  |   7 +
 .../ldbl-128ibm-compat/ieee128-fprintf.c      |   1 +
 .../ieee128-isoc99_sscanf.c                   |   1 +
 .../ieee128-isoc99_vfscanf.c                  |   2 +
 .../ieee128-isoc99_vsscanf.c                  |   1 +
 .../ldbl-128ibm-compat/ieee128-sprintf.c      |   1 +
 .../ldbl-128ibm-compat/ieee128-syslog.c       |   1 +
 .../ldbl-128ibm-compat/ieee128-vfprintf.c     |   1 +
 .../ldbl-128ibm/include/bits/iscanonical.h    |   2 +-
 sysdeps/powerpc/fpu/libm-test-ulps            |   8 +
 sysdeps/powerpc/powerpc64/Makefile            |   6 +
 sysdeps/powerpc/powerpc64/le/Implies-before   |   1 +
 sysdeps/powerpc/powerpc64/le/Makefile         | 251 ++++++++++++++----
 sysdeps/powerpc/powerpc64/le/configure        | 124 +++++++++
 sysdeps/powerpc/powerpc64/le/configure.ac     |  41 +++
 .../powerpc64/le/fpu/multiarch/Makefile       |   4 +-
 .../powerpc64/le/no_ldbl_gnu_attribute.c      |  30 +++
 sysdeps/powerpc/powerpc64/power7/Makefile     |   6 +-
 .../powerpc64/le/ldbl-128ibm-compat-abi.h     |   8 +
 .../linux/powerpc/powerpc64/le/libc.abilist   |  93 +++++++
 .../linux/powerpc/powerpc64/le/libm.abilist   | 117 ++++++++
 37 files changed, 803 insertions(+), 80 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] 30+ messages in thread

* [PATCH 11/13] powerpc64le: bump binutils version requirement to >= 2.26
  2020-03-06 20:37 [PATCH 00/13] Enable IEEE binary128 long double on powerpc64le Paul E. Murphy
                   ` (4 preceding siblings ...)
  2020-03-06 20:37 ` [PATCH 02/13] Fix tests which expose ldbl -> _Float128 redirects Paul E. Murphy
@ 2020-03-06 20:37 ` Paul E. Murphy
  2020-03-06 20:37 ` [PATCH 04/13] powerpc64le: Ensure correct ldouble compiler flags are used Paul E. Murphy
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 30+ messages in thread
From: Paul E. Murphy @ 2020-03-06 20:37 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.
---
 NEWS                                      |  4 +-
 manual/install.texi                       |  4 ++
 sysdeps/powerpc/powerpc64/le/configure    | 65 +++++++++++++++++++++++
 sysdeps/powerpc/powerpc64/le/configure.ac |  6 +++
 4 files changed, 77 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index 755c61e334..4399723a7e 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 a396308561..e358242685 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 --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	[flat|nested] 30+ messages in thread

* [PATCH 09/13] powerpc64le: workaround ieee long double / _Float128 stdc++ bug
  2020-03-06 20:37 [PATCH 00/13] Enable IEEE binary128 long double on powerpc64le Paul E. Murphy
                   ` (8 preceding siblings ...)
  2020-03-06 20:37 ` [PATCH 01/13] ldbl-128ibm-compat: PLT redirects for using ldbl redirects internally Paul E. Murphy
@ 2020-03-06 20:37 ` Paul E. Murphy
  2020-03-06 20:37 ` [PATCH 03/13] RFC: ldbl-128ibm-compat: workaround C++ redirect limitations Paul E. Murphy
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 30+ messages in thread
From: Paul E. Murphy @ 2020-03-06 20:37 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 8c92331b4d..5171ad5036 100644
--- a/sysdeps/powerpc/powerpc64/le/Makefile
+++ b/sysdeps/powerpc/powerpc64/le/Makefile
@@ -193,3 +193,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	[flat|nested] 30+ messages in thread

* [PATCH 12/13] powerpc64le: enforce non-specific long double in .gnu.attributes section
  2020-03-06 20:37 [PATCH 00/13] Enable IEEE binary128 long double on powerpc64le Paul E. Murphy
  2020-03-06 20:37 ` [PATCH 10/13] powerpc64le: raise GCC requirement to 7.3 for long double transition Paul E. Murphy
  2020-03-06 20:37 ` [PATCH 08/13] powerpc64le: Enforce -mabi=ibmlongdouble when -mfloat128 used Paul E. Murphy
@ 2020-03-06 20:37 ` Paul E. Murphy
  2020-03-06 20:37 ` [PATCH 06/13] powerpc64le: add -mno-gnu-attribute to *f128 objects and difftime Paul E. Murphy
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 30+ messages in thread
From: Paul E. Murphy @ 2020-03-06 20:37 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 5171ad5036..97d21d7817 100644
--- a/sysdeps/powerpc/powerpc64/le/Makefile
+++ b/sysdeps/powerpc/powerpc64/le/Makefile
@@ -15,7 +15,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	[flat|nested] 30+ messages in thread

* [PATCH 08/13] powerpc64le: Enforce -mabi=ibmlongdouble when -mfloat128 used
  2020-03-06 20:37 [PATCH 00/13] Enable IEEE binary128 long double on powerpc64le Paul E. Murphy
  2020-03-06 20:37 ` [PATCH 10/13] powerpc64le: raise GCC requirement to 7.3 for long double transition Paul E. Murphy
@ 2020-03-06 20:37 ` Paul E. Murphy
       [not found]   ` <alpine.DEB.2.21.2003070033530.26274@digraph.polyomino.org.uk>
  2020-03-06 20:37 ` [PATCH 12/13] powerpc64le: enforce non-specific long double in .gnu.attributes section Paul E. Murphy
                   ` (10 subsequent siblings)
  12 siblings, 1 reply; 30+ messages in thread
From: Paul E. Murphy @ 2020-03-06 20:37 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.

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         | 90 ++++++++++---------
 .../powerpc64/le/fpu/multiarch/Makefile       |  4 +-
 2 files changed, 52 insertions(+), 42 deletions(-)

diff --git a/sysdeps/powerpc/powerpc64/le/Makefile b/sysdeps/powerpc/powerpc64/le/Makefile
index f9dd44c1a2..8c92331b4d 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
 
 # libgcc requires __tcb_parse_hwcap_and_convert_at_platform when built with
 # a binary128 type.  That symbol is provided by the loader on dynamically
@@ -16,29 +17,34 @@ 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.
+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),$(objpfx)test-ifloat128%$(suf)): CFLAGS += -mfloat128
-$(foreach suf,$(all-object-suffixes),$(objpfx)test-ifloat64x%$(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)
+$(foreach suf,$(all-object-suffixes),$(objpfx)test-ifloat128%$(suf)): CFLAGS += $(type-float128-CFLAGS)
+$(foreach suf,$(all-object-suffixes),$(objpfx)test-ifloat64x%$(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)
 $(foreach test,\
 	  basic-test \
 	  bug-nextafter \
@@ -101,25 +107,26 @@ $(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)
 
 $(foreach test, \
 	  bug-strtod \
@@ -143,20 +150,23 @@ $(foreach test, \
 # 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)
 $(foreach test, \
 	  tst-sprintf2 \
 	  tst-sprintf3 \
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	[flat|nested] 30+ messages in thread

* [PATCH 03/13] RFC: ldbl-128ibm-compat: workaround C++ redirect limitations
  2020-03-06 20:37 [PATCH 00/13] Enable IEEE binary128 long double on powerpc64le Paul E. Murphy
                   ` (9 preceding siblings ...)
  2020-03-06 20:37 ` [PATCH 09/13] powerpc64le: workaround ieee long double / _Float128 stdc++ bug Paul E. Murphy
@ 2020-03-06 20:37 ` Paul E. Murphy
  2020-03-24 20:30   ` Tulio Magno Quites Machado Filho
  2020-03-06 20:52 ` [PATCH 13/13] powerpc64le: Enable support for IEEE long double Paul E. Murphy
       [not found] ` <20200306203721.15886-8-murphyp@linux.vnet.ibm.com>
  12 siblings, 1 reply; 30+ messages in thread
From: Paul E. Murphy @ 2020-03-06 20:37 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.

Does a better option than explicitly specifying these headers via
the #pragma GCC system_header?
---
 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	[flat|nested] 30+ messages in thread

* [PATCH 02/13] Fix tests which expose ldbl -> _Float128 redirects
  2020-03-06 20:37 [PATCH 00/13] Enable IEEE binary128 long double on powerpc64le Paul E. Murphy
                   ` (3 preceding siblings ...)
  2020-03-06 20:37 ` [PATCH 06/13] powerpc64le: add -mno-gnu-attribute to *f128 objects and difftime Paul E. Murphy
@ 2020-03-06 20:37 ` Paul E. Murphy
  2020-03-13 21:37   ` Tulio Magno Quites Machado Filho
  2020-03-06 20:37 ` [PATCH 11/13] powerpc64le: bump binutils version requirement to >= 2.26 Paul E. Murphy
                   ` (7 subsequent siblings)
  12 siblings, 1 reply; 30+ messages in thread
From: Paul E. Murphy @ 2020-03-06 20:37 UTC (permalink / raw)
  To: libc-alpha

The ldbl redirects for ieee128 have some jagged edges when
inspecting and manipulating symbols directly.

e.g asprintf is unconditionally redirected to __asprintfieee128
thus any tests relying on GCC's redirect behavior will encounter
problems if they inspect the symbol names too closely.

I've mitigated tests which expose the limitations of the
ldbl -> f128 redirects by giving them knowledge about the
redirected symbol names.

Hopefully there isn't much user code which depends on this
implementation specific behavior.
---
 elf/tst-addr1.c                       | 11 +++++++++++
 stdio-common/tst-vfprintf-user-type.c |  4 ++++
 2 files changed, 15 insertions(+)

diff --git a/elf/tst-addr1.c b/elf/tst-addr1.c
index 68ff74aabd..27dc0f00f4 100644
--- a/elf/tst-addr1.c
+++ b/elf/tst-addr1.c
@@ -12,6 +12,16 @@ do_test (void)
       return 1;
     }
   printf ("found symbol %s in %s\n", i.dli_sname, i.dli_fname);
+  if (i.dli_sname == NULL)
+    return 1;
+
+#if __LONG_DOUBLE_USES_FLOAT128 == 1
+  /* On architectures which redirect long double to
+     _Float128 (e.g powerpc64le), printf will resolve
+     to __printfieee128 due to header redirects.  There
+     is no _IO_printfieee128 alias.  */
+  return strcmp (i.dli_sname, "__printfieee128") != 0;
+#else
   return i.dli_sname == NULL
 	 || (strcmp (i.dli_sname, "printf") != 0
 	     /* On architectures which create PIC code by default
@@ -20,6 +30,7 @@ do_test (void)
 		are aliased and which one comes first in the
 		hash table is up to the linker.  */
 	     && strcmp (i.dli_sname, "_IO_printf") != 0);
+#endif
 }
 
 #include <support/test-driver.c>
diff --git a/stdio-common/tst-vfprintf-user-type.c b/stdio-common/tst-vfprintf-user-type.c
index 6c840fe04b..40d714fdb1 100644
--- a/stdio-common/tst-vfprintf-user-type.c
+++ b/stdio-common/tst-vfprintf-user-type.c
@@ -147,7 +147,11 @@ do_test (void)
 
   /* Alias declaration for asprintf, to avoid the format string
      attribute and the associated warning.  */
+#if __LONG_DOUBLE_USES_FLOAT128 == 1
+  extern int asprintf_alias (char **, const char *, ...) __asm__ ("__asprintfieee128");
+#else
   extern int asprintf_alias (char **, const char *, ...) __asm__ ("asprintf");
+#endif
   TEST_VERIFY (asprintf_alias == asprintf);
   char *str = NULL;
   TEST_VERIFY (asprintf_alias (&str, "[[%P]]", 123L, 456.0) >= 0);
-- 
2.21.1

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

* [PATCH 13/13] powerpc64le: Enable support for IEEE long double
  2020-03-06 20:37 [PATCH 00/13] Enable IEEE binary128 long double on powerpc64le Paul E. Murphy
                   ` (10 preceding siblings ...)
  2020-03-06 20:37 ` [PATCH 03/13] RFC: ldbl-128ibm-compat: workaround C++ redirect limitations Paul E. Murphy
@ 2020-03-06 20:52 ` Paul E. Murphy
       [not found] ` <20200306203721.15886-8-murphyp@linux.vnet.ibm.com>
  12 siblings, 0 replies; 30+ messages in thread
From: Paul E. Murphy @ 2020-03-06 20:52 UTC (permalink / raw)
  To: libc-alpha

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

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            |   8 ++
 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, 236 insertions(+)
 create mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc64/le/ldbl-128ibm-compat-abi.h

diff --git a/NEWS b/NEWS
index 4399723a7e..c93d60ab10 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 1eec27c1dc..9c646d3f4b 100644
--- a/sysdeps/powerpc/fpu/libm-test-ulps
+++ b/sysdeps/powerpc/fpu/libm-test-ulps
@@ -2085,32 +2085,40 @@ ldouble: 1
 Function: "gamma":
 double: 3
 float: 4
+float128: 5
 idouble: 3
 ifloat: 4
+ifloat128: 5
 ildouble: 3
 ldouble: 3
 
 Function: "gamma_downward":
 double: 4
 float: 4
+float128: 8
 idouble: 4
 ifloat: 4
+ifloat128: 8
 ildouble: 15
 ldouble: 15
 
 Function: "gamma_towardzero":
 double: 4
 float: 3
+float128: 5
 idouble: 4
 ifloat: 3
+ifloat128: 5
 ildouble: 16
 ldouble: 16
 
 Function: "gamma_upward":
 double: 4
 float: 5
+float128: 8
 idouble: 4
 ifloat: 5
+ifloat128: 8
 ildouble: 11
 ldouble: 11
 
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 97d21d7817..00f7413b9b 100644
--- a/sysdeps/powerpc/powerpc64/le/Makefile
+++ b/sysdeps/powerpc/powerpc64/le/Makefile
@@ -25,6 +25,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	[flat|nested] 30+ messages in thread

* Re: [PATCH 08/13] powerpc64le: Enforce -mabi=ibmlongdouble when -mfloat128 used
       [not found]   ` <alpine.DEB.2.21.2003070033530.26274@digraph.polyomino.org.uk>
@ 2020-03-09 14:30     ` Paul E Murphy
  0 siblings, 0 replies; 30+ messages in thread
From: Paul E Murphy @ 2020-03-09 14:30 UTC (permalink / raw)
  To: Joseph Myers, Paul E. Murphy; +Cc: libc-alpha



On 3/6/20 6:35 PM, Joseph Myers wrote:
> On Fri, 6 Mar 2020, Paul E. Murphy wrote:
> 
>> +# 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.
>> +type-float128-CFLAGS += $(type-ldouble-CFLAGS)
> 
> When referencing compiler bugs in comments, please always give the bug
> number / exact reference to fixing commit or version to help us know in
> future when such code in glibc is obsolete with the minimum supported GCC
> version.  I'm guessing this is bug 84914.
> 

Ah, I see you've already met that bug.  That is the same bug.  It is 
unfortunate that it was closed as will not fix.  I have updated the
patch with the reference.

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

* Re: [PATCH 05/13] powerpc64le: link tests against ld.so
       [not found]   ` <alpine.DEB.2.21.2003070026090.26274@digraph.polyomino.org.uk>
@ 2020-03-09 22:38     ` Paul E Murphy
  2020-03-09 23:19       ` Joseph Myers
  0 siblings, 1 reply; 30+ messages in thread
From: Paul E Murphy @ 2020-03-09 22:38 UTC (permalink / raw)
  To: Joseph Myers, Paul E. Murphy; +Cc: libc-alpha



On 3/6/20 6:31 PM, Joseph Myers wrote:
> On Fri, 6 Mar 2020, Paul E. Murphy wrote:
> 
>> In preparation for the transition of the format of long double - from
>> IBM Extended Precision to IEEE 754 128-bits floating-point - on
>> powerpc64le, this patch adds the linking of the loader to the tests for
>> long double, since after the switch they will also depend on
>> __parse_hwcap_and_convert_at_platform.
> 
> I'm afraid this patch looks unmaintainable.
> 
> It adds a duplicate list of libm tests, with no obvious logic for what
> goes in that list, to an architecture-specific Makefile.  That seems like
> a recipe for patches that add a libm test, changing only
> architecture-independent code, accidentally breaking the build for
> powerpc64le.
> 
> Things should be designed in such a way that normal
> architecture-independent changes, such as adding new libm tests, do not
> require any knowledge of the existence of such a powerpc64le-specific
> list.
> 
> As these are generally normal tests, not tests in tests-internal, I
> presume they do not in fact use any internal glibc interfaces and so would
> work fine when built with an installed compiler and glibc.  So I think you
> need to identify exactly what is different (to cause the problem this
> patch is addressing) between normal builds of user code with installed
> tools, and the build of tests as part of the glibc testsuite build, and
> fix that difference (globally, not limited to these particular tests or
> this particular architecture) in such a way that these tests just work
> without a duplicate architecture-specific list of tests being needed.
> 

I don't disagree.  I think this workaround can be unilaterally added to 
gnulib-tests on ppc64le [1].  Though, I suspect that this is not the 
most accurate solution.

Looking at the comments in Makerules:

# Compiler arguments to use to link a shared object with libc and
# ld.so.  This is intended to be as similar as possible to a default
# link with an installed libc.

and poking around with GCC, I admit I don't fully understand all the 
(seemingly) implicit behavior of the default linking command.  Does:

-Wl,--as-needed $(elf-objpfx)ld.so -Wl,--no-as-needed ... -lgcc_s ...

accurately match the behavior of the default link command on ppc64le?


[1] This change, and implied removal any f128-loader-link usage.

--- a/sysdeps/powerpc/powerpc64/le/Makefile
+++ b/sysdeps/powerpc/powerpc64/le/Makefile
@@ -5,7 +5,7 @@ type-float128-CFLAGS := -mfloat128
  # libgcc requires __tcb_parse_hwcap_and_convert_at_platform when built 
with
  # a binary128 type.  That symbol is provided by the loader on dynamically
  # linked executables, forcing to link the loader after libgcc link.
-f128-loader-link = -Wl,--as-needed $(elf-objpfx)ld.so -Wl,--no-as-needed
+gnulib-tests += -Wl,--as-needed $(elf-objpfx)ld.so -Wl,--no-as-needed

  # Bootstrapping code for enabling IEEE 128.  This can be removed and
  # any indirections simplified once IEEE 128 long double is enabled.

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

* Re: [PATCH 05/13] powerpc64le: link tests against ld.so
  2020-03-09 22:38     ` Paul E Murphy
@ 2020-03-09 23:19       ` Joseph Myers
  2020-03-10 21:44         ` Paul E Murphy
  0 siblings, 1 reply; 30+ messages in thread
From: Joseph Myers @ 2020-03-09 23:19 UTC (permalink / raw)
  To: Paul E Murphy; +Cc: Paul E. Murphy, libc-alpha

On Mon, 9 Mar 2020, Paul E Murphy wrote:

> I don't disagree.  I think this workaround can be unilaterally added to
> gnulib-tests on ppc64le [1].  Though, I suspect that this is not the most
> accurate solution.
> 
> Looking at the comments in Makerules:
> 
> # Compiler arguments to use to link a shared object with libc and
> # ld.so.  This is intended to be as similar as possible to a default
> # link with an installed libc.
> 
> and poking around with GCC, I admit I don't fully understand all the
> (seemingly) implicit behavior of the default linking command.  Does:
> 
> -Wl,--as-needed $(elf-objpfx)ld.so -Wl,--no-as-needed ... -lgcc_s ...
> 
> accurately match the behavior of the default link command on ppc64le?

As I understand it, GCC does "-lgcc -lc -lgcc" (with various --as-needed 
etc. variations).  But glibc is doing something like "-lc -lgcc", and your 
patch is proposing adding an ld.so link to the makefile variable expanding 
to some form of -lgcc.  (In both cases, there is an as-needed ld.so link 
as part of the -lc link; directly in the linker command in the glibc case, 
via the libc.so linker script in the normal installed GCC case.)

So I wonder what would break if we added linking with libgcc before 
linking with libc in the relevant settings in glibc, which would seem 
closest to what installed GCC does by default.  When (across glibc 
architectures) does (static) libgcc define some symbols also defined by 
glibc's libc, and what would be the effects of linking first with libgcc 
and thus getting the libgcc versions of any such symbols instead of the 
libc ones?  And would linking with libgcc in that place (as well as after 
libc) fix the issue you see?

-- 
Joseph S. Myers
joseph@codesourcery.com

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

* Re: [PATCH 05/13] powerpc64le: link tests against ld.so
  2020-03-09 23:19       ` Joseph Myers
@ 2020-03-10 21:44         ` Paul E Murphy
  2020-03-10 23:06           ` Joseph Myers
  0 siblings, 1 reply; 30+ messages in thread
From: Paul E Murphy @ 2020-03-10 21:44 UTC (permalink / raw)
  To: Joseph Myers; +Cc: Paul E. Murphy, libc-alpha



On 3/9/20 6:19 PM, Joseph Myers wrote:
> On Mon, 9 Mar 2020, Paul E Murphy wrote:
> 
>> I don't disagree.  I think this workaround can be unilaterally added to
>> gnulib-tests on ppc64le [1].  Though, I suspect that this is not the most
>> accurate solution.
>>
>> Looking at the comments in Makerules:
>>
>> # Compiler arguments to use to link a shared object with libc and
>> # ld.so.  This is intended to be as similar as possible to a default
>> # link with an installed libc.
>>
>> and poking around with GCC, I admit I don't fully understand all the
>> (seemingly) implicit behavior of the default linking command.  Does:
>>
>> -Wl,--as-needed $(elf-objpfx)ld.so -Wl,--no-as-needed ... -lgcc_s ...
>>
>> accurately match the behavior of the default link command on ppc64le?
> 
> As I understand it, GCC does "-lgcc -lc -lgcc" (with various --as-needed
> etc. variations).  But glibc is doing something like "-lc -lgcc", and your
> patch is proposing adding an ld.so link to the makefile variable expanding
> to some form of -lgcc.  (In both cases, there is an as-needed ld.so link
> as part of the -lc link; directly in the linker command in the glibc case,
> via the libc.so linker script in the normal installed GCC case.)
> 
> So I wonder what would break if we added linking with libgcc before
> linking with libc in the relevant settings in glibc, which would seem
> closest to what installed GCC does by default.  When (across glibc
> architectures) does (static) libgcc define some symbols also defined by
> glibc's libc, and what would be the effects of linking first with libgcc
> and thus getting the libgcc versions of any such symbols instead of the
> libc ones?  And would linking with libgcc in that place (as well as after
> libc) fix the issue you see?
> 

Are you suggesting something like [2] would be more accurate?  Nothing 
outright broke on powerpc64le when testing on ppc64le with all the 
ieee128 patches.  As long as libgcc is linked prior to ld, the 
workaround used by f128-loader-link is never needed for tests which 
implicitly utilize K{F,C}mode libgcc routines.


[2]:

diff --git a/Makeconfig b/Makeconfig
index f252842979..0e80234897 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -570,7 +570,7 @@ link-libc-before-gnulib = 
$(common-objpfx)libc.so$(libc.so-version) \
                           -Wl,--no-as-needed
  link-libc = $(link-libc-before-gnulib) $(gnulib)

-link-libc-tests-after-rpath-link = $(link-libc-before-gnulib) 
$(gnulib-tests)
+link-libc-tests-after-rpath-link = -lgcc $(link-libc-before-gnulib) 
$(gnulib-tests)
  link-libc-tests = $(link-libc-tests-rpath-link) \
                   $(link-libc-tests-after-rpath-link)
  # Pretty printer test programs always require rpath instead of rpath-link.


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

* Re: [PATCH 05/13] powerpc64le: link tests against ld.so
  2020-03-10 21:44         ` Paul E Murphy
@ 2020-03-10 23:06           ` Joseph Myers
  0 siblings, 0 replies; 30+ messages in thread
From: Joseph Myers @ 2020-03-10 23:06 UTC (permalink / raw)
  To: Paul E Murphy; +Cc: libc-alpha

On Tue, 10 Mar 2020, Paul E Murphy via Libc-alpha wrote:

> Are you suggesting something like [2] would be more accurate?  Nothing

It should use $(gnulib-tests) in place of -lgcc, but something like that, 
yes.

-- 
Joseph S. Myers
joseph@codesourcery.com

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

* Re: [PATCH 02/13] Fix tests which expose ldbl -> _Float128 redirects
  2020-03-06 20:37 ` [PATCH 02/13] Fix tests which expose ldbl -> _Float128 redirects Paul E. Murphy
@ 2020-03-13 21:37   ` Tulio Magno Quites Machado Filho
  2020-03-25 21:20     ` Paul E Murphy
  0 siblings, 1 reply; 30+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2020-03-13 21:37 UTC (permalink / raw)
  To: Paul E. Murphy, libc-alpha

"Paul E. Murphy" <murphyp@linux.vnet.ibm.com> writes:

> The ldbl redirects for ieee128 have some jagged edges when
> inspecting and manipulating symbols directly.
>
> e.g asprintf is unconditionally redirected to __asprintfieee128
> thus any tests relying on GCC's redirect behavior will encounter
> problems if they inspect the symbol names too closely.
>
> I've mitigated tests which expose the limitations of the
> ldbl -> f128 redirects by giving them knowledge about the
> redirected symbol names.
>
> Hopefully there isn't much user code which depends on this
> implementation specific behavior.

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

-- 
Tulio Magno


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

* Re: [PATCH 01/13] ldbl-128ibm-compat: PLT redirects for using ldbl redirects internally
  2020-03-06 20:37 ` [PATCH 01/13] ldbl-128ibm-compat: PLT redirects for using ldbl redirects internally Paul E. Murphy
@ 2020-03-16 17:29   ` Paul E Murphy
  2020-03-24 18:28   ` Tulio Magno Quites Machado Filho
  1 sibling, 0 replies; 30+ messages in thread
From: Paul E Murphy @ 2020-03-16 17:29 UTC (permalink / raw)
  To: libc-alpha

Ping?

On 3/6/20 2:37 PM, Paul E. Murphy wrote:
> Tweak the PLT bypass magic when building glibc with long double
> redirects.  This is made more difficult by the fact we only get
> one chance to redirect functions.  This happens via the public
> headers.
> 
> There are roughly three classes of redirect we need to attend to
> today:
> 
>   1. Simple redirects, redirected via cdef macro overrides and
>      and new libc_hidden_ldbl_proto macro.
>   2. Internal usage of internal API, e.g __snprintf, which has
>      no direct analogue.  This is bypassed directly on case-by-
>      case basis.
>   3. Double redirects, e.g sscanf and related.  These require
>      a heavier handed approach of macro renaming to existing
>      symbols.
> 
> Most simple redirects are handled via 1.  Ideally, the libc_*
> macro would live in libc-symbols.h, but in practice the macros
> needed for it to do anything useful live in cdefs.h, so they
> are defined in the local override.
> 
> Notably, the internal name of the asprintf generated for ieee ldbl
> redirects is renamed to work with internal prefixed usage.
> 
> This resolves the local plt usage introduced when building glibc
> with ldbl == ieee128 on ppc64le.
> ---
>   include/err.h                                 | 12 ++---
>   include/libc-symbols.h                        |  2 +
>   include/stdio.h                               | 52 +++++++++++++------
>   include/sys/cdefs.h                           | 20 +++++++
>   include/sys/syslog.h                          |  2 +-
>   include/wchar.h                               |  2 +-
>   .../ldbl-128ibm-compat/ieee128-asprintf.c     |  5 +-
>   .../ldbl-128ibm-compat/ieee128-dprintf.c      |  1 +
>   .../ieee754/ldbl-128ibm-compat/ieee128-err.c  |  7 +++
>   .../ldbl-128ibm-compat/ieee128-fprintf.c      |  1 +
>   .../ieee128-isoc99_sscanf.c                   |  1 +
>   .../ieee128-isoc99_vfscanf.c                  |  2 +
>   .../ieee128-isoc99_vsscanf.c                  |  1 +
>   .../ldbl-128ibm-compat/ieee128-sprintf.c      |  1 +
>   .../ldbl-128ibm-compat/ieee128-syslog.c       |  1 +
>   .../ldbl-128ibm-compat/ieee128-vfprintf.c     |  1 +
>   .../ldbl-128ibm/include/bits/iscanonical.h    |  2 +-
>   17 files changed, 87 insertions(+), 26 deletions(-)

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

* Re: [PATCH 01/13] ldbl-128ibm-compat: PLT redirects for using ldbl redirects internally
  2020-03-06 20:37 ` [PATCH 01/13] ldbl-128ibm-compat: PLT redirects for using ldbl redirects internally Paul E. Murphy
  2020-03-16 17:29   ` Paul E Murphy
@ 2020-03-24 18:28   ` Tulio Magno Quites Machado Filho
  2020-03-25 21:20     ` Paul E Murphy
  1 sibling, 1 reply; 30+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2020-03-24 18:28 UTC (permalink / raw)
  To: Paul E. Murphy, libc-alpha

"Paul E. Murphy" <murphyp@linux.vnet.ibm.com> writes:

> diff --git a/include/stdio.h b/include/stdio.h
> index dffa7765dd..6718af4108 100644
> --- a/include/stdio.h
> +++ b/include/stdio.h
> @@ -66,6 +77,7 @@ extern int __isoc99_vscanf (const char *__restrict __format,
>  extern int __isoc99_vsscanf (const char *__restrict __s,
>  			     const char *__restrict __format,
>  			     __gnuc_va_list __arg) __THROW;
> +

Unintentional edit?

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

-- 
Tulio Magno

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

* Re: [PATCH 03/13] RFC: ldbl-128ibm-compat: workaround C++ redirect limitations
  2020-03-06 20:37 ` [PATCH 03/13] RFC: ldbl-128ibm-compat: workaround C++ redirect limitations Paul E. Murphy
@ 2020-03-24 20:30   ` Tulio Magno Quites Machado Filho
  0 siblings, 0 replies; 30+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2020-03-24 20:30 UTC (permalink / raw)
  To: Paul E. Murphy, libc-alpha

"Paul E. Murphy" <murphyp@linux.vnet.ibm.com> writes:

> 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.
>
> Does a better option than explicitly specifying these headers via
> the #pragma GCC system_header?

I'm afraid -isystem is not an option in this case as it could change the
lookup order.  In other words: I don't have a better option than
what you proposed.

-- 
Tulio Magno

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

* Re: [PATCH 04/13] powerpc64le: Ensure correct ldouble compiler flags are used
  2020-03-06 20:37 ` [PATCH 04/13] powerpc64le: Ensure correct ldouble compiler flags are used Paul E. Murphy
@ 2020-03-24 20:32   ` Tulio Magno Quites Machado Filho
  2020-03-25 21:21     ` Paul E Murphy
  0 siblings, 1 reply; 30+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2020-03-24 20:32 UTC (permalink / raw)
  To: Paul E. Murphy, libc-alpha

"Paul E. Murphy" <murphyp@linux.vnet.ibm.com> writes:

> From: "Gabriel F. T. Gomes" <gabriel@inconstante.eti.br>
>
> Ensure the correct ldouble abi flags are applied to ibm128 files and
> nldbl files.  Remove the IEEE options if used, and apply the flags
> used to build ldouble files which are ibm128 abi.
>
> nldbl tests are a little tricky.  To use the support, we must remove
> all ldouble abi flags, and ensure -mlong-double-64 is used.
>
> Co-authored-by: Rajalakshmi Srinivasaraghavan  <raji@linux.vnet.ibm.com>
> Co-authored-by: Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>
> Co-authored-by: Paul E. Murphy  <murphyp@linux.vnet.ibm.com>

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

-- 
Tulio Magno


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

* Re: [PATCH 06/13] powerpc64le: add -mno-gnu-attribute to *f128 objects and difftime
  2020-03-06 20:37 ` [PATCH 06/13] powerpc64le: add -mno-gnu-attribute to *f128 objects and difftime Paul E. Murphy
@ 2020-03-24 20:42   ` Tulio Magno Quites Machado Filho
  2020-03-25 21:21     ` Paul E Murphy
  0 siblings, 1 reply; 30+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2020-03-24 20:42 UTC (permalink / raw)
  To: Paul E. Murphy, libc-alpha

"Paul E. Murphy" <murphyp@linux.vnet.ibm.com> writes:

> diff --git a/sysdeps/powerpc/powerpc64/le/Makefile b/sysdeps/powerpc/powerpc64/le/Makefile
> index ee2b78bb5f..f23e2782f0 100644
> --- a/sysdeps/powerpc/powerpc64/le/Makefile
> +++ b/sysdeps/powerpc/powerpc64/le/Makefile
> @@ -161,6 +164,10 @@ $(foreach test, \
>    gnulib-tests += $(f128-loader-link)
>  endif
>  
> +# Disable linker noise on files using ieee128 long double internally
> +ifeq ($(subdir),time)
> +CFLAGS-difftime.c = $(no-gnu-attribute-CFLAGS)

Shouldn't it use += instead?

LGTM with that change.

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

-- 
Tulio Magno


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

* Re: [PATCH 07/13] powerpc64: apply -mabi=ibmlongdouble to special files
       [not found] ` <20200306203721.15886-8-murphyp@linux.vnet.ibm.com>
@ 2020-03-24 20:59   ` Tulio Magno Quites Machado Filho
  2020-03-25 21:22     ` Paul E Murphy
  0 siblings, 1 reply; 30+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2020-03-24 20:59 UTC (permalink / raw)
  To: Paul E. Murphy, libc-alpha

"Paul E. Murphy" <murphyp@linux.vnet.ibm.com> writes:

> Some of these files depend on the avoidance of using the various
> register sets of POWER.  When enabling the IEEE 128 long double,
> we must be sure to disable this ABI as some compilers will
> refuse to compile if -mno-vsx and -mabi=ieeelongdouble are both
> present.

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

-- 
Tulio Magno


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

* Re: [PATCH 01/13] ldbl-128ibm-compat: PLT redirects for using ldbl redirects internally
  2020-03-24 18:28   ` Tulio Magno Quites Machado Filho
@ 2020-03-25 21:20     ` Paul E Murphy
  0 siblings, 0 replies; 30+ messages in thread
From: Paul E Murphy @ 2020-03-25 21:20 UTC (permalink / raw)
  To: Tulio Magno Quites Machado Filho, Paul E. Murphy, libc-alpha



On 3/24/20 1:28 PM, Tulio Magno Quites Machado Filho wrote:
> "Paul E. Murphy" <murphyp@linux.vnet.ibm.com> writes:
> 
>> diff --git a/include/stdio.h b/include/stdio.h
>> index dffa7765dd..6718af4108 100644
>> --- a/include/stdio.h
>> +++ b/include/stdio.h
>> @@ -66,6 +77,7 @@ extern int __isoc99_vscanf (const char *__restrict __format,
>>   extern int __isoc99_vsscanf (const char *__restrict __s,
>>   			     const char *__restrict __format,
>>   			     __gnuc_va_list __arg) __THROW;
>> +
> 
> Unintentional edit?

Yes, it has been removed.  I have pushed this after running against
build-many-glibcs.py and and another local sanity test on x86-64.  Thank 
you for your reviews!

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

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

* Re: [PATCH 02/13] Fix tests which expose ldbl -> _Float128 redirects
  2020-03-13 21:37   ` Tulio Magno Quites Machado Filho
@ 2020-03-25 21:20     ` Paul E Murphy
  0 siblings, 0 replies; 30+ messages in thread
From: Paul E Murphy @ 2020-03-25 21:20 UTC (permalink / raw)
  To: Tulio Magno Quites Machado Filho, Paul E. Murphy, libc-alpha



On 3/13/20 4:37 PM, Tulio Magno Quites Machado Filho wrote:
> "Paul E. Murphy" <murphyp@linux.vnet.ibm.com> writes:
> 
>> The ldbl redirects for ieee128 have some jagged edges when
>> inspecting and manipulating symbols directly.
>>
>> e.g asprintf is unconditionally redirected to __asprintfieee128
>> thus any tests relying on GCC's redirect behavior will encounter
>> problems if they inspect the symbol names too closely.
>>
>> I've mitigated tests which expose the limitations of the
>> ldbl -> f128 redirects by giving them knowledge about the
>> redirected symbol names.
>>
>> Hopefully there isn't much user code which depends on this
>> implementation specific behavior.
> 
> Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
> 

Pushed.  Thank you for the review!

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

* Re: [PATCH 04/13] powerpc64le: Ensure correct ldouble compiler flags are used
  2020-03-24 20:32   ` Tulio Magno Quites Machado Filho
@ 2020-03-25 21:21     ` Paul E Murphy
  0 siblings, 0 replies; 30+ messages in thread
From: Paul E Murphy @ 2020-03-25 21:21 UTC (permalink / raw)
  To: Tulio Magno Quites Machado Filho, Paul E. Murphy, libc-alpha



On 3/24/20 3:32 PM, Tulio Magno Quites Machado Filho wrote:
> "Paul E. Murphy" <murphyp@linux.vnet.ibm.com> writes:
> 
>> From: "Gabriel F. T. Gomes" <gabriel@inconstante.eti.br>
>>
>> Ensure the correct ldouble abi flags are applied to ibm128 files and
>> nldbl files.  Remove the IEEE options if used, and apply the flags
>> used to build ldouble files which are ibm128 abi.
>>
>> nldbl tests are a little tricky.  To use the support, we must remove
>> all ldouble abi flags, and ensure -mlong-double-64 is used.
>>
>> Co-authored-by: Rajalakshmi Srinivasaraghavan  <raji@linux.vnet.ibm.com>
>> Co-authored-by: Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>
>> Co-authored-by: Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
> 
> Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
> 

Pushed, thank you for reviewing.

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

* Re: [PATCH 06/13] powerpc64le: add -mno-gnu-attribute to *f128 objects and difftime
  2020-03-24 20:42   ` Tulio Magno Quites Machado Filho
@ 2020-03-25 21:21     ` Paul E Murphy
  0 siblings, 0 replies; 30+ messages in thread
From: Paul E Murphy @ 2020-03-25 21:21 UTC (permalink / raw)
  To: Tulio Magno Quites Machado Filho, Paul E. Murphy, libc-alpha



On 3/24/20 3:42 PM, Tulio Magno Quites Machado Filho wrote:
> "Paul E. Murphy" <murphyp@linux.vnet.ibm.com> writes:
> 
>> diff --git a/sysdeps/powerpc/powerpc64/le/Makefile b/sysdeps/powerpc/powerpc64/le/Makefile
>> index ee2b78bb5f..f23e2782f0 100644
>> --- a/sysdeps/powerpc/powerpc64/le/Makefile
>> +++ b/sysdeps/powerpc/powerpc64/le/Makefile
>> @@ -161,6 +164,10 @@ $(foreach test, \
>>     gnulib-tests += $(f128-loader-link)
>>   endif
>>   
>> +# Disable linker noise on files using ieee128 long double internally
>> +ifeq ($(subdir),time)
>> +CFLAGS-difftime.c = $(no-gnu-attribute-CFLAGS)
> 
> Shouldn't it use += instead?

Yes, thank you for catching my mistake.  Fixed and pushed.

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

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

* Re: [PATCH 07/13] powerpc64: apply -mabi=ibmlongdouble to special files
  2020-03-24 20:59   ` [PATCH 07/13] powerpc64: apply -mabi=ibmlongdouble to special files Tulio Magno Quites Machado Filho
@ 2020-03-25 21:22     ` Paul E Murphy
  0 siblings, 0 replies; 30+ messages in thread
From: Paul E Murphy @ 2020-03-25 21:22 UTC (permalink / raw)
  To: Tulio Magno Quites Machado Filho, Paul E. Murphy, libc-alpha

Pushed.  Thank you for reviewing.

On 3/24/20 3:59 PM, Tulio Magno Quites Machado Filho wrote:
> "Paul E. Murphy" <murphyp@linux.vnet.ibm.com> writes:
> 
>> Some of these files depend on the avoidance of using the various
>> register sets of POWER.  When enabling the IEEE 128 long double,
>> we must be sure to disable this ABI as some compilers will
>> refuse to compile if -mno-vsx and -mabi=ieeelongdouble are both
>> present.
> 
> Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
> 

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

end of thread, other threads:[~2020-03-25 21:22 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-06 20:37 [PATCH 00/13] Enable IEEE binary128 long double on powerpc64le Paul E. Murphy
2020-03-06 20:37 ` [PATCH 10/13] powerpc64le: raise GCC requirement to 7.3 for long double transition Paul E. Murphy
2020-03-06 20:37 ` [PATCH 08/13] powerpc64le: Enforce -mabi=ibmlongdouble when -mfloat128 used Paul E. Murphy
     [not found]   ` <alpine.DEB.2.21.2003070033530.26274@digraph.polyomino.org.uk>
2020-03-09 14:30     ` Paul E Murphy
2020-03-06 20:37 ` [PATCH 12/13] powerpc64le: enforce non-specific long double in .gnu.attributes section Paul E. Murphy
2020-03-06 20:37 ` [PATCH 06/13] powerpc64le: add -mno-gnu-attribute to *f128 objects and difftime Paul E. Murphy
2020-03-24 20:42   ` Tulio Magno Quites Machado Filho
2020-03-25 21:21     ` Paul E Murphy
2020-03-06 20:37 ` [PATCH 02/13] Fix tests which expose ldbl -> _Float128 redirects Paul E. Murphy
2020-03-13 21:37   ` Tulio Magno Quites Machado Filho
2020-03-25 21:20     ` Paul E Murphy
2020-03-06 20:37 ` [PATCH 11/13] powerpc64le: bump binutils version requirement to >= 2.26 Paul E. Murphy
2020-03-06 20:37 ` [PATCH 04/13] powerpc64le: Ensure correct ldouble compiler flags are used Paul E. Murphy
2020-03-24 20:32   ` Tulio Magno Quites Machado Filho
2020-03-25 21:21     ` Paul E Murphy
2020-03-06 20:37 ` [PATCH 05/13] powerpc64le: link tests against ld.so Paul E. Murphy
     [not found]   ` <alpine.DEB.2.21.2003070026090.26274@digraph.polyomino.org.uk>
2020-03-09 22:38     ` Paul E Murphy
2020-03-09 23:19       ` Joseph Myers
2020-03-10 21:44         ` Paul E Murphy
2020-03-10 23:06           ` Joseph Myers
2020-03-06 20:37 ` [PATCH 01/13] ldbl-128ibm-compat: PLT redirects for using ldbl redirects internally Paul E. Murphy
2020-03-16 17:29   ` Paul E Murphy
2020-03-24 18:28   ` Tulio Magno Quites Machado Filho
2020-03-25 21:20     ` Paul E Murphy
2020-03-06 20:37 ` [PATCH 09/13] powerpc64le: workaround ieee long double / _Float128 stdc++ bug Paul E. Murphy
2020-03-06 20:37 ` [PATCH 03/13] RFC: ldbl-128ibm-compat: workaround C++ redirect limitations Paul E. Murphy
2020-03-24 20:30   ` Tulio Magno Quites Machado Filho
2020-03-06 20:52 ` [PATCH 13/13] powerpc64le: Enable support for IEEE long double Paul E. Murphy
     [not found] ` <20200306203721.15886-8-murphyp@linux.vnet.ibm.com>
2020-03-24 20:59   ` [PATCH 07/13] powerpc64: apply -mabi=ibmlongdouble to special files Tulio Magno Quites Machado Filho
2020-03-25 21:22     ` Paul E Murphy

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