public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v3 0/7] Enable float128 on powerpc64le
@ 2017-06-23 12:33 Gabriel F. T. Gomes
  2017-06-23 12:33 ` [PATCH v3 3/7] Add libio-mtsafe flags to the build of strfromf128 Gabriel F. T. Gomes
                   ` (7 more replies)
  0 siblings, 8 replies; 83+ messages in thread
From: Gabriel F. T. Gomes @ 2017-06-23 12:33 UTC (permalink / raw)
  To: libc-alpha

Changes since the previous version in each patch

Gabriel F. T. Gomes (6):
  Include libc-header-start.h in include/float.h
  Prepare the manual to display math errors for float128 functions
  Add libio-mtsafe flags to the build of strfromf128
  Update string to float128 functions to use bits/types/locale_t.h
  Document _FloatN and _FloatNx versions of math functions
  powerpc64le: Check for compiler features for float128

Paul E. Murphy (1):
  powerpc64le: Enable float128

 NEWS                                               |  94 ++++
 include/float.h                                    |   3 +
 manual/arith.texi                                  | 286 ++++++++--
 manual/install.texi                                |   4 +
 manual/libm-err-tab.pl                             |   7 +-
 manual/math.texi                                   | 287 +++++++++-
 sysdeps/ieee754/float128/Makefile                  |   4 +
 sysdeps/ieee754/float128/strtof128_l.c             |   2 +-
 sysdeps/ieee754/float128/wcstof128.c               |   2 +-
 sysdeps/ieee754/float128/wcstof128_l.c             |   2 +-
 sysdeps/powerpc/bits/floatn.h                      |  92 ++++
 sysdeps/powerpc/fpu/libm-test-ulps                 | 578 +++++++++++++++++++++
 sysdeps/powerpc/fpu/math_private.h                 |  10 +
 sysdeps/powerpc/powerpc64le/Implies-before         |   1 +
 sysdeps/powerpc/powerpc64le/Makefile               |  45 ++
 sysdeps/powerpc/powerpc64le/configure              |  45 ++
 sysdeps/powerpc/powerpc64le/configure.ac           |  32 ++
 sysdeps/powerpc/powerpc64le/fpu/e_sqrtf128.c       |  51 ++
 sysdeps/powerpc/powerpc64le/fpu/sfp-machine.h      | 115 ++++
 .../powerpc/powerpc64le/power9/fpu/e_sqrtf128.c    |  36 ++
 .../sysv/linux/powerpc/powerpc64/libc-le.abilist   |   7 +
 .../sysv/linux/powerpc/powerpc64/libm-le.abilist   | 138 +++++
 .../sysv/linux/powerpc/powerpc64le/float128-abi.h  |   2 +
 23 files changed, 1784 insertions(+), 59 deletions(-)
 create mode 100644 sysdeps/powerpc/bits/floatn.h
 create mode 100644 sysdeps/powerpc/powerpc64le/Implies-before
 create mode 100644 sysdeps/powerpc/powerpc64le/Makefile
 create mode 100644 sysdeps/powerpc/powerpc64le/configure
 create mode 100644 sysdeps/powerpc/powerpc64le/configure.ac
 create mode 100644 sysdeps/powerpc/powerpc64le/fpu/e_sqrtf128.c
 create mode 100644 sysdeps/powerpc/powerpc64le/fpu/sfp-machine.h
 create mode 100644 sysdeps/powerpc/powerpc64le/power9/fpu/e_sqrtf128.c
 create mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc64le/float128-abi.h

-- 
2.4.11

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

* [PATCH v3 3/7] Add libio-mtsafe flags to the build of strfromf128
  2017-06-23 12:33 [PATCH v3 0/7] Enable float128 on powerpc64le Gabriel F. T. Gomes
@ 2017-06-23 12:33 ` Gabriel F. T. Gomes
  2017-06-23 12:59   ` Joseph Myers
  2017-06-23 12:33 ` [PATCH v3 1/7] Include libc-header-start.h in include/float.h Gabriel F. T. Gomes
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 83+ messages in thread
From: Gabriel F. T. Gomes @ 2017-06-23 12:33 UTC (permalink / raw)
  To: libc-alpha

New since v2:

  - This patch has been split from the last patch in this set, because it
    isn't powerpc64le-specific.

-- 8< --
Similar to the other functions in the strfrom class, strfromf128 calls
__printf_fp in order to convert the floating-point value to characters.
This requires the value of IO_MTSAFE_IO.

Tested for powerpc64le and s390x.

	* sysdeps/ieee754/float128/Makefile (CFLAGS-strfromf128.c): Add
	$(libio-mtsafe) to get the value of IO_MTSAFE_IO.
---
 sysdeps/ieee754/float128/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sysdeps/ieee754/float128/Makefile b/sysdeps/ieee754/float128/Makefile
index 166e630..571a841 100644
--- a/sysdeps/ieee754/float128/Makefile
+++ b/sysdeps/ieee754/float128/Makefile
@@ -1,6 +1,10 @@
 ifeq ($(subdir),stdlib)
 routines += float1282mpn strfromf128
 routines += strtof128 strtof128_l strtof128_nan mpn2float128
+
+# The strfrom class of functions call __printf_fp in order to convert the
+# floating-point value to characters.  This requires the value of IO_MTSAFE_IO.
+CFLAGS-strfromf128.c += $(libio-mtsafe)
 endif
 
 ifeq ($(subdir),wcsmbs)
-- 
2.4.11

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

* [PATCH v3 1/7] Include libc-header-start.h in include/float.h
  2017-06-23 12:33 [PATCH v3 0/7] Enable float128 on powerpc64le Gabriel F. T. Gomes
  2017-06-23 12:33 ` [PATCH v3 3/7] Add libio-mtsafe flags to the build of strfromf128 Gabriel F. T. Gomes
@ 2017-06-23 12:33 ` Gabriel F. T. Gomes
  2017-06-23 12:34 ` [PATCH v3 5/7] Document _FloatN and _FloatNx versions of math functions Gabriel F. T. Gomes
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 83+ messages in thread
From: Gabriel F. T. Gomes @ 2017-06-23 12:33 UTC (permalink / raw)
  To: libc-alpha

New since v2:

  - This patch has been split from the last patch in this set, because it
    isn't powerpc64le-specific.

-- 8< --
The file include/float.h uses the macro __GLIBC_USE to test for TS 18661-3
support.  Such macro is provided by bits/libc-header-start.h, so include it
to get the definition.

Tested for powerpc64le and s390x.

	* include/float.h: Include libc-header-start.h to get the
	definition of __GLIBC_USE.
---
 include/float.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/float.h b/include/float.h
index a5b357d..736868f 100644
--- a/include/float.h
+++ b/include/float.h
@@ -1,6 +1,9 @@
 #ifndef _LIBC_FLOAT_H
 #define _LIBC_FLOAT_H
 
+#define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
+#include <bits/libc-header-start.h>
+
 #ifndef _ISOMAC
 # define __STDC_WANT_IEC_60559_TYPES_EXT__
 #endif
-- 
2.4.11

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

* [PATCH v3 7/7] powerpc64le: Enable float128
  2017-06-23 12:33 [PATCH v3 0/7] Enable float128 on powerpc64le Gabriel F. T. Gomes
                   ` (2 preceding siblings ...)
  2017-06-23 12:34 ` [PATCH v3 5/7] Document _FloatN and _FloatNx versions of math functions Gabriel F. T. Gomes
@ 2017-06-23 12:34 ` Gabriel F. T. Gomes
  2017-06-23 13:18   ` Joseph Myers
                     ` (4 more replies)
  2017-06-23 12:34 ` [PATCH v3 6/7] powerpc64le: Check for compiler features for float128 Gabriel F. T. Gomes
                   ` (3 subsequent siblings)
  7 siblings, 5 replies; 83+ messages in thread
From: Gabriel F. T. Gomes @ 2017-06-23 12:34 UTC (permalink / raw)
  To: libc-alpha

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

Changes since v2:

  - In the NEWS file, added mentions to strtof128_l and wcstof128_l and
    fixed some wording errors.
  - In sfp-machine.h, removed comment about 32-bits/64-bits detection,
    since the 32-bits part has been removed.
  - Removed the addition of the CFLAG $(libio-mtsafe) from the
    arch-specific Makefile.  It is added to the arch-independent
    sysdeps/ieee754/float128/Makefile by a previous, arch-independent
    commit.

Changes since v1:

  - In the NEWS file, mention the addition of HUGE_VAL_F128 and of the float128
    versions of the macros prefixed with M_.
  - In the NEWS file, clarify what float128 features are added.
  - Do not include libc-header-start.h in test-float128.h, strfromf128.c,
    strtof128_l.c, wcstof128.c, wcstof128_l.c.  Instead, include features.h in
    bits/floatn.h to get the definition of __GNUC_PREREQ.
  - When compiling C++, also define __HAVE_FLOAT128.
  - Use $(all-object-suffixes) in sysdeps/powerpc/powerpc64le/Makefile.
  - Remove blocks of code from sfp-machine.h that are irrelevant to
    powerpc64le.
  - In include/float.h, include libc-header-start.h to get the definition of
    __GLIBC_USE.

-- 8< --
This patch adds ULPs for the float128 type, updates the abilist for libc
and libm, and adds the files bits/floatn.h and float128-abi.h, in order to
enable the new type for powerpc64le.

This patch also adds the implementation of sqrtf128 for powerpc64le, since
it is not implemented in libgcc.  The sfp-machine.h header is taken from
libgcc.

Tested for powerpc64le (GCC 6.2 and GCC 7.1), powerpc64 and s390x.

	* NEWS: Mention the addition of float128 features for powerpc64le.
	* manual/math.texi (Mathematics): Mention the enabling of float128
	for powerpc64le.
	* sysdeps/powerpc/bits/floatn.h: New file.
	* sysdeps/powerpc/fpu/libm-test-ulps: Regenerated.
	* sysdeps/powerpc/fpu/math_private.h:
	(__ieee754_sqrtf128): New inline override.
	* sysdeps/powerpc/powerpc64le/Implies-before: New file.
	* sysdeps/powerpc/powerpc64le/Makefile: New file.
	* sysdeps/powerpc/powerpc64le/fpu/e_sqrtf128.c: New file.
	* sysdeps/powerpc/powerpc64le/fpu/sfp-machine.h: New file.
	* sysdeps/powerpc/powerpc64le/power9/fpu/e_sqrtf128.c: New file.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist:
	Updated.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64le/float128-abi.h:
	New file.
---
 NEWS                                               |  94 ++++
 manual/math.texi                                   |   3 +-
 sysdeps/powerpc/bits/floatn.h                      |  92 ++++
 sysdeps/powerpc/fpu/libm-test-ulps                 | 578 +++++++++++++++++++++
 sysdeps/powerpc/fpu/math_private.h                 |  10 +
 sysdeps/powerpc/powerpc64le/Implies-before         |   1 +
 sysdeps/powerpc/powerpc64le/Makefile               |  45 ++
 sysdeps/powerpc/powerpc64le/fpu/e_sqrtf128.c       |  51 ++
 sysdeps/powerpc/powerpc64le/fpu/sfp-machine.h      | 115 ++++
 .../powerpc/powerpc64le/power9/fpu/e_sqrtf128.c    |  36 ++
 .../sysv/linux/powerpc/powerpc64/libc-le.abilist   |   7 +
 .../sysv/linux/powerpc/powerpc64/libm-le.abilist   | 138 +++++
 .../sysv/linux/powerpc/powerpc64le/float128-abi.h  |   2 +
 13 files changed, 1171 insertions(+), 1 deletion(-)
 create mode 100644 sysdeps/powerpc/bits/floatn.h
 create mode 100644 sysdeps/powerpc/powerpc64le/Implies-before
 create mode 100644 sysdeps/powerpc/powerpc64le/Makefile
 create mode 100644 sysdeps/powerpc/powerpc64le/fpu/e_sqrtf128.c
 create mode 100644 sysdeps/powerpc/powerpc64le/fpu/sfp-machine.h
 create mode 100644 sysdeps/powerpc/powerpc64le/power9/fpu/e_sqrtf128.c
 create mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc64le/float128-abi.h

diff --git a/NEWS b/NEWS
index e8546e1..027f09b 100644
--- a/NEWS
+++ b/NEWS
@@ -121,6 +121,100 @@ Version 2.26
   C Library is GCC 4.9.  Older GCC versions, and non-GNU compilers, can
   still be used to compile programs using the GNU C Library.
 
+* Support is added, on powerpc64le, for interfaces supporting the _Float128
+  type from ISO/IEC TS 18661-3:2015.  Most of the interfaces are taken from
+  TS 18661-3.  The type-generic macros in <math.h> support this type, but
+  those in <tgmath.h> do not.  The GNU C Library now requires GCC 6.2 or
+  later to build for powerpc64le.  When used with GCC versions before GCC
+  7, these interfaces may be used with the type under the non-standard name
+  __float128.
+
+  New <stdlib.h> functions from ISO/IEC TS 18661-3:
+
+    - String Conversion Functions: strfromf128 and strtof128.
+
+  New <math.h> features from ISO/IEC TS 18661-3:
+
+    - Very Large Number macro: HUGE_VAL_F128.
+
+    - Signaling NaN macro: SNANF128.
+
+    - Trigonometric Functions: acosf128, asinf128, atanf128, atan2f128,
+      cosf128, sinf128, tanf128.
+
+    - Hyperbolic Functions: acoshf128, asinhf128, atanhf128, coshf128,
+      sinhf128, tanhf128.
+
+    - Exponential and Logarithmic Functions: expf128, exp2f128, expm1f128,
+      frexpf128, ilogbf128, ldexpf128, llogbf128, logf128, log10f128,
+      log1pf128, log2f128, logbf128, modff128, scalbnf128, scalblnf128.
+
+    - Power and Absolute Functions: cbrtf128, fabsf128, hypotf128, powf128,
+      sqrtf128.
+
+    - Error and Gamma Functions: erff128, erfcf128, lgammaf128, tgammaf128.
+
+    - Nearest Integer Functions: ceilf128, floorf128, nearbyintf128,
+      rintf128, lrintf128, llrintf128, roundf128, lroundf128, llroundf128,
+      roundevenf128, truncf128, fromfpf128, ufromfpf128, fromfpxf128,
+      ufromfpxf128.
+
+    - Remainder Functions: fmodf128, remainderf128, remquof128.
+
+    - Manipulation Functions: copysignf128, nanf128, nextafterf128,
+      nextupf128, nextdownf128, canonicalizef128.
+
+    - Minimum, Maximum, and Positive Difference Functions: fdimf128,
+      fmaxf128, fminf128, fmaxmagf128, fminmagf128.
+
+    - Floating Multiply-Add Function: fmaf128.
+
+    - Total Order Functions: totalorderf128, totalordermagf128.
+
+    - Payload Functions: getpayloadf128, setpayloadf128, setpayloadsigf128.
+
+  New <complex.h> functions from ISO/IEC TS 18661-3:
+
+    - Trigonometric Functions: cacosf128, casinf128, catanf128, ccosf128,
+      csinf128, ctanf128.
+
+    - Hyperbolic Functions: cacoshf128, casinhf128, catanhf128, ccoshf128,
+      csinhf128, ctanhf128.
+
+    - Exponential and Logarithmic Functions: cexpf128, clogf128.
+
+    - Power and Absolute Functions: cabsf128, cpowf128, csqrtf128.
+
+    - Manipulation Functions: cargf128, cimagf128, CMPLXF128, conjf128,
+      cprojf128, crealf128.
+
+  The following <wchar.h> functions are added as GNU extensions:
+
+    - Wide String Conversion Functions: wsctof128, wcstof128_l.
+
+  The following <stdlib.h> function is added as a GNU extension:
+
+    - String Conversion Function: strtof128_l.
+
+  The following <math.h> features are added as GNU extensions:
+
+    - Predefined Mathematical Constants: M_Ef128, M_LOG2Ef128,
+      M_LOG10Ef128, M_LN2f128, M_LN10f128, M_PIf128, M_PI_2f128,
+      M_PI_4f128, M_1_PIf128, M_2_PIf128, M_2_SQRTPIf128, M_SQRT2f128,
+      M_SQRT1_2f128.
+
+    - Trigonometric Function: sincosf128.
+
+    - Exponential and Logarithmic Function: exp10f128.
+
+    - Error and Gamma Function: lgammaf128_r.
+
+    - Bessel Functions: j0f128, j1f128, jnf128, y0f128, y1f128, ynf128.
+
+  The following <complex.h> function is added as a GNU extension:
+
+    - Exponential and Logarithmic Function: clog10f128.
+
 Security related changes:
 
 * The DNS stub resolver limits the advertised UDP buffer size to 1200 bytes,
diff --git a/manual/math.texi b/manual/math.texi
index 5bd3341..01bd812 100644
--- a/manual/math.texi
+++ b/manual/math.texi
@@ -66,7 +66,8 @@ these functions are described along with the @code{double},
 @w{ISO/IEC TS 18661-3}, unless explicitly stated otherwise.
 
 Currently, support for @code{_Float@var{N}} or @code{_Float@var{N}x}
-types is not provided for any machine.
+types is only provided for @code{_Float128} on powerpc64le (PowerPC
+64-bits little-endian).
 
 @menu
 * Mathematical Constants::      Precise numeric values for often-used
diff --git a/sysdeps/powerpc/bits/floatn.h b/sysdeps/powerpc/bits/floatn.h
new file mode 100644
index 0000000..be57e70
--- /dev/null
+++ b/sysdeps/powerpc/bits/floatn.h
@@ -0,0 +1,92 @@
+/* Macros to control TS 18661-3 glibc features on powerpc.
+   Copyright (C) 2017 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
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _BITS_FLOATN_H
+#define _BITS_FLOATN_H
+
+#include <features.h>
+
+/* Defined to 1 if the current compiler invocation provides a
+   floating-point type with the IEEE 754 binary128 format, and this glibc
+   includes corresponding *f128 interfaces for it.  */
+#if defined _ARCH_PWR8 && defined __LITTLE_ENDIAN__ && (_CALL_ELF == 2) \
+    && defined __FLOAT128__
+# define __HAVE_FLOAT128 1
+#else
+# define __HAVE_FLOAT128 0
+#endif
+
+/* Defined to 1 if __HAVE_FLOAT128 is 1 and the type is ABI-distinct
+   from the default float, double and long double types in this glibc.  */
+#if __HAVE_FLOAT128
+# define __HAVE_DISTINCT_FLOAT128 1
+#else
+# define __HAVE_DISTINCT_FLOAT128 0
+#endif
+
+/* Defined to concatenate the literal suffix to be used with _Float128
+   types, if __HAVE_FLOAT128 is 1. */
+#if __HAVE_FLOAT128
+# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
+/* The literal suffix (f128) exist for powerpc only since GCC 7.0.  */
+#  define __f128(x) x##q
+# else
+#  define __f128(x) x##f128
+# endif
+#endif
+
+/* Defined to a complex binary128 type if __HAVE_FLOAT128 is 1.  */
+#if __HAVE_FLOAT128
+# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
+/* Add a typedef for older GCC compilers which don't natively support
+   _Complex _Float128.  */
+typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__KC__)));
+#  define __CFLOAT128 __cfloat128
+# else
+#  define __CFLOAT128 _Complex _Float128
+# endif
+#endif
+
+/* The remaining of this file provides support for older compilers.  */
+#if __HAVE_FLOAT128
+
+/* The type _Float128 exist for powerpc only since GCC 7.0.  */
+# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
+typedef __float128 _Float128;
+# endif
+
+/* Builtin __builtin_huge_valf128 doesn't exist before GCC 7.0.  */
+# if !__GNUC_PREREQ (7, 0)
+#  define __builtin_huge_valf128() ((_Float128) __builtin_huge_val ())
+# endif
+
+/* The following builtins (suffixed with 'q') are available in GCC >= 6.2,
+   which is the minimum version required for float128 support on powerpc64le.
+   Since GCC 7.0 the builtins suffixed with f128 are also available, then
+   there is no need to redefined them.  */
+# if !__GNUC_PREREQ (7, 0)
+#  define __builtin_copysignf128 __builtin_copysignq
+#  define __builtin_fabsf128 __builtin_fabsq
+#  define __builtin_inff128 __builtin_infq
+#  define __builtin_nanf128 __builtin_nanq
+#  define __builtin_nansf128 __builtin_nansq
+# endif
+
+#endif
+
+#endif /* _BITS_FLOATN_H */
diff --git a/sysdeps/powerpc/fpu/libm-test-ulps b/sysdeps/powerpc/fpu/libm-test-ulps
index 72eb2b1..7fb6744 100644
--- a/sysdeps/powerpc/fpu/libm-test-ulps
+++ b/sysdeps/powerpc/fpu/libm-test-ulps
@@ -3,1583 +3,1985 @@
 # Maximal error of functions:
 Function: "acos":
 float: 1
+float128: 1
 ifloat: 1
+ifloat128: 1
 ildouble: 1
 ldouble: 1
 
 Function: "acos_downward":
 double: 1
 float: 1
+float128: 1
 idouble: 1
 ifloat: 1
+ifloat128: 1
 ildouble: 3
 ldouble: 3
 
 Function: "acos_towardzero":
 double: 1
 float: 1
+float128: 1
 idouble: 1
 ifloat: 1
+ifloat128: 1
 ildouble: 3
 ldouble: 3
 
 Function: "acos_upward":
 double: 1
 float: 1
+float128: 1
 idouble: 1
 ifloat: 1
+ifloat128: 1
 ildouble: 2
 ldouble: 2
 
 Function: "acosh":
 double: 2
 float: 2
+float128: 2
 idouble: 2
 ifloat: 2
+ifloat128: 2
 ildouble: 2
 ldouble: 2
 
 Function: "acosh_downward":
 double: 2
 float: 2
+float128: 3
 idouble: 2
 ifloat: 2
+ifloat128: 3
 ildouble: 3
 ldouble: 3
 
 Function: "acosh_towardzero":
 double: 2
 float: 2
+float128: 2
 idouble: 2
 ifloat: 2
+ifloat128: 2
 ildouble: 4
 ldouble: 4
 
 Function: "acosh_upward":
 double: 2
 float: 2
+float128: 2
 idouble: 2
 ifloat: 2
+ifloat128: 2
 ildouble: 3
 ldouble: 4
 
 Function: "asin":
 float: 1
+float128: 1
 ifloat: 1
+ifloat128: 1
 ildouble: 2
 ldouble: 2
 
 Function: "asin_downward":
 double: 1
 float: 1
+float128: 2
 idouble: 1
 ifloat: 1
+ifloat128: 2
 ildouble: 2
 ldouble: 2
 
 Function: "asin_towardzero":
 double: 1
 float: 1
+float128: 1
 idouble: 1
 ifloat: 1
+ifloat128: 1
 ildouble: 1
 ldouble: 1
 
 Function: "asin_upward":
 double: 1
 float: 1
+float128: 2
 idouble: 1
 ifloat: 1
+ifloat128: 2
 ildouble: 2
 ldouble: 2
 
 Function: "asinh":
 double: 1
 float: 1
+float128: 3
 idouble: 1
 ifloat: 1
+ifloat128: 3
 ildouble: 2
 ldouble: 2
 
 Function: "asinh_downward":
 double: 3
 float: 3
+float128: 4
 idouble: 3
 ifloat: 3
+ifloat128: 4
 ildouble: 5
 ldouble: 5
 
 Function: "asinh_towardzero":
 double: 2
 float: 2
+float128: 2
 idouble: 2
 ifloat: 2
+ifloat128: 2
 ildouble: 5
 ldouble: 5
 
 Function: "asinh_upward":
 double: 3
 float: 3
+float128: 4
 idouble: 3
 ifloat: 3
+ifloat128: 4
 ildouble: 7
 ldouble: 7
 
 Function: "atan":
 double: 1
 float: 1
+float128: 1
 idouble: 1
 ifloat: 1
+ifloat128: 1
 ildouble: 1
 ldouble: 1
 
 Function: "atan2":
 float: 1
+float128: 1
 ifloat: 1
+ifloat128: 1
 ildouble: 2
 ldouble: 2
 
 Function: "atan2_downward":
 double: 1
 float: 2
+float128: 2
 idouble: 1
 ifloat: 2
+ifloat128: 2
 ildouble: 5
 ldouble: 5
 
 Function: "atan2_towardzero":
 double: 1
 float: 2
+float128: 3
 idouble: 1
 ifloat: 2
+ifloat128: 3
 ildouble: 6
 ldouble: 6
 
 Function: "atan2_upward":
 double: 1
 float: 1
+float128: 2
 idouble: 1
 ifloat: 1
+ifloat128: 2
 ildouble: 3
 ldouble: 3
 
 Function: "atan_downward":
 double: 1
 float: 2
+float128: 2
 idouble: 1
 ifloat: 2
+ifloat128: 2
 ildouble: 1
 ldouble: 1
 
 Function: "atan_towardzero":
 double: 1
 float: 1
+float128: 1
 idouble: 1
 ifloat: 1
+ifloat128: 1
 ildouble: 1
 ldouble: 1
 
 Function: "atan_upward":
 double: 1
 float: 2
+float128: 2
 idouble: 1
 ifloat: 2
+ifloat128: 2
 ildouble: 2
 ldouble: 2
 
 Function: "atanh":
 double: 2
 float: 2
+float128: 3
 idouble: 2
 ifloat: 2
+ifloat128: 3
 ildouble: 2
 ldouble: 2
 
 Function: "atanh_downward":
 double: 3
 float: 3
+float128: 4
 idouble: 3
 ifloat: 3
+ifloat128: 4
 ildouble: 3
 ldouble: 3
 
 Function: "atanh_towardzero":
 double: 2
 float: 2
+float128: 2
 idouble: 2
 ifloat: 2
+ifloat128: 2
 ildouble: 2
 ldouble: 2
 
 Function: "atanh_upward":
 double: 3
 float: 3
+float128: 4
 idouble: 3
 ifloat: 3
+ifloat128: 4
 ildouble: 4
 ldouble: 4
 
 Function: "cabs":
 double: 1
+float128: 1
 idouble: 1
+ifloat128: 1
 ildouble: 1
 ldouble: 1
 
 Function: "cabs_downward":
 double: 1
+float128: 1
 idouble: 1
+ifloat128: 1
 ildouble: 1
 ldouble: 1
 
 Function: "cabs_towardzero":
 double: 1
+float128: 1
 idouble: 1
+ifloat128: 1
 ildouble: 1
 ldouble: 1
 
 Function: "cabs_upward":
 double: 1
+float128: 1
 idouble: 1
+ifloat128: 1
 ildouble: 2
 ldouble: 2
 
 Function: Real part of "cacos":
 double: 1
 float: 2
+float128: 2
 idouble: 1
 ifloat: 2
+ifloat128: 2
 ildouble: 1
 ldouble: 1
 
 Function: Imaginary part of "cacos":
 double: 2
 float: 2
+float128: 2
 idouble: 2
 ifloat: 2
+ifloat128: 2
 ildouble: 2
 ldouble: 2
 
 Function: Real part of "cacos_downward":
 double: 3
 float: 2
+float128: 3
 idouble: 3
 ifloat: 2
+ifloat128: 3
 ildouble: 6
 ldouble: 6
 
 Function: Imaginary part of "cacos_downward":
 double: 5
 float: 3
+float128: 6
 idouble: 5
 ifloat: 3
+ifloat128: 6
 ildouble: 8
 ldouble: 8
 
 Function: Real part of "cacos_towardzero":
 double: 3
 float: 2
+float128: 3
 idouble: 3
 ifloat: 2
+ifloat128: 3
 ildouble: 7
 ldouble: 7
 
 Function: Imaginary part of "cacos_towardzero":
 double: 5
 float: 3
+float128: 5
 idouble: 5
 ifloat: 3
+ifloat128: 5
 ildouble: 8
 ldouble: 8
 
 Function: Real part of "cacos_upward":
 double: 2
 float: 2
+float128: 3
 idouble: 2
 ifloat: 2
+ifloat128: 3
 ildouble: 7
 ldouble: 7
 
 Function: Imaginary part of "cacos_upward":
 double: 5
 float: 5
+float128: 7
 idouble: 5
 ifloat: 5
+ifloat128: 7
 ildouble: 13
 ldouble: 13
 
 Function: Real part of "cacosh":
 double: 2
 float: 2
+float128: 2
 idouble: 2
 ifloat: 2
+ifloat128: 2
 ildouble: 2
 ldouble: 2
 
 Function: Imaginary part of "cacosh":
 double: 1
 float: 2
+float128: 2
 idouble: 1
 ifloat: 2
+ifloat128: 2
 ildouble: 1
 ldouble: 1
 
 Function: Real part of "cacosh_downward":
 double: 5
 float: 3
+float128: 5
 idouble: 5
 ifloat: 3
+ifloat128: 5
 ildouble: 8
 ldouble: 8
 
 Function: Imaginary part of "cacosh_downward":
 double: 3
 float: 3
+float128: 4
 idouble: 3
 ifloat: 3
+ifloat128: 4
 ildouble: 6
 ldouble: 6
 
 Function: Real part of "cacosh_towardzero":
 double: 5
 float: 3
+float128: 5
 idouble: 5
 ifloat: 3
+ifloat128: 5
 ildouble: 8
 ldouble: 8
 
 Function: Imaginary part of "cacosh_towardzero":
 double: 3
 float: 2
+float128: 3
 idouble: 3
 ifloat: 2
+ifloat128: 3
 ildouble: 7
 ldouble: 7
 
 Function: Real part of "cacosh_upward":
 double: 4
 float: 4
+float128: 6
 idouble: 4
 ifloat: 4
+ifloat128: 6
 ildouble: 12
 ldouble: 12
 
 Function: Imaginary part of "cacosh_upward":
 double: 3
 float: 2
+float128: 4
 idouble: 3
 ifloat: 2
+ifloat128: 4
 ildouble: 8
 ldouble: 8
 
 Function: "carg":
 double: 1
 float: 1
+float128: 2
 idouble: 1
 ifloat: 1
+ifloat128: 2
 ildouble: 2
 ldouble: 2
 
 Function: "carg_downward":
 double: 1
 float: 2
+float128: 2
 idouble: 1
 ifloat: 2
+ifloat128: 2
 ildouble: 5
 ldouble: 5
 
 Function: "carg_towardzero":
 double: 1
 float: 2
+float128: 3
 idouble: 1
 ifloat: 2
+ifloat128: 3
 ildouble: 6
 ldouble: 6
 
 Function: "carg_upward":
 double: 1
 float: 1
+float128: 2
 idouble: 1
 ifloat: 1
+ifloat128: 2
 ildouble: 3
 ldouble: 3
 
 Function: Real part of "casin":
 double: 1
 float: 1
+float128: 2
 idouble: 1
 ifloat: 1
+ifloat128: 2
 ildouble: 1
 ldouble: 1
 
 Function: Imaginary part of "casin":
 double: 2
 float: 2
+float128: 2
 idouble: 2
 ifloat: 2
+ifloat128: 2
 ildouble: 2
 ldouble: 2
 
 Function: Real part of "casin_downward":
 double: 3
 float: 2
+float128: 3
 idouble: 3
 ifloat: 2
+ifloat128: 3
 ildouble: 4
 ldouble: 4
 
 Function: Imaginary part of "casin_downward":
 double: 5
 float: 3
+float128: 6
 idouble: 5
 ifloat: 3
+ifloat128: 6
 ildouble: 8
 ldouble: 8
 
 Function: Real part of "casin_towardzero":
 double: 3
 float: 1
+float128: 3
 idouble: 3
 ifloat: 1
+ifloat128: 3
 ildouble: 5
 ldouble: 5
 
 Function: Imaginary part of "casin_towardzero":
 double: 5
 float: 3
+float128: 5
 idouble: 5
 ifloat: 3
+ifloat128: 5
 ildouble: 8
 ldouble: 8
 
 Function: Real part of "casin_upward":
 double: 3
 float: 2
+float128: 3
 idouble: 3
 ifloat: 2
+ifloat128: 3
 ildouble: 6
 ldouble: 6
 
 Function: Imaginary part of "casin_upward":
 double: 5
 float: 5
+float128: 7
 idouble: 5
 ifloat: 5
+ifloat128: 7
 ildouble: 13
 ldouble: 13
 
 Function: Real part of "casinh":
 double: 2
 float: 2
+float128: 2
 idouble: 2
 ifloat: 2
+ifloat128: 2
 ildouble: 2
 ldouble: 2
 
 Function: Imaginary part of "casinh":
 double: 1
 float: 1
+float128: 2
 idouble: 1
 ifloat: 1
+ifloat128: 2
 ildouble: 1
 ldouble: 1
 
 Function: Real part of "casinh_downward":
 double: 5
 float: 3
+float128: 6
 idouble: 5
 ifloat: 3
+ifloat128: 6
 ildouble: 8
 ldouble: 8
 
 Function: Imaginary part of "casinh_downward":
 double: 3
 float: 2
+float128: 3
 idouble: 3
 ifloat: 2
+ifloat128: 3
 ildouble: 4
 ldouble: 4
 
 Function: Real part of "casinh_towardzero":
 double: 5
 float: 3
+float128: 5
 idouble: 5
 ifloat: 3
+ifloat128: 5
 ildouble: 8
 ldouble: 8
 
 Function: Imaginary part of "casinh_towardzero":
 double: 3
 float: 1
+float128: 3
 idouble: 3
 ifloat: 1
+ifloat128: 3
 ildouble: 5
 ldouble: 5
 
 Function: Real part of "casinh_upward":
 double: 5
 float: 5
+float128: 7
 idouble: 5
 ifloat: 5
+ifloat128: 7
 ildouble: 13
 ldouble: 13
 
 Function: Imaginary part of "casinh_upward":
 double: 3
 float: 2
+float128: 3
 idouble: 3
 ifloat: 2
+ifloat128: 3
 ildouble: 6
 ldouble: 6
 
 Function: Real part of "catan":
 double: 1
 float: 1
+float128: 1
 idouble: 1
 ifloat: 1
+ifloat128: 1
 ildouble: 3
 ldouble: 3
 
 Function: Imaginary part of "catan":
 double: 1
 float: 1
+float128: 1
 idouble: 1
 ifloat: 1
+ifloat128: 1
 ildouble: 2
 ldouble: 2
 
 Function: Real part of "catan_downward":
 double: 1
 float: 2
+float128: 2
 idouble: 1
 ifloat: 2
+ifloat128: 2
 ildouble: 6
 ldouble: 6
 
 Function: Imaginary part of "catan_downward":
 double: 2
 float: 2
+float128: 2
 idouble: 2
 ifloat: 2
+ifloat128: 2
 ildouble: 7
 ldouble: 7
 
 Function: Real part of "catan_towardzero":
 double: 1
 float: 2
+float128: 2
 idouble: 1
 ifloat: 2
+ifloat128: 2
 ildouble: 7
 ldouble: 7
 
 Function: Imaginary part of "catan_towardzero":
 double: 2
 float: 2
+float128: 2
 idouble: 2
 ifloat: 2
+ifloat128: 2
 ildouble: 3
 ldouble: 3
 
 Function: Real part of "catan_upward":
 double: 1
 float: 1
+float128: 2
 idouble: 1
 ifloat: 1
+ifloat128: 2
 ildouble: 6
 ldouble: 6
 
 Function: Imaginary part of "catan_upward":
 double: 3
 float: 3
+float128: 3
 idouble: 3
 ifloat: 3
+ifloat128: 3
 ildouble: 8
 ldouble: 8
 
 Function: Real part of "catanh":
 double: 1
 float: 1
+float128: 1
 idouble: 1
 ifloat: 1
+ifloat128: 1
 ildouble: 2
 ldouble: 2
 
 Function: Imaginary part of "catanh":
 double: 1
 float: 1
+float128: 1
 idouble: 1
 ifloat: 1
+ifloat128: 1
 ildouble: 3
 ldouble: 3
 
 Function: Real part of "catanh_downward":
 double: 2
 float: 2
+float128: 2
 idouble: 2
 ifloat: 2
+ifloat128: 2
 ildouble: 5
 ldouble: 5
 
 Function: Imaginary part of "catanh_downward":
 double: 1
 float: 2
+float128: 2
 idouble: 1
 ifloat: 2
+ifloat128: 2
 ildouble: 6
 ldouble: 6
 
 Function: Real part of "catanh_towardzero":
 double: 2
 float: 2
+float128: 2
 idouble: 2
 ifloat: 2
+ifloat128: 2
 ildouble: 3
 ldouble: 3
 
 Function: Imaginary part of "catanh_towardzero":
 double: 1
 float: 2
+float128: 2
 idouble: 1
 ifloat: 2
+ifloat128: 2
 ildouble: 7
 ldouble: 7
 
 Function: Real part of "catanh_upward":
 double: 4
 float: 4
+float128: 4
 idouble: 4
 ifloat: 4
+ifloat128: 4
 ildouble: 8
 ldouble: 8
 
 Function: Imaginary part of "catanh_upward":
 double: 1
 float: 1
+float128: 2
 idouble: 1
 ifloat: 1
+ifloat128: 2
 ildouble: 6
 ldouble: 6
 
 Function: "cbrt":
 double: 3
 float: 1
+float128: 1
 idouble: 3
 ifloat: 1
+ifloat128: 1
 ildouble: 1
 ldouble: 1
 
 Function: "cbrt_downward":
 double: 4
 float: 1
+float128: 1
 idouble: 4
 ifloat: 1
+ifloat128: 1
 ildouble: 5
 ldouble: 5
 
 Function: "cbrt_towardzero":
 double: 3
 float: 1
+float128: 1
 idouble: 3
 ifloat: 1
+ifloat128: 1
 ildouble: 3
 ldouble: 3
 
 Function: "cbrt_upward":
 double: 5
 float: 1
+float128: 1
 idouble: 5
 ifloat: 1
+ifloat128: 1
 ildouble: 2
 ldouble: 2
 
 Function: Real part of "ccos":
 double: 1
 float: 1
+float128: 1
 idouble: 1
 ifloat: 1
+ifloat128: 1
 ildouble: 1
 ldouble: 1
 
 Function: Imaginary part of "ccos":
 double: 1
 float: 1
+float128: 1
 idouble: 1
 ifloat: 1
+ifloat128: 1
 ildouble: 2
 ldouble: 2
 
 Function: Real part of "ccos_downward":
 double: 1
 float: 1
+float128: 2
 idouble: 1
 ifloat: 1
+ifloat128: 2
 ildouble: 6
 ldouble: 6
 
 Function: Imaginary part of "ccos_downward":
 double: 2
 float: 3
+float128: 2
 idouble: 2
 ifloat: 3
+ifloat128: 2
 ildouble: 6
 ldouble: 6
 
 Function: Real part of "ccos_towardzero":
 double: 1
 float: 2
+float128: 2
 idouble: 1
 ifloat: 2
+ifloat128: 2
 ildouble: 6
 ldouble: 6
 
 Function: Imaginary part of "ccos_towardzero":
 double: 2
 float: 3
+float128: 2
 idouble: 2
 ifloat: 3
+ifloat128: 2
 ildouble: 6
 ldouble: 6
 
 Function: Real part of "ccos_upward":
 double: 1
 float: 2
+float128: 3
 idouble: 1
 ifloat: 2
+ifloat128: 3
 ildouble: 3
 ldouble: 3
 
 Function: Imaginary part of "ccos_upward":
 double: 2
 float: 2
+float128: 2
 idouble: 2
 ifloat: 2
+ifloat128: 2
 ildouble: 4
 ldouble: 4
 
 Function: Real part of "ccosh":
 double: 1
 float: 1
+float128: 1
 idouble: 1
 ifloat: 1
+ifloat128: 1
 ildouble: 1
 ldouble: 1
 
 Function: Imaginary part of "ccosh":
 double: 1
 float: 1
+float128: 1
 idouble: 1
 ifloat: 1
+ifloat128: 1
 ildouble: 2
 ldouble: 2
 
 Function: Real part of "ccosh_downward":
 double: 1
 float: 3
+float128: 2
 idouble: 1
 ifloat: 3
+ifloat128: 2
 ildouble: 6
 ldouble: 6
 
 Function: Imaginary part of "ccosh_downward":
 double: 2
 float: 3
+float128: 2
 idouble: 2
 ifloat: 3
+ifloat128: 2
 ildouble: 6
 ldouble: 6
 
 Function: Real part of "ccosh_towardzero":
 double: 1
 float: 3
+float128: 2
 idouble: 1
 ifloat: 3
+ifloat128: 2
 ildouble: 6
 ldouble: 6
 
 Function: Imaginary part of "ccosh_towardzero":
 double: 2
 float: 3
+float128: 2
 idouble: 2
 ifloat: 3
+ifloat128: 2
 ildouble: 6
 ldouble: 6
 
 Function: Real part of "ccosh_upward":
 double: 1
 float: 2
+float128: 3
 idouble: 1
 ifloat: 2
+ifloat128: 3
 ildouble: 3
 ldouble: 3
 
 Function: Imaginary part of "ccosh_upward":
 double: 2
 float: 2
+float128: 2
 idouble: 2
 ifloat: 2
+ifloat128: 2
 ildouble: 4
 ldouble: 4
 
 Function: Real part of "cexp":
 double: 2
 float: 1
+float128: 1
 idouble: 2
 ifloat: 1
+ifloat128: 1
 ildouble: 2
 ldouble: 2
 
 Function: Imaginary part of "cexp":
 double: 1
 float: 2
+float128: 1
 idouble: 1
 ifloat: 2
+ifloat128: 1
 ildouble: 2
 ldouble: 2
 
 Function: Real part of "cexp_downward":
 double: 1
 float: 2
+float128: 2
 idouble: 1
 ifloat: 2
+ifloat128: 2
 ildouble: 11
 ldouble: 11
 
 Function: Imaginary part of "cexp_downward":
 double: 1
 float: 3
+float128: 2
 idouble: 1
 ifloat: 3
+ifloat128: 2
 ildouble: 11
 ldouble: 11
 
 Function: Real part of "cexp_towardzero":
 double: 1
 float: 2
+float128: 2
 idouble: 1
 ifloat: 2
+ifloat128: 2
 ildouble: 11
 ldouble: 11
 
 Function: Imaginary part of "cexp_towardzero":
 double: 1
 float: 3
+float128: 2
 idouble: 1
 ifloat: 3
+ifloat128: 2
 ildouble: 11
 ldouble: 11
 
 Function: Real part of "cexp_upward":
 double: 1
 float: 2
+float128: 3
 idouble: 1
 ifloat: 2
+ifloat128: 3
 ildouble: 3
 ldouble: 3
 
 Function: Imaginary part of "cexp_upward":
 double: 1
 float: 2
+float128: 3
 idouble: 1
 ifloat: 2
+ifloat128: 3
 ildouble: 3
 ldouble: 3
 
 Function: Real part of "clog":
 double: 3
 float: 3
+float128: 2
 idouble: 3
 ifloat: 3
+ifloat128: 2
 ildouble: 5
 ldouble: 5
 
 Function: Imaginary part of "clog":
 double: 1
 float: 1
+float128: 1
 idouble: 1
 ifloat: 1
+ifloat128: 1
 ildouble: 2
 ldouble: 2
 
 Function: Real part of "clog10":
 double: 3
 float: 4
+float128: 2
 idouble: 3
 ifloat: 4
+ifloat128: 2
 ildouble: 3
 ldouble: 3
 
 Function: Imaginary part of "clog10":
 double: 2
 float: 2
+float128: 2
 idouble: 2
 ifloat: 2
+ifloat128: 2
 ildouble: 2
 ldouble: 2
 
 Function: Real part of "clog10_downward":
 double: 6
 float: 6
+float128: 3
 idouble: 6
 ifloat: 6
+ifloat128: 3
 ildouble: 10
 ldouble: 10
 
 Function: Imaginary part of "clog10_downward":
 double: 2
 float: 4
+float128: 3
 idouble: 2
 ifloat: 4
+ifloat128: 3
 ildouble: 7
 ldouble: 7
 
 Function: Real part of "clog10_towardzero":
 double: 5
 float: 5
+float128: 4
 idouble: 5
 ifloat: 5
+ifloat128: 4
 ildouble: 9
 ldouble: 9
 
 Function: Imaginary part of "clog10_towardzero":
 double: 2
 float: 4
+float128: 3
 idouble: 2
 ifloat: 4
+ifloat128: 3
 ildouble: 8
 ldouble: 8
 
 Function: Real part of "clog10_upward":
 double: 8
 float: 5
+float128: 4
 idouble: 8
 ifloat: 5
+ifloat128: 4
 ildouble: 10
 ldouble: 10
 
 Function: Imaginary part of "clog10_upward":
 double: 2
 float: 4
+float128: 3
 idouble: 2
 ifloat: 4
+ifloat128: 3
 ildouble: 7
 ldouble: 7
 
 Function: Real part of "clog_downward":
 double: 7
 float: 5
+float128: 3
 idouble: 7
 ifloat: 5
+ifloat128: 3
 ildouble: 11
 ldouble: 11
 
 Function: Imaginary part of "clog_downward":
 double: 1
 float: 2
+float128: 2
 idouble: 1
 ifloat: 2
+ifloat128: 2
 ildouble: 5
 ldouble: 5
 
 Function: Real part of "clog_towardzero":
 double: 7
 float: 5
+float128: 3
 idouble: 7
 ifloat: 5
+ifloat128: 3
 ildouble: 10
 ldouble: 10
 
 Function: Imaginary part of "clog_towardzero":
 double: 1
 float: 3
+float128: 2
 idouble: 1
 ifloat: 3
+ifloat128: 2
 ildouble: 7
 ldouble: 7
 
 Function: Real part of "clog_upward":
 double: 8
 float: 5
+float128: 4
 idouble: 8
 ifloat: 5
+ifloat128: 4
 ildouble: 10
 ldouble: 10
 
 Function: Imaginary part of "clog_upward":
 double: 1
 float: 2
+float128: 2
 idouble: 1
 ifloat: 2
+ifloat128: 2
 ildouble: 4
 ldouble: 4
 
 Function: "cos":
 float: 3
+float128: 1
 ifloat: 3
+ifloat128: 1
 ildouble: 4
 ldouble: 4
 
 Function: "cos_downward":
 double: 1
 float: 4
+float128: 3
 idouble: 1
 ifloat: 4
+ifloat128: 3
 ildouble: 5
 ldouble: 5
 
 Function: "cos_towardzero":
 double: 1
 float: 3
+float128: 1
 idouble: 1
 ifloat: 3
+ifloat128: 1
 ildouble: 4
 ldouble: 4
 
 Function: "cos_upward":
 double: 1
 float: 3
+float128: 2
 idouble: 1
 ifloat: 3
+ifloat128: 2
 ildouble: 5
 ldouble: 5
 
 Function: "cosh":
 double: 1
 float: 1
+float128: 1
 idouble: 1
 ifloat: 1
+ifloat128: 1
 ildouble: 3
 ldouble: 3
 
 Function: "cosh_downward":
 double: 1
 float: 1
+float128: 2
 idouble: 1
 ifloat: 1
+ifloat128: 1
 ildouble: 2
 ldouble: 2
 
 Function: "cosh_towardzero":
 double: 1
 float: 1
+float128: 2
 idouble: 1
 ifloat: 1
+ifloat128: 1
 ildouble: 2
 ldouble: 2
 
 Function: "cosh_upward":
 double: 1
 float: 2
+float128: 3
 idouble: 1
 ifloat: 2
+ifloat128: 1
 ildouble: 2
 ldouble: 2
 
 Function: Real part of "cpow":
 double: 2
 float: 5
+float128: 4
 idouble: 2
 ifloat: 5
+ifloat128: 4
 ildouble: 4
 ldouble: 4
 
 Function: Imaginary part of "cpow":
 float: 2
+float128: 9
 ifloat: 2
+ifloat128: 9
 ildouble: 2
 ldouble: 2
 
 Function: Real part of "cpow_downward":
 double: 4
 float: 8
+float128: 6
 idouble: 4
 ifloat: 8
+ifloat128: 6
 ildouble: 7
 ldouble: 7
 
 Function: Imaginary part of "cpow_downward":
 double: 1
 float: 2
+float128: 2
 idouble: 1
 ifloat: 2
+ifloat128: 2
 ildouble: 4
 ldouble: 4
 
 Function: Real part of "cpow_towardzero":
 double: 4
 float: 8
+float128: 6
 idouble: 4
 ifloat: 8
+ifloat128: 6
 ildouble: 8
 ldouble: 8
 
 Function: Imaginary part of "cpow_towardzero":
 double: 1
 float: 2
+float128: 2
 idouble: 1
 ifloat: 2
+ifloat128: 2
 ildouble: 4
 ldouble: 4
 
 Function: Real part of "cpow_upward":
 double: 4
 float: 1
+float128: 3
 idouble: 4
 ifloat: 1
+ifloat128: 3
 ildouble: 3
 ldouble: 3
 
 Function: Imaginary part of "cpow_upward":
 double: 1
 float: 2
+float128: 2
 idouble: 1
 ifloat: 2
+ifloat128: 2
 ildouble: 3
 ldouble: 3
 
 Function: Real part of "csin":
 double: 1
 float: 1
+float128: 1
 idouble: 1
 ifloat: 1
+ifloat128: 1
 ildouble: 2
 ldouble: 2
 
 Function: Imaginary part of "csin":
+float128: 1
+ifloat128: 1
 ildouble: 1
 ldouble: 1
 
 Function: Real part of "csin_downward":
 double: 2
 float: 3
+float128: 2
 idouble: 2
 ifloat: 3
+ifloat128: 2
 ildouble: 6
 ldouble: 6
 
 Function: Imaginary part of "csin_downward":
 double: 1
 float: 1
+float128: 2
 idouble: 1
 ifloat: 1
+ifloat128: 2
 ildouble: 6
 ldouble: 6
 
 Function: Real part of "csin_towardzero":
 double: 2
 float: 3
+float128: 2
 idouble: 2
 ifloat: 3
+ifloat128: 2
 ildouble: 6
 ldouble: 6
 
 Function: Imaginary part of "csin_towardzero":
 double: 1
 float: 1
+float128: 2
 idouble: 1
 ifloat: 1
+ifloat128: 2
 ildouble: 6
 ldouble: 6
 
 Function: Real part of "csin_upward":
 double: 2
 float: 2
+float128: 2
 idouble: 2
 ifloat: 2
+ifloat128: 2
 ildouble: 3
 ldouble: 3
 
 Function: Imaginary part of "csin_upward":
 double: 1
 float: 2
+float128: 3
 idouble: 1
 ifloat: 2
+ifloat128: 3
 ildouble: 3
 ldouble: 3
 
 Function: Real part of "csinh":
 float: 1
+float128: 1
 ifloat: 1
+ifloat128: 1
 ildouble: 1
 ldouble: 1
 
 Function: Imaginary part of "csinh":
 double: 1
 float: 1
+float128: 1
 idouble: 1
 ifloat: 1
+ifloat128: 1
 ildouble: 2
 ldouble: 2
 
 Function: Real part of "csinh_downward":
 double: 2
 float: 2
+float128: 2
 idouble: 2
 ifloat: 2
+ifloat128: 2
 ildouble: 6
 ldouble: 6
 
 Function: Imaginary part of "csinh_downward":
 double: 2
 float: 3
+float128: 2
 idouble: 2
 ifloat: 3
+ifloat128: 2
 ildouble: 6
 ldouble: 6
 
 Function: Real part of "csinh_towardzero":
 double: 2
 float: 2
+float128: 2
 idouble: 2
 ifloat: 2
+ifloat128: 2
 ildouble: 6
 ldouble: 6
 
 Function: Imaginary part of "csinh_towardzero":
 double: 2
 float: 3
+float128: 2
 idouble: 2
 ifloat: 3
+ifloat128: 2
 ildouble: 6
 ldouble: 6
 
 Function: Real part of "csinh_upward":
 double: 1
 float: 2
+float128: 3
 idouble: 1
 ifloat: 2
+ifloat128: 3
 ildouble: 3
 ldouble: 3
 
 Function: Imaginary part of "csinh_upward":
 double: 2
 float: 2
+float128: 2
 idouble: 2
 ifloat: 2
+ifloat128: 2
 ildouble: 3
 ldouble: 3
 
 Function: Real part of "csqrt":
 double: 2
 float: 2
+float128: 2
 idouble: 2
 ifloat: 2
+ifloat128: 2
 ildouble: 1
 ldouble: 1
 
 Function: Imaginary part of "csqrt":
 double: 2
 float: 2
+float128: 2
 idouble: 2
 ifloat: 2
+ifloat128: 2
 ildouble: 1
 ldouble: 1
 
 Function: Real part of "csqrt_downward":
 double: 5
 float: 4
+float128: 4
 idouble: 5
 ifloat: 4
+ifloat128: 4
 ildouble: 4
 ldouble: 4
 
 Function: Imaginary part of "csqrt_downward":
 double: 4
 float: 3
+float128: 3
 idouble: 4
 ifloat: 3
+ifloat128: 3
 ildouble: 5
 ldouble: 5
 
 Function: Real part of "csqrt_towardzero":
 double: 4
 float: 3
+float128: 3
 idouble: 4
 ifloat: 3
+ifloat128: 3
 ildouble: 5
 ldouble: 5
 
 Function: Imaginary part of "csqrt_towardzero":
 double: 4
 float: 3
+float128: 3
 idouble: 4
 ifloat: 3
+ifloat128: 3
 ildouble: 5
 ldouble: 5
 
 Function: Real part of "csqrt_upward":
 double: 5
 float: 4
+float128: 4
 idouble: 5
 ifloat: 4
+ifloat128: 4
 ildouble: 12
 ldouble: 12
 
 Function: Imaginary part of "csqrt_upward":
 double: 3
 float: 3
+float128: 3
 idouble: 3
 ifloat: 3
+ifloat128: 3
 ildouble: 8
 ldouble: 8
 
 Function: Real part of "ctan":
 double: 1
 float: 1
+float128: 3
 idouble: 1
 ifloat: 1
+ifloat128: 3
 ildouble: 3
 ldouble: 3
 
 Function: Imaginary part of "ctan":
 double: 2
 float: 1
+float128: 3
 idouble: 2
 ifloat: 1
+ifloat128: 3
 ildouble: 2
 ldouble: 2
 
 Function: Real part of "ctan_downward":
 double: 6
 float: 5
+float128: 4
 idouble: 6
 ifloat: 5
+ifloat128: 4
 ildouble: 6
 ldouble: 6
 
 Function: Imaginary part of "ctan_downward":
 double: 2
 float: 1
+float128: 5
 idouble: 2
 ifloat: 1
+ifloat128: 5
 ildouble: 9
 ldouble: 9
 
 Function: Real part of "ctan_towardzero":
 double: 5
 float: 3
+float128: 4
 idouble: 5
 ifloat: 3
+ifloat128: 4
 ildouble: 6
 ldouble: 6
 
 Function: Imaginary part of "ctan_towardzero":
 double: 2
 float: 2
+float128: 5
 idouble: 2
 ifloat: 2
+ifloat128: 5
 ildouble: 13
 ldouble: 13
 
 Function: Real part of "ctan_upward":
 double: 2
 float: 3
+float128: 5
 idouble: 2
 ifloat: 3
+ifloat128: 5
 ildouble: 7
 ldouble: 7
 
 Function: Imaginary part of "ctan_upward":
 double: 2
 float: 3
+float128: 5
 idouble: 2
 ifloat: 3
+ifloat128: 5
 ildouble: 10
 ldouble: 10
 
 Function: Real part of "ctanh":
 double: 2
 float: 2
+float128: 3
 idouble: 2
 ifloat: 2
+ifloat128: 3
 ildouble: 3
 ldouble: 3
 
 Function: Imaginary part of "ctanh":
 double: 2
 float: 1
+float128: 3
 idouble: 2
 ifloat: 1
+ifloat128: 3
 ildouble: 3
 ldouble: 3
 
 Function: Real part of "ctanh_downward":
 double: 4
 float: 1
+float128: 5
 idouble: 4
 ifloat: 1
+ifloat128: 5
 ildouble: 9
 ldouble: 9
 
 Function: Imaginary part of "ctanh_downward":
 double: 6
 float: 5
+float128: 4
 idouble: 6
 ifloat: 5
+ifloat128: 4
 ildouble: 6
 ldouble: 6
 
 Function: Real part of "ctanh_towardzero":
 double: 2
 float: 2
+float128: 5
 idouble: 2
 ifloat: 2
+ifloat128: 5
 ildouble: 13
 ldouble: 13
 
 Function: Imaginary part of "ctanh_towardzero":
 double: 5
 float: 2
+float128: 3
 idouble: 5
 ifloat: 2
+ifloat128: 3
 ildouble: 10
 ldouble: 10
 
 Function: Real part of "ctanh_upward":
 double: 2
 float: 3
+float128: 5
 idouble: 2
 ifloat: 3
+ifloat128: 5
 ildouble: 10
 ldouble: 10
 
 Function: Imaginary part of "ctanh_upward":
 double: 2
 float: 3
+float128: 5
 idouble: 2
 ifloat: 3
+ifloat128: 5
 ildouble: 10
 ldouble: 10
 
 Function: "erf":
 double: 1
 float: 1
+float128: 1
 idouble: 1
 ifloat: 1
+ifloat128: 1
 ildouble: 1
 ldouble: 1
 
 Function: "erf_downward":
 double: 1
 float: 1
+float128: 2
 idouble: 1
 ifloat: 1
+ifloat128: 2
 ildouble: 2
 ldouble: 2
 
 Function: "erf_towardzero":
 double: 1
 float: 1
+float128: 1
 idouble: 1
 ifloat: 1
+ifloat128: 1
 ildouble: 2
 ldouble: 2
 
 Function: "erf_upward":
 double: 1
 float: 1
+float128: 2
 idouble: 1
 ifloat: 1
+ifloat128: 2
 ildouble: 3
 ldouble: 3
 
 Function: "erfc":
 double: 2
 float: 2
+float128: 2
 idouble: 2
 ifloat: 2
+ifloat128: 2
 ildouble: 3
 ldouble: 3
 
 Function: "erfc_downward":
 double: 3
 float: 4
+float128: 5
 idouble: 3
 ifloat: 4
+ifloat128: 5
 ildouble: 10
 ldouble: 10
 
 Function: "erfc_towardzero":
 double: 3
 float: 3
+float128: 4
 idouble: 3
 ifloat: 3
+ifloat128: 4
 ildouble: 9
 ldouble: 9
 
 Function: "erfc_upward":
 double: 3
 float: 4
+float128: 5
 idouble: 3
 ifloat: 4
+ifloat128: 5
 ildouble: 7
 ldouble: 7
 
 Function: "exp":
 double: 1
 float: 1
+float128: 1
 idouble: 1
 ifloat: 1
+ifloat128: 1
 ildouble: 1
 ldouble: 1
 
 Function: "exp10":
 double: 2
+float128: 2
 idouble: 2
+ifloat128: 2
 ildouble: 1
 ldouble: 1
 
 Function: "exp10_downward":
 double: 2
 float: 1
+float128: 3
 idouble: 2
 ifloat: 1
+ifloat128: 3
 ildouble: 9
 ldouble: 9
 
 Function: "exp10_towardzero":
 double: 2
 float: 1
+float128: 3
 idouble: 2
 ifloat: 1
+ifloat128: 3
 ildouble: 9
 ldouble: 9
 
 Function: "exp10_upward":
 double: 2
 float: 1
+float128: 3
 idouble: 2
 ifloat: 1
+ifloat128: 3
 ildouble: 4
 ldouble: 4
 
 Function: "exp2":
 double: 1
 float: 1
+float128: 1
 idouble: 1
 ifloat: 1
+ifloat128: 1
 ildouble: 2
 ldouble: 2
 
 Function: "exp2_downward":
 double: 1
 float: 1
+float128: 1
 idouble: 1
 ifloat: 1
+ifloat128: 1
 ildouble: 1
 ldouble: 1
 
 Function: "exp2_towardzero":
 double: 1
 float: 1
+float128: 1
 idouble: 1
 ifloat: 1
+ifloat128: 1
 ildouble: 2
 ldouble: 2
 
 Function: "exp2_upward":
 double: 1
 float: 1
+float128: 2
 idouble: 1
 ifloat: 1
+ifloat128: 2
 ildouble: 2
 ldouble: 2
 
@@ -1606,32 +2008,40 @@ ldouble: 1
 Function: "expm1":
 double: 1
 float: 1
+float128: 1
 idouble: 1
 ifloat: 1
+ifloat128: 1
 ildouble: 1
 ldouble: 1
 
 Function: "expm1_downward":
 double: 1
 float: 1
+float128: 2
 idouble: 1
 ifloat: 1
+ifloat128: 2
 ildouble: 3
 ldouble: 3
 
 Function: "expm1_towardzero":
 double: 1
 float: 2
+float128: 4
 idouble: 1
 ifloat: 2
+ifloat128: 4
 ildouble: 5
 ldouble: 5
 
 Function: "expm1_upward":
 double: 1
 float: 1
+float128: 3
 idouble: 1
 ifloat: 1
+ifloat128: 3
 ildouble: 6
 ldouble: 6
 
@@ -1670,306 +2080,386 @@ ldouble: 1
 Function: "gamma":
 double: 3
 float: 4
+float128: 9
 idouble: 3
 ifloat: 4
+ifloat128: 9
 ildouble: 3
 ldouble: 3
 
 Function: "gamma_downward":
 double: 4
 float: 4
+float128: 9
 idouble: 4
 ifloat: 4
+ifloat128: 9
 ildouble: 15
 ldouble: 15
 
 Function: "gamma_towardzero":
 double: 4
 float: 3
+float128: 9
 idouble: 4
 ifloat: 3
+ifloat128: 9
 ildouble: 16
 ldouble: 16
 
 Function: "gamma_upward":
 double: 4
 float: 5
+float128: 9
 idouble: 4
 ifloat: 5
+ifloat128: 9
 ildouble: 11
 ldouble: 11
 
 Function: "hypot":
 double: 1
+float128: 1
 idouble: 1
+ifloat128: 1
 ildouble: 1
 ldouble: 1
 
 Function: "hypot_downward":
 double: 1
+float128: 1
 idouble: 1
+ifloat128: 1
 ildouble: 2
 ldouble: 2
 
 Function: "hypot_towardzero":
 double: 1
+float128: 1
 idouble: 1
+ifloat128: 1
 ildouble: 2
 ldouble: 2
 
 Function: "hypot_upward":
 double: 1
+float128: 1
 idouble: 1
+ifloat128: 1
 ildouble: 3
 ldouble: 3
 
 Function: "j0":
 double: 2
 float: 2
+float128: 2
 idouble: 2
 ifloat: 2
+ifloat128: 2
 ildouble: 2
 ldouble: 2
 
 Function: "j0_downward":
 double: 2
 float: 3
+float128: 4
 idouble: 2
 ifloat: 3
+ifloat128: 4
 ildouble: 11
 ldouble: 11
 
 Function: "j0_towardzero":
 double: 2
 float: 1
+float128: 2
 idouble: 2
 ifloat: 1
+ifloat128: 2
 ildouble: 8
 ldouble: 8
 
 Function: "j0_upward":
 double: 3
 float: 2
+float128: 5
 idouble: 3
 ifloat: 2
+ifloat128: 5
 ildouble: 6
 ldouble: 6
 
 Function: "j1":
 double: 1
 float: 2
+float128: 4
 idouble: 1
 ifloat: 2
+ifloat128: 4
 ildouble: 2
 ldouble: 2
 
 Function: "j1_downward":
 double: 3
 float: 2
+float128: 4
 idouble: 3
 ifloat: 2
+ifloat128: 4
 ildouble: 7
 ldouble: 7
 
 Function: "j1_towardzero":
 double: 3
 float: 2
+float128: 4
 idouble: 3
 ifloat: 2
+ifloat128: 4
 ildouble: 7
 ldouble: 7
 
 Function: "j1_upward":
 double: 3
 float: 4
+float128: 3
 idouble: 3
 ifloat: 4
+ifloat128: 3
 ildouble: 6
 ldouble: 6
 
 Function: "jn":
 double: 4
 float: 4
+float128: 7
 idouble: 4
 ifloat: 4
+ifloat128: 7
 ildouble: 4
 ldouble: 4
 
 Function: "jn_downward":
 double: 4
 float: 5
+float128: 8
 idouble: 4
 ifloat: 5
+ifloat128: 8
 ildouble: 7
 ldouble: 7
 
 Function: "jn_towardzero":
 double: 4
 float: 5
+float128: 8
 idouble: 4
 ifloat: 5
+ifloat128: 8
 ildouble: 7
 ldouble: 7
 
 Function: "jn_upward":
 double: 5
 float: 4
+float128: 7
 idouble: 5
 ifloat: 4
+ifloat128: 7
 ildouble: 5
 ldouble: 5
 
 Function: "lgamma":
 double: 3
 float: 4
+float128: 9
 idouble: 3
 ifloat: 4
+ifloat128: 9
 ildouble: 3
 ldouble: 3
 
 Function: "lgamma_downward":
 double: 4
 float: 4
+float128: 9
 idouble: 4
 ifloat: 4
+ifloat128: 9
 ildouble: 15
 ldouble: 15
 
 Function: "lgamma_towardzero":
 double: 4
 float: 3
+float128: 9
 idouble: 4
 ifloat: 3
+ifloat128: 9
 ildouble: 16
 ldouble: 16
 
 Function: "lgamma_upward":
 double: 4
 float: 5
+float128: 9
 idouble: 4
 ifloat: 5
+ifloat128: 9
 ildouble: 11
 ldouble: 11
 
 Function: "log":
 float: 1
+float128: 1
 ifloat: 1
+ifloat128: 1
 ildouble: 1
 ldouble: 1
 
 Function: "log10":
 double: 2
 float: 2
+float128: 1
 idouble: 2
 ifloat: 2
+ifloat128: 1
 ildouble: 1
 ldouble: 1
 
 Function: "log10_downward":
 double: 2
 float: 3
+float128: 1
 idouble: 2
 ifloat: 3
+ifloat128: 1
 ildouble: 1
 ldouble: 1
 
 Function: "log10_towardzero":
 double: 2
 float: 2
+float128: 1
 idouble: 2
 ifloat: 2
+ifloat128: 1
 ildouble: 2
 ldouble: 2
 
 Function: "log10_upward":
 double: 2
 float: 2
+float128: 1
 idouble: 2
 ifloat: 2
+ifloat128: 1
 ildouble: 1
 ldouble: 1
 
 Function: "log1p":
 double: 1
 float: 1
+float128: 2
 idouble: 1
 ifloat: 1
+ifloat128: 2
 ildouble: 2
 ldouble: 2
 
 Function: "log1p_downward":
 double: 1
 float: 2
+float128: 3
 idouble: 1
 ifloat: 2
+ifloat128: 3
 ildouble: 2
 ldouble: 2
 
 Function: "log1p_towardzero":
 double: 2
 float: 2
+float128: 3
 idouble: 2
 ifloat: 2
+ifloat128: 3
 ildouble: 3
 ldouble: 3
 
 Function: "log1p_upward":
 double: 2
 float: 2
+float128: 2
 idouble: 2
 ifloat: 2
+ifloat128: 2
 ildouble: 3
 ldouble: 3
 
 Function: "log2":
 double: 1
 float: 1
+float128: 2
 idouble: 1
 ifloat: 1
+ifloat128: 2
 ildouble: 1
 ldouble: 1
 
 Function: "log2_downward":
 double: 3
 float: 3
+float128: 3
 idouble: 3
 ifloat: 3
+ifloat128: 3
 ildouble: 2
 ldouble: 2
 
 Function: "log2_towardzero":
 double: 2
 float: 2
+float128: 1
 idouble: 2
 ifloat: 2
+ifloat128: 1
 ildouble: 4
 ldouble: 4
 
 Function: "log2_upward":
 double: 3
 float: 3
+float128: 1
 idouble: 3
 ifloat: 3
+ifloat128: 1
 ildouble: 4
 ldouble: 4
 
 Function: "log_downward":
 float: 2
+float128: 1
 ifloat: 2
+ifloat128: 1
 ildouble: 1
 ldouble: 1
 
 Function: "log_towardzero":
 float: 2
+float128: 2
 ifloat: 2
+ifloat128: 2
 ildouble: 2
 ldouble: 2
 
 Function: "log_upward":
 double: 1
 float: 2
+float128: 1
 idouble: 1
 ifloat: 2
+ifloat128: 1
 ildouble: 1
 ldouble: 1
 
@@ -1983,153 +2473,193 @@ ldouble: 1
 
 Function: "pow":
 float: 1
+float128: 2
 ifloat: 1
+ifloat128: 2
 ildouble: 1
 ldouble: 1
 
 Function: "pow10":
 double: 2
+float128: 2
 idouble: 2
+ifloat128: 2
 ildouble: 1
 ldouble: 1
 
 Function: "pow10_downward":
 double: 2
 float: 1
+float128: 3
 idouble: 2
 ifloat: 1
+ifloat128: 3
 ildouble: 9
 ldouble: 9
 
 Function: "pow10_towardzero":
 double: 2
 float: 1
+float128: 3
 idouble: 2
 ifloat: 1
+ifloat128: 3
 ildouble: 9
 ldouble: 9
 
 Function: "pow10_upward":
 double: 2
 float: 1
+float128: 3
 idouble: 2
 ifloat: 1
+ifloat128: 3
 ildouble: 4
 ldouble: 4
 
 Function: "pow_downward":
 double: 1
 float: 1
+float128: 2
 idouble: 1
 ifloat: 1
+ifloat128: 2
 ildouble: 1
 ldouble: 1
 
 Function: "pow_towardzero":
 double: 1
 float: 1
+float128: 2
 idouble: 1
 ifloat: 1
+ifloat128: 2
 ildouble: 1
 ldouble: 1
 
 Function: "pow_upward":
 double: 1
 float: 1
+float128: 2
 idouble: 1
 ifloat: 1
+ifloat128: 2
 ildouble: 1
 ldouble: 1
 
 Function: "sin":
 float: 1
+float128: 1
 ifloat: 1
+ifloat128: 1
 ildouble: 1
 ldouble: 1
 
 Function: "sin_downward":
 double: 1
 float: 2
+float128: 3
 idouble: 1
 ifloat: 2
+ifloat128: 3
 ildouble: 4
 ldouble: 4
 
 Function: "sin_towardzero":
 double: 1
 float: 1
+float128: 2
 idouble: 1
 ifloat: 1
+ifloat128: 2
 ildouble: 4
 ldouble: 4
 
 Function: "sin_upward":
 double: 1
 float: 2
+float128: 3
 idouble: 1
 ifloat: 2
+ifloat128: 3
 ildouble: 5
 ldouble: 5
 
 Function: "sincos":
 float: 1
+float128: 1
 ifloat: 1
+ifloat128: 1
 ildouble: 1
 ldouble: 1
 
 Function: "sincos_downward":
 double: 1
 float: 2
+float128: 3
 idouble: 1
 ifloat: 2
+ifloat128: 3
 ildouble: 4
 ldouble: 4
 
 Function: "sincos_towardzero":
 double: 1
 float: 1
+float128: 2
 idouble: 1
 ifloat: 1
+ifloat128: 2
 ildouble: 7
 ldouble: 7
 
 Function: "sincos_upward":
 double: 1
 float: 2
+float128: 3
 idouble: 1
 ifloat: 2
+ifloat128: 3
 ildouble: 7
 ldouble: 7
 
 Function: "sinh":
 double: 2
 float: 2
+float128: 2
 idouble: 2
 ifloat: 2
+ifloat128: 2
 ildouble: 3
 ldouble: 3
 
 Function: "sinh_downward":
 double: 3
 float: 3
+float128: 3
 idouble: 3
 ifloat: 3
+ifloat128: 3
 ildouble: 6
 ldouble: 6
 
 Function: "sinh_towardzero":
 double: 2
 float: 2
+float128: 3
 idouble: 2
 ifloat: 2
+ifloat128: 3
 ildouble: 6
 ldouble: 6
 
 Function: "sinh_upward":
 double: 3
 float: 3
+float128: 4
 idouble: 3
 ifloat: 3
+ifloat128: 4
 ildouble: 6
 ldouble: 6
 
@@ -2151,191 +2681,239 @@ ldouble: 1
 
 Function: "tan":
 float: 3
+float128: 1
 ifloat: 3
+ifloat128: 1
 ildouble: 2
 ldouble: 2
 
 Function: "tan_downward":
 double: 1
 float: 3
+float128: 1
 idouble: 1
 ifloat: 3
+ifloat128: 1
 ildouble: 3
 ldouble: 3
 
 Function: "tan_towardzero":
 double: 1
 float: 3
+float128: 1
 idouble: 1
 ifloat: 3
+ifloat128: 1
 ildouble: 2
 ldouble: 2
 
 Function: "tan_upward":
 double: 1
 float: 3
+float128: 1
 idouble: 1
 ifloat: 3
+ifloat128: 1
 ildouble: 3
 ldouble: 3
 
 Function: "tanh":
 double: 2
 float: 2
+float128: 2
 idouble: 2
 ifloat: 2
+ifloat128: 2
 ildouble: 1
 ldouble: 1
 
 Function: "tanh_downward":
 double: 3
 float: 3
+float128: 4
 idouble: 3
 ifloat: 3
+ifloat128: 4
 ildouble: 4
 ldouble: 4
 
 Function: "tanh_towardzero":
 double: 2
 float: 2
+float128: 3
 idouble: 2
 ifloat: 2
+ifloat128: 3
 ildouble: 4
 ldouble: 4
 
 Function: "tanh_upward":
 double: 3
 float: 3
+float128: 3
 idouble: 3
 ifloat: 3
+ifloat128: 3
 ildouble: 6
 ldouble: 6
 
 Function: "tgamma":
 double: 5
 float: 4
+float128: 4
 idouble: 5
 ifloat: 4
+ifloat128: 4
 ildouble: 5
 ldouble: 5
 
 Function: "tgamma_downward":
 double: 5
 float: 5
+float128: 5
 idouble: 5
 ifloat: 5
+ifloat128: 5
 ildouble: 6
 ldouble: 6
 
 Function: "tgamma_towardzero":
 double: 5
 float: 4
+float128: 5
 idouble: 5
 ifloat: 4
+ifloat128: 5
 ildouble: 5
 ldouble: 5
 
 Function: "tgamma_upward":
 double: 4
 float: 4
+float128: 4
 idouble: 4
 ifloat: 4
+ifloat128: 4
 ildouble: 5
 ldouble: 5
 
 Function: "y0":
 double: 2
 float: 1
+float128: 3
 idouble: 2
 ifloat: 1
+ifloat128: 3
 ildouble: 1
 ldouble: 1
 
 Function: "y0_downward":
 double: 3
 float: 2
+float128: 4
 idouble: 3
 ifloat: 2
+ifloat128: 4
 ildouble: 10
 ldouble: 10
 
 Function: "y0_towardzero":
 double: 3
 float: 3
+float128: 3
 idouble: 3
 ifloat: 3
+ifloat128: 3
 ildouble: 8
 ldouble: 8
 
 Function: "y0_upward":
 double: 2
 float: 3
+float128: 3
 idouble: 2
 ifloat: 3
+ifloat128: 3
 ildouble: 9
 ldouble: 9
 
 Function: "y1":
 double: 3
 float: 2
+float128: 2
 idouble: 3
 ifloat: 2
+ifloat128: 2
 ildouble: 2
 ldouble: 2
 
 Function: "y1_downward":
 double: 3
 float: 2
+float128: 4
 idouble: 3
 ifloat: 2
+ifloat128: 4
 ildouble: 7
 ldouble: 7
 
 Function: "y1_towardzero":
 double: 3
 float: 2
+float128: 2
 idouble: 3
 ifloat: 2
+ifloat128: 2
 ildouble: 9
 ldouble: 9
 
 Function: "y1_upward":
 double: 5
 float: 2
+float128: 5
 idouble: 5
 ifloat: 2
+ifloat128: 5
 ildouble: 9
 ldouble: 9
 
 Function: "yn":
 double: 3
 float: 2
+float128: 5
 idouble: 3
 ifloat: 2
+ifloat128: 5
 ildouble: 2
 ldouble: 2
 
 Function: "yn_downward":
 double: 3
 float: 2
+float128: 5
 idouble: 3
 ifloat: 2
+ifloat128: 5
 ildouble: 10
 ldouble: 10
 
 Function: "yn_towardzero":
 double: 3
 float: 3
+float128: 5
 idouble: 3
 ifloat: 3
+ifloat128: 5
 ildouble: 8
 ldouble: 8
 
 Function: "yn_upward":
 double: 4
 float: 3
+float128: 5
 idouble: 4
 ifloat: 3
+ifloat128: 5
 ildouble: 9
 ldouble: 9
 
diff --git a/sysdeps/powerpc/fpu/math_private.h b/sysdeps/powerpc/fpu/math_private.h
index 3c71275..d8fd492 100644
--- a/sysdeps/powerpc/fpu/math_private.h
+++ b/sysdeps/powerpc/fpu/math_private.h
@@ -25,6 +25,16 @@
 #include <fenv_private.h>
 #include_next <math_private.h>
 
+#if defined _ARCH_PWR9 && __HAVE_DISTINCT_FLOAT128
+extern __always_inline _Float128
+__ieee754_sqrtf128 (_Float128 __x)
+{
+  _Float128 __z;
+  asm ("xssqrtqp %0,%1" : "=wq" (__z) : "wq" (__x));
+  return __z;
+}
+#endif
+
 extern double __slow_ieee754_sqrt (double);
 extern __always_inline double
 __ieee754_sqrt (double __x)
diff --git a/sysdeps/powerpc/powerpc64le/Implies-before b/sysdeps/powerpc/powerpc64le/Implies-before
new file mode 100644
index 0000000..4806514
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64le/Implies-before
@@ -0,0 +1 @@
+ieee754/float128
diff --git a/sysdeps/powerpc/powerpc64le/Makefile b/sysdeps/powerpc/powerpc64le/Makefile
new file mode 100644
index 0000000..bd8a82d
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64le/Makefile
@@ -0,0 +1,45 @@
+# When building float128 we need to ensure -mfloat128 is
+# passed to all such object files.
+
+ifeq ($(subdir),math)
+# sqrtf128 requires emulation before POWER9.
+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
+$(objpfx)test-float128%.o $(objpfx)test-float128%.os: CFLAGS += -mfloat128
+$(objpfx)test-ifloat128%.o $(objpfx)test-ifloat128%.os: CFLAGS += -mfloat128
+CFLAGS-libm-test-support-float128.c += -mfloat128
+endif
+
+# Append flags to string <-> _Float128 routines.
+ifneq ($(filter $(subdir),wcsmbs stdlib),)
+%f128.o %f128.os %f128_l.o %f128_l.os %f128_nan.o %f128_nan.os %float1282mpn.o %float1282mpn.os %mpn2float128.o %mpn2float128.os: CFLAGS += -mfloat128
+CFLAGS-bug-strtod.c += -mfloat128
+CFLAGS-bug-strtod2.c += -mfloat128
+CFLAGS-tst-strtod-round.c += -mfloat128
+CFLAGS-tst-wcstod-round.c += -mfloat128
+CFLAGS-tst-strtod6.c += -mfloat128
+CFLAGS-tst-strfrom.c += -mfloat128
+CFLAGS-tst-strfrom-locale.c += -mfloat128
+CFLAGS-strfrom-skeleton.c += -mfloat128
+
+# When building glibc with support for _Float128, the powers of ten tables in
+# fpioconst.c and in the string conversion functions must be extended.
+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
+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
+endif
diff --git a/sysdeps/powerpc/powerpc64le/fpu/e_sqrtf128.c b/sysdeps/powerpc/powerpc64le/fpu/e_sqrtf128.c
new file mode 100644
index 0000000..4dcc363
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64le/fpu/e_sqrtf128.c
@@ -0,0 +1,51 @@
+/* soft-fp sqrt for _Float128
+   Return sqrt(a)
+   Copyright (C) 2017 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.
+
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
+   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
+   <http://www.gnu.org/licenses/>.  */
+
+/* Unavoidable hacks since TFmode is assumed to be binary128. */
+#define TFtype KFtype
+#define TF KF
+
+#include <soft-fp.h>
+#include <quad.h>
+
+__float128
+__ieee754_sqrtf128 (__float128 a)
+{
+  FP_DECL_EX;
+  FP_DECL_Q (A);
+  FP_DECL_Q (R);
+  __float128 r;
+
+  FP_INIT_ROUNDMODE;
+  FP_UNPACK_Q (A, a);
+  FP_SQRT_Q (R, A);
+  FP_PACK_Q (r, R);
+  FP_HANDLE_EXCEPTIONS;
+  return r;
+}
+strong_alias (__ieee754_sqrtf128, __sqrtf128_finite)
diff --git a/sysdeps/powerpc/powerpc64le/fpu/sfp-machine.h b/sysdeps/powerpc/powerpc64le/fpu/sfp-machine.h
new file mode 100644
index 0000000..fac5dd0
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64le/fpu/sfp-machine.h
@@ -0,0 +1,115 @@
+#define _FP_W_TYPE_SIZE		64
+#define _FP_W_TYPE		unsigned long long
+#define _FP_WS_TYPE		signed long long
+#define _FP_I_TYPE		long long
+
+typedef int TItype __attribute__ ((mode (TI)));
+typedef unsigned int UTItype __attribute__ ((mode (TI)));
+
+#define TI_BITS (__CHAR_BIT__ * (int)sizeof(TItype))
+
+/* The type of the result of a floating point comparison.  This must
+   match `__libgcc_cmp_return__' in GCC for the target.  */
+typedef int __gcc_CMPtype __attribute__ ((mode (__libgcc_cmp_return__)));
+#define CMPtype __gcc_CMPtype
+
+#define _FP_MUL_MEAT_S(R,X,Y)				\
+  _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm)
+
+#define _FP_MUL_MEAT_D(R,X,Y)				\
+  _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm)
+#define _FP_MUL_MEAT_Q(R,X,Y)				\
+  _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
+
+#define _FP_DIV_MEAT_S(R,X,Y)	_FP_DIV_MEAT_1_loop(S,R,X,Y)
+
+#define _FP_DIV_MEAT_D(R,X,Y)	_FP_DIV_MEAT_1_udiv(D,R,X,Y)
+#define _FP_DIV_MEAT_Q(R,X,Y)   _FP_DIV_MEAT_2_udiv(Q,R,X,Y)
+
+#define _FP_NANFRAC_S		((_FP_QNANBIT_S << 1) - 1)
+
+#define _FP_NANFRAC_D		((_FP_QNANBIT_D << 1) - 1)
+#define _FP_NANFRAC_Q		((_FP_QNANBIT_Q << 1) - 1), -1
+
+#define _FP_NANSIGN_S		0
+#define _FP_NANSIGN_D		0
+#define _FP_NANSIGN_Q		0
+
+#define _FP_KEEPNANFRACP 1
+#define _FP_QNANNEGATEDP 0
+
+/* Someone please check this.  */
+#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP)			\
+  do {								\
+    if ((_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs)		\
+	&& !(_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs))	\
+      {								\
+	R##_s = Y##_s;						\
+	_FP_FRAC_COPY_##wc(R,Y);				\
+      }								\
+    else							\
+      {								\
+	R##_s = X##_s;						\
+	_FP_FRAC_COPY_##wc(R,X);				\
+      }								\
+    R##_c = FP_CLS_NAN;						\
+  } while (0)
+
+#define _FP_TININESS_AFTER_ROUNDING 0
+
+#define	__LITTLE_ENDIAN	1234
+#define	__BIG_ENDIAN	4321
+#define	__BYTE_ORDER	__LITTLE_ENDIAN
+
+/* Only provide exception support if we have hardware floating point using
+   floating point registers and we can execute the mtfsf instruction.  This
+   would only be true if we are using the emulation routines for IEEE 128-bit
+   floating point on pre-ISA 3.0 machines without the IEEE 128-bit floating
+   point support.  */
+
+#ifdef __FLOAT128__
+#define ISA_BIT(x) (1LL << (63 - x))
+
+/* Use the same bits of the FPSCR.  */
+# define FP_EX_INVALID		ISA_BIT(34)
+# define FP_EX_OVERFLOW		ISA_BIT(35)
+# define FP_EX_UNDERFLOW	ISA_BIT(36)
+# define FP_EX_DIVZERO		ISA_BIT(37)
+# define FP_EX_INEXACT		ISA_BIT(38)
+# define FP_EX_ALL		(FP_EX_INVALID | FP_EX_OVERFLOW		\
+				 | FP_EX_UNDERFLOW | FP_EX_DIVZERO	\
+				 | FP_EX_INEXACT)
+
+void __sfp_handle_exceptions (int);
+
+# define FP_HANDLE_EXCEPTIONS			\
+  do {						\
+    if (__builtin_expect (_fex, 0))		\
+      __sfp_handle_exceptions (_fex);		\
+  } while (0);
+
+/* The FP_EX_* bits track whether the exception has occurred.  This macro
+   must set the FP_EX_* bits of those exceptions which are configured to
+   trap.  The FPSCR bit which indicates this is 22 ISA bits above the
+   respective FP_EX_* bit.  Note, the ISA labels bits from msb to lsb,
+   so 22 ISA bits above is 22 bits below when counted from the lsb.  */
+# define FP_TRAPPING_EXCEPTIONS ((_fpscr.i << 22) & FP_EX_ALL)
+
+# define FP_RND_NEAREST	0x0
+# define FP_RND_ZERO	0x1
+# define FP_RND_PINF	0x2
+# define FP_RND_MINF	0x3
+# define FP_RND_MASK	0x3
+
+# define _FP_DECL_EX \
+  union { unsigned long long i; double d; } _fpscr __attribute__ ((unused)) = \
+	{ .i = FP_RND_NEAREST }
+
+#define FP_INIT_ROUNDMODE			\
+  do {						\
+    __asm__ __volatile__ ("mffs %0"		\
+			  : "=f" (_fpscr.d));	\
+  } while (0)
+
+# define FP_ROUNDMODE	(_fpscr.i & FP_RND_MASK)
+#endif	/* !__FLOAT128__ */
diff --git a/sysdeps/powerpc/powerpc64le/power9/fpu/e_sqrtf128.c b/sysdeps/powerpc/powerpc64le/power9/fpu/e_sqrtf128.c
new file mode 100644
index 0000000..769d3f8
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64le/power9/fpu/e_sqrtf128.c
@@ -0,0 +1,36 @@
+/* POWER9 sqrt for _Float128
+   Return sqrt(a)
+   Copyright (C) 2017 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.
+
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
+   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
+   <http://www.gnu.org/licenses/>.  */
+
+__float128
+__ieee754_sqrtf128 (__float128 a)
+{
+  __float128 z;
+  asm ("xssqrtqp %0,%1" : "=wq" (z) : "wq" (a));
+  return z;
+}
+strong_alias (__ieee754_sqrtf128, __sqrtf128_finite)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
index 443d89f..51a8d19 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
@@ -2186,8 +2186,15 @@ GLIBC_2.25 strfromd F
 GLIBC_2.25 strfromf F
 GLIBC_2.25 strfroml F
 GLIBC_2.26 GLIBC_2.26 A
+GLIBC_2.26 __strtof128_internal F
+GLIBC_2.26 __wcstof128_internal F
 GLIBC_2.26 preadv2 F
 GLIBC_2.26 preadv64v2 F
 GLIBC_2.26 pwritev2 F
 GLIBC_2.26 pwritev64v2 F
 GLIBC_2.26 reallocarray F
+GLIBC_2.26 strfromf128 F
+GLIBC_2.26 strtof128 F
+GLIBC_2.26 strtof128_l F
+GLIBC_2.26 wcstof128 F
+GLIBC_2.26 wcstof128_l F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist
index 9658ded..d79cb99 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist
@@ -467,3 +467,141 @@ GLIBC_2.25 ufromfpl F
 GLIBC_2.25 ufromfpx F
 GLIBC_2.25 ufromfpxf F
 GLIBC_2.25 ufromfpxl F
+GLIBC_2.26 GLIBC_2.26 A
+GLIBC_2.26 __acosf128_finite F
+GLIBC_2.26 __acoshf128_finite F
+GLIBC_2.26 __asinf128_finite F
+GLIBC_2.26 __atan2f128_finite F
+GLIBC_2.26 __atanhf128_finite F
+GLIBC_2.26 __coshf128_finite F
+GLIBC_2.26 __exp10f128_finite F
+GLIBC_2.26 __exp2f128_finite F
+GLIBC_2.26 __expf128_finite F
+GLIBC_2.26 __finitef128 F
+GLIBC_2.26 __fmodf128_finite F
+GLIBC_2.26 __fpclassifyf128 F
+GLIBC_2.26 __gammaf128_r_finite F
+GLIBC_2.26 __hypotf128_finite F
+GLIBC_2.26 __iseqsigf128 F
+GLIBC_2.26 __isinff128 F
+GLIBC_2.26 __isnanf128 F
+GLIBC_2.26 __issignalingf128 F
+GLIBC_2.26 __j0f128_finite F
+GLIBC_2.26 __j1f128_finite F
+GLIBC_2.26 __jnf128_finite F
+GLIBC_2.26 __lgammaf128_r_finite F
+GLIBC_2.26 __log10f128_finite F
+GLIBC_2.26 __log2f128_finite F
+GLIBC_2.26 __logf128_finite F
+GLIBC_2.26 __powf128_finite F
+GLIBC_2.26 __remainderf128_finite F
+GLIBC_2.26 __signbitf128 F
+GLIBC_2.26 __sinhf128_finite F
+GLIBC_2.26 __sqrtf128_finite F
+GLIBC_2.26 __y0f128_finite F
+GLIBC_2.26 __y1f128_finite F
+GLIBC_2.26 __ynf128_finite F
+GLIBC_2.26 acosf128 F
+GLIBC_2.26 acoshf128 F
+GLIBC_2.26 asinf128 F
+GLIBC_2.26 asinhf128 F
+GLIBC_2.26 atan2f128 F
+GLIBC_2.26 atanf128 F
+GLIBC_2.26 atanhf128 F
+GLIBC_2.26 cabsf128 F
+GLIBC_2.26 cacosf128 F
+GLIBC_2.26 cacoshf128 F
+GLIBC_2.26 canonicalizef128 F
+GLIBC_2.26 cargf128 F
+GLIBC_2.26 casinf128 F
+GLIBC_2.26 casinhf128 F
+GLIBC_2.26 catanf128 F
+GLIBC_2.26 catanhf128 F
+GLIBC_2.26 cbrtf128 F
+GLIBC_2.26 ccosf128 F
+GLIBC_2.26 ccoshf128 F
+GLIBC_2.26 ceilf128 F
+GLIBC_2.26 cexpf128 F
+GLIBC_2.26 cimagf128 F
+GLIBC_2.26 clog10f128 F
+GLIBC_2.26 clogf128 F
+GLIBC_2.26 conjf128 F
+GLIBC_2.26 copysignf128 F
+GLIBC_2.26 cosf128 F
+GLIBC_2.26 coshf128 F
+GLIBC_2.26 cpowf128 F
+GLIBC_2.26 cprojf128 F
+GLIBC_2.26 crealf128 F
+GLIBC_2.26 csinf128 F
+GLIBC_2.26 csinhf128 F
+GLIBC_2.26 csqrtf128 F
+GLIBC_2.26 ctanf128 F
+GLIBC_2.26 ctanhf128 F
+GLIBC_2.26 erfcf128 F
+GLIBC_2.26 erff128 F
+GLIBC_2.26 exp10f128 F
+GLIBC_2.26 exp2f128 F
+GLIBC_2.26 expf128 F
+GLIBC_2.26 expm1f128 F
+GLIBC_2.26 fabsf128 F
+GLIBC_2.26 fdimf128 F
+GLIBC_2.26 floorf128 F
+GLIBC_2.26 fmaf128 F
+GLIBC_2.26 fmaxf128 F
+GLIBC_2.26 fmaxmagf128 F
+GLIBC_2.26 fminf128 F
+GLIBC_2.26 fminmagf128 F
+GLIBC_2.26 fmodf128 F
+GLIBC_2.26 frexpf128 F
+GLIBC_2.26 fromfpf128 F
+GLIBC_2.26 fromfpxf128 F
+GLIBC_2.26 getpayloadf128 F
+GLIBC_2.26 hypotf128 F
+GLIBC_2.26 ilogbf128 F
+GLIBC_2.26 j0f128 F
+GLIBC_2.26 j1f128 F
+GLIBC_2.26 jnf128 F
+GLIBC_2.26 ldexpf128 F
+GLIBC_2.26 lgammaf128 F
+GLIBC_2.26 lgammaf128_r F
+GLIBC_2.26 llogbf128 F
+GLIBC_2.26 llrintf128 F
+GLIBC_2.26 llroundf128 F
+GLIBC_2.26 log10f128 F
+GLIBC_2.26 log1pf128 F
+GLIBC_2.26 log2f128 F
+GLIBC_2.26 logbf128 F
+GLIBC_2.26 logf128 F
+GLIBC_2.26 lrintf128 F
+GLIBC_2.26 lroundf128 F
+GLIBC_2.26 modff128 F
+GLIBC_2.26 nanf128 F
+GLIBC_2.26 nearbyintf128 F
+GLIBC_2.26 nextafterf128 F
+GLIBC_2.26 nextdownf128 F
+GLIBC_2.26 nextupf128 F
+GLIBC_2.26 powf128 F
+GLIBC_2.26 remainderf128 F
+GLIBC_2.26 remquof128 F
+GLIBC_2.26 rintf128 F
+GLIBC_2.26 roundevenf128 F
+GLIBC_2.26 roundf128 F
+GLIBC_2.26 scalblnf128 F
+GLIBC_2.26 scalbnf128 F
+GLIBC_2.26 setpayloadf128 F
+GLIBC_2.26 setpayloadsigf128 F
+GLIBC_2.26 sincosf128 F
+GLIBC_2.26 sinf128 F
+GLIBC_2.26 sinhf128 F
+GLIBC_2.26 sqrtf128 F
+GLIBC_2.26 tanf128 F
+GLIBC_2.26 tanhf128 F
+GLIBC_2.26 tgammaf128 F
+GLIBC_2.26 totalorderf128 F
+GLIBC_2.26 totalordermagf128 F
+GLIBC_2.26 truncf128 F
+GLIBC_2.26 ufromfpf128 F
+GLIBC_2.26 ufromfpxf128 F
+GLIBC_2.26 y0f128 F
+GLIBC_2.26 y1f128 F
+GLIBC_2.26 ynf128 F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64le/float128-abi.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64le/float128-abi.h
new file mode 100644
index 0000000..6b954cc
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64le/float128-abi.h
@@ -0,0 +1,2 @@
+/* ABI version for _Float128 ABI introduction.  */
+#define FLOAT128_VERSION GLIBC_2.26
-- 
2.4.11

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

* [PATCH v3 6/7] powerpc64le: Check for compiler features for float128
  2017-06-23 12:33 [PATCH v3 0/7] Enable float128 on powerpc64le Gabriel F. T. Gomes
                   ` (3 preceding siblings ...)
  2017-06-23 12:34 ` [PATCH v3 7/7] powerpc64le: Enable float128 Gabriel F. T. Gomes
@ 2017-06-23 12:34 ` Gabriel F. T. Gomes
  2017-06-23 16:37   ` Joseph Myers
  2017-06-23 12:34 ` [PATCH v3 4/7] Update string to float128 functions to use bits/types/locale_t.h Gabriel F. T. Gomes
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 83+ messages in thread
From: Gabriel F. T. Gomes @ 2017-06-23 12:34 UTC (permalink / raw)
  To: libc-alpha

Changes since v2:

  - Check for compiler features instead of compiler version.
  - Mention the powerpc64le-specific requirement in the manual.

No changes since v1.

-- 8< --
On powerpc64le, support for float128 will be enabled, which requires some
compiler features to be present.  This patch adds a configure test to check
for such features, which are provided for powerpc64le since GCC 6.2.

Tested for powerpc64 and powerpc64le.

2017-06-12  Gabriel F. T. Gomes  <gftg@linux.vnet.ibm.com>
	    Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>

	* manual/install.texi (Recommended Tools for Compilation): Mention
	the powerpc64le-specific requirement in the manual.
	* sysdeps/powerpc/powerpc64le/configure.ac: New file with checks
	for the compiler features required for building float128.
	* sysdeps/powerpc/powerpc64le/configure: New, auto-generated file.
---
 manual/install.texi                      |  4 +++
 sysdeps/powerpc/powerpc64le/configure    | 45 ++++++++++++++++++++++++++++++++
 sysdeps/powerpc/powerpc64le/configure.ac | 32 +++++++++++++++++++++++
 3 files changed, 81 insertions(+)
 create mode 100644 sysdeps/powerpc/powerpc64le/configure
 create mode 100644 sysdeps/powerpc/powerpc64le/configure.ac

diff --git a/manual/install.texi b/manual/install.texi
index 65174a8..ff5661a 100644
--- a/manual/install.texi
+++ b/manual/install.texi
@@ -475,6 +475,10 @@ the newest version of the compiler that is known to work for building
 release time, GCC 6.3 is the newest compiler verified to work to build
 @theglibc{}.
 
+For PowerPC 64-bits little-endian (powerpc64le), GCC 6.2 or higher is
+required.  This compiler version is the first to provide the features
+required for building @theglibc{} with support for @code{_Float128}.
+
 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/powerpc64le/configure b/sysdeps/powerpc/powerpc64le/configure
new file mode 100644
index 0000000..78208d2
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64le/configure
@@ -0,0 +1,45 @@
+# This file is generated from configure.ac by Autoconf.  DO NOT EDIT!
+ # Local configure fragment for sysdeps/powerpc/powerpc64le.
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports binary128 floating point type" >&5
+$as_echo_n "checking if $CC supports binary128 floating point type... " >&6; }
+if ${libc_cv_compiler_powerpc64le_binary128_ok+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Werror -mfloat128"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+__float128 a, b, c, d, e;
+int i;
+
+__float128
+foobar (__float128 x)
+{
+  a = __builtin_nansq ("0");
+  b = __builtin_huge_valq ();
+  c = __builtin_infq ();
+  d = __builtin_fabsq (x);
+  e = __builtin_nanq ("0");
+  i = __builtin_signbit (x);
+  return __builtin_copysignq (x, x);
+}
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  libc_cv_compiler_powerpc64le_binary128_ok=yes
+else
+  libc_cv_compiler_powerpc64le_binary128_ok=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_binary128_ok" >&5
+$as_echo "$libc_cv_compiler_powerpc64le_binary128_ok" >&6; }
+if test "$libc_cv_compiler_powerpc64le_binary128_ok" != "yes"; then :
+  critic_missing="$critic_missing binary128 floating point type (GCC >= 6.2) is required on powerpc64le."
+fi
+
+test -n "$critic_missing" && as_fn_error $? "*** $critic_missing" "$LINENO" 5
diff --git a/sysdeps/powerpc/powerpc64le/configure.ac b/sysdeps/powerpc/powerpc64le/configure.ac
new file mode 100644
index 0000000..e88e224
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64le/configure.ac
@@ -0,0 +1,32 @@
+GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
+# Local configure fragment for sysdeps/powerpc/powerpc64le.
+
+dnl Require binary128 floating point support on powerpc64le (available in
+dnl GCC 6.2).
+AC_CACHE_CHECK([if $CC supports binary128 floating point type],
+	       libc_cv_compiler_powerpc64le_binary128_ok, [dnl
+save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Werror -mfloat128"
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+__float128 a, b, c, d, e;
+int i;
+
+__float128
+foobar (__float128 x)
+{
+  a = __builtin_nansq ("0");
+  b = __builtin_huge_valq ();
+  c = __builtin_infq ();
+  d = __builtin_fabsq (x);
+  e = __builtin_nanq ("0");
+  i = __builtin_signbit (x);
+  return __builtin_copysignq (x, x);
+}
+]])],
+		  [libc_cv_compiler_powerpc64le_binary128_ok=yes],
+		  [libc_cv_compiler_powerpc64le_binary128_ok=no])
+CFLAGS="$save_CFLAGS"])
+AS_IF([test "$libc_cv_compiler_powerpc64le_binary128_ok" != "yes"],
+      [critic_missing="$critic_missing binary128 floating point type (GCC >= 6.2) is required on powerpc64le."])
+
+test -n "$critic_missing" && AC_MSG_ERROR([*** $critic_missing])
-- 
2.4.11

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

* [PATCH v3 2/7] Prepare the manual to display math errors for float128 functions
  2017-06-23 12:33 [PATCH v3 0/7] Enable float128 on powerpc64le Gabriel F. T. Gomes
                   ` (5 preceding siblings ...)
  2017-06-23 12:34 ` [PATCH v3 4/7] Update string to float128 functions to use bits/types/locale_t.h Gabriel F. T. Gomes
@ 2017-06-23 12:34 ` Gabriel F. T. Gomes
  2017-06-23 12:59 ` [PATCH v3 0/7] Enable float128 on powerpc64le Joseph Myers
  7 siblings, 0 replies; 83+ messages in thread
From: Gabriel F. T. Gomes @ 2017-06-23 12:34 UTC (permalink / raw)
  To: libc-alpha

New since v2:

  - This patch has been split from the last patch in this set, because it
    isn't powerpc64le-specific.

-- 8< --
When float128 support gets enabled for powerpc64le, the ULP errors for
float128 functions need to be presented in the manual.  This patch adds
support for displaying them.

Tested for powerpc64le and s390x.

	* manual/libm-err-tab.pl (@all_floats, %suffices, parse_ulps):
	Enable generation of float128 entries on the error table.
---
 manual/libm-err-tab.pl | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/manual/libm-err-tab.pl b/manual/libm-err-tab.pl
index 75f5e5b..e0bc3b7 100755
--- a/manual/libm-err-tab.pl
+++ b/manual/libm-err-tab.pl
@@ -40,11 +40,12 @@ use vars qw (%results @all_floats %suffices %all_functions);
 
 # all_floats is in output order and contains all recognised float types that
 # we're going to output
-@all_floats = ('float', 'double', 'ldouble');
+@all_floats = ('float', 'double', 'ldouble', 'float128');
 %suffices =
   ( 'float' => 'f',
     'double' => '',
-    'ldouble' => 'l'
+    'ldouble' => 'l',
+    'float128' => 'f128'
   );
 
 # Pretty description of platform
@@ -113,7 +114,7 @@ sub parse_ulps {
       $ignore_fn = 0;
       $all_functions{$test} = 1;
     }
-    if (/^i?(float|double|ldouble):/) {
+    if (/^i?(float|double|ldouble|float128):/) {
       ($float, $eps) = split /\s*:\s*/,$_,2;
       if ($ignore_fn) {
 	next;
-- 
2.4.11

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

* [PATCH v3 4/7] Update string to float128 functions to use bits/types/locale_t.h
  2017-06-23 12:33 [PATCH v3 0/7] Enable float128 on powerpc64le Gabriel F. T. Gomes
                   ` (4 preceding siblings ...)
  2017-06-23 12:34 ` [PATCH v3 6/7] powerpc64le: Check for compiler features for float128 Gabriel F. T. Gomes
@ 2017-06-23 12:34 ` Gabriel F. T. Gomes
  2017-06-23 12:57   ` Gabriel F. T. Gomes
  2017-06-23 12:34 ` [PATCH v3 2/7] Prepare the manual to display math errors for float128 functions Gabriel F. T. Gomes
  2017-06-23 12:59 ` [PATCH v3 0/7] Enable float128 on powerpc64le Joseph Myers
  7 siblings, 1 reply; 83+ messages in thread
From: Gabriel F. T. Gomes @ 2017-06-23 12:34 UTC (permalink / raw)
  To: libc-alpha

New since v2:

  - This patch updates float128 files to reflect new code on master
    (detected after a rebase).

-- 8< --
The header xlocale.h was renamed to bits/types/locale_t.h.  This patch
updates the string to float128 conversion functions to include the new
header.

Tested for powerpc64le and s390x.

	* sysdeps/ieee754/float128/strtof128_l.c: Include
	bits/types/locale_t.h instead of xlocale.h.
	* sysdeps/ieee754/float128/wcstof128.c: Likewise.
	* sysdeps/ieee754/float128/wcstof128_l.c: Likewise.
---
 sysdeps/ieee754/float128/strtof128_l.c | 2 +-
 sysdeps/ieee754/float128/wcstof128.c   | 2 +-
 sysdeps/ieee754/float128/wcstof128_l.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sysdeps/ieee754/float128/strtof128_l.c b/sysdeps/ieee754/float128/strtof128_l.c
index d3d55ea..a541d60 100644
--- a/sysdeps/ieee754/float128/strtof128_l.c
+++ b/sysdeps/ieee754/float128/strtof128_l.c
@@ -16,7 +16,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <xlocale.h>
+#include <bits/types/locale_t.h>
 
 /* Bring in potential typedef for _Float128 early for declaration below.  */
 #include <bits/floatn.h>
diff --git a/sysdeps/ieee754/float128/wcstof128.c b/sysdeps/ieee754/float128/wcstof128.c
index 1d6326d..49aa4d6 100644
--- a/sysdeps/ieee754/float128/wcstof128.c
+++ b/sysdeps/ieee754/float128/wcstof128.c
@@ -17,7 +17,7 @@
    <http://www.gnu.org/licenses/>.  */
 
 #include <stddef.h>
-#include <xlocale.h>
+#include <bits/types/locale_t.h>
 
 #define	USE_WIDE_CHAR	1
 
diff --git a/sysdeps/ieee754/float128/wcstof128_l.c b/sysdeps/ieee754/float128/wcstof128_l.c
index 2df7184..b295087 100644
--- a/sysdeps/ieee754/float128/wcstof128_l.c
+++ b/sysdeps/ieee754/float128/wcstof128_l.c
@@ -17,7 +17,7 @@
    <http://www.gnu.org/licenses/>.  */
 
 #include <stddef.h>
-#include <xlocale.h>
+#include <bits/types/locale_t.h>
 
 
 #define	USE_WIDE_CHAR	1
-- 
2.4.11

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

* [PATCH v3 5/7] Document _FloatN and _FloatNx versions of math functions
  2017-06-23 12:33 [PATCH v3 0/7] Enable float128 on powerpc64le Gabriel F. T. Gomes
  2017-06-23 12:33 ` [PATCH v3 3/7] Add libio-mtsafe flags to the build of strfromf128 Gabriel F. T. Gomes
  2017-06-23 12:33 ` [PATCH v3 1/7] Include libc-header-start.h in include/float.h Gabriel F. T. Gomes
@ 2017-06-23 12:34 ` Gabriel F. T. Gomes
  2017-06-23 13:11   ` Joseph Myers
  2017-06-23 12:34 ` [PATCH v3 7/7] powerpc64le: Enable float128 Gabriel F. T. Gomes
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 83+ messages in thread
From: Gabriel F. T. Gomes @ 2017-06-23 12:34 UTC (permalink / raw)
  To: libc-alpha

Changes since v2:

  - Replaces remaining uses of @comment with @standards.
  - Document _FloatN[x] variants of the M_* macros.
  - Mention that the _FloatN and _FloatNx variants of the math functions
    come from TS 18661-3, unless otherwise stated, to avoid repetition.
  - Rephrased the locations of the fabs and cabs functions.
  - Moved the new, _FloatN[x] function descriptions to the same block as
    the double, float, and long double blocks.

Changes since v1:

  - Document a lot of functions and macros that were missing documentation.
  - Update for the use of @standards.

-- 8< --
The functions defined in ISO/IEC TS 18661-3 take floating-point arguments
and return floating-point numbers of _FloatN and _FloatNx types.  Apart
from the type, these functions behave the same as their float, double, and
long double counterparts.  This patch adds the newer functions to the
manual.

2017-06-12  Gabriel F. T. Gomes  <gftg@linux.vnet.ibm.com>

	* manual/arith.texi (Infinity and NaN): Document SNANFN and SNANFNx.
	(Error Reporting by Mathematical Functions): Document HUGE_VAL_FN
	and HUGE_VAL_FNx.
	(Absolute Value): Document fabsfN, fabsfNx, cabsfN, cabsfNx.
	Rephrase the paragraph that mentions that fabs, fabsf, and fabsl
	are in math.h, to avoid having to list the _FloatN and _FloatNx
	variants as well.  Likewise for the cabs functions.
	(Normalization Functions): Document frexpfN, frexpfNx, ldexpfN,
	ldexpfNx, scalbnfN, scalbnfNx, scalblnfN, scalblnfNx.
	Mention that _FloatN and _FloatNx variants of scalbn and scalbln
	come from TS 18661-3, since this section explicitly states that
	these functions come from BSD.
	(Rounding Functions): Document ceilfN, ceilfNx, floorfN, floorfNx,
	truncfN, truncfNx, rintfN, rintfNx, nearbyintfN, nearbyintfNx,
	roundfN, roundfNx, roundevenfN, roundevenfNx, lrintfN, lrintfNx,
	llrintfN, llrintfNx, lroundfN, lroundfNx, llroundfN, llroundfNx,
	fromfpfN, fromfpfNx, ufromfpfN, ufromfpfNx, fromfpxfN, fromfpxfNx,
	ufromfpxfN, ufromfpxfNx, modffN, modffNx.
	(Remainder Functions): Document fmodfN, fmodfNx, remainderfN,
	remainderfNx.
	(Setting and modifying single bits of FP values): Document
	copysignfN, copysignfNx, nextafterfN, nextafterfNx, nextupfN,
	nextupfNx, nextdownfN, nextdownfNx, nanfN, nanfNx, canonicalizefN,
	canonicalizefNx, getpayloadfN, getpayloadfNx, setpayloadfN,
	setpayloadfNx, setpayloadsigfN, setpayloadsigfNx.
	(Floating-Point Comparison Functions): Document totalorderfN,
	totalorderfNx, totalordermagfN, totalordermagfNx.
	(Miscellaneous FP arithmetic functions): Document fminfN, fminfNx,
	fmaxfN, fmaxfNx, fminmagfN, fminmagfNx, fmaxmagfN, fmaxmagfNx,
	fdimfN, fdimfNx, fmafN, fmafNx.
	(Complex Numbers): Document the complex types: _FloatN complex and
	_FloatNx complex.
	(rojections, Conjugates, and Decomposing of Complex Numbers):
	Document crealfN, crealfNx, cimagfN, cimagfNx, conjfN, conjfNx,
	cargfN, cargfNx, cprojfN, cprojfNx.
	* manual/math.texi (Mathematics): Mention that the _FloatN and
	_FloatNx variants of the math functions come from TS 18661-3,
	unless otherwise stated.
	(Predefined Mathematical Constants): Document the _FloatN and
	_FloatNx variants of the macros prefixed with M_.
	(Trigonometric Functions): Document sinfN, sinfNx, cosfN, cosfNx,
	tanfN, tanfNx, sincosfN, sincosfNx, csinfN, csinfNx, ccosfN,
	ccosfNx, ctanfN, ctanfNx.
	(Inverse Trigonometric Functions): Document asinfN, asinfNx,
	acosfN, acosfNx, atanfN, atanfNx, atan2fN, atan2fNx.
	(Exponentiation and Logarithms): Document expfN, expfNx, exp2fN,
	exp2fNx, exp10fN, exp10fNx, logfN, logfNx, log10fN, log10fNx,
	log2fN, log2fNx, logbfN, logbfNx, ilogbfN, ilogbfNx, llogbfN,
	llogbfNx, powfN, powfNx, sqrtfN, sqrtfNx, cbrtfN, cbrtfNx, hypotfN,
	hypotfNx, expm1fN, expm1fNx, log1pfN, log1pfNx, cexpfN, cexpfNx,
	clogfN, clogfNx, clog10fN, clog10fNx, csqrtfN, csqrtfNx, cpowfN,
	cpowfNx.
	(Hyperbolic Functions): sinhfN, sinhfNx, coshfN, coshfNx, tanhfN,
	tanhfNx, csinhfN, csinhfNx, ccoshfN, ccoshfNx, ctanhfN, ctanhfNx,
	asinhfN, asinhfNx, acoshfN, acoshfNx, atanhfN, atanhfNx, casinhfN,
	casinhfNx, cacoshfN, cacoshfNx, catanhfN, catanhfNx.
	(Special Functions): Document erffN, erffNx, erfcfN, erfcfNx,
	lgammafN, lgammafNx, lgammarfN_r, lgammafNx_r, tgammafN, tgammafNx,
	j0fN, j0fNx, j1fN, j1fNx, jnfN, jnfNx, y0fN, y0fNx, y1fN, y1fNx,
	ynfN, ynfNx.
---
 manual/arith.texi | 286 ++++++++++++++++++++++++++++++++++++++++++++++--------
 manual/math.texi  | 284 +++++++++++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 518 insertions(+), 52 deletions(-)

diff --git a/manual/arith.texi b/manual/arith.texi
index e403cb5..28a0e13 100644
--- a/manual/arith.texi
+++ b/manual/arith.texi
@@ -686,9 +686,13 @@ such as by defining @code{_GNU_SOURCE}, and then you must include
 @deftypevr Macro float SNANF
 @deftypevrx Macro double SNAN
 @deftypevrx Macro {long double} SNANL
+@deftypevrx Macro _FloatN SNANFN
+@deftypevrx Macro _FloatNx SNANFNx
 @standards{TS 18661-1:2014, math.h}
-These macros, defined by TS 18661-1:2014, are constant expressions for
-signaling NaNs.
+@standardsx{SNANFN, TS 18661-3:2015, math.h}
+@standardsx{SNANFNx, TS 18661-3:2015, math.h}
+These macros, defined by TS 18661-1:2014 and TS 18661-3:2015, are
+constant expressions for signaling NaNs.
 @end deftypevr
 
 @deftypevr Macro int FE_SNANS_ALWAYS_SIGNAL
@@ -917,7 +921,11 @@ to test for overflow on both old and new hardware.
 @deftypevr Macro double HUGE_VAL
 @deftypevrx Macro float HUGE_VALF
 @deftypevrx Macro {long double} HUGE_VALL
+@deftypevrx Macro _FloatN HUGE_VAL_FN
+@deftypevrx Macro _FloatNx HUGE_VAL_FNx
 @standards{ISO, math.h}
+@standardsx{HUGE_VAL_FN, TS 18661-3:2015, math.h}
+@standardsx{HUGE_VAL_FNx, TS 18661-3:2015, math.h}
 An expression representing a particular very large number.  On machines
 that use @w{IEEE 754} floating point format, @code{HUGE_VAL} is infinity.
 On other machines, it's typically the largest positive number that can
@@ -1229,8 +1237,8 @@ whose imaginary part is @var{y}, the absolute value is @w{@code{sqrt
 @pindex stdlib.h
 Prototypes for @code{abs}, @code{labs} and @code{llabs} are in @file{stdlib.h};
 @code{imaxabs} is declared in @file{inttypes.h};
-@code{fabs}, @code{fabsf} and @code{fabsl} are declared in @file{math.h}.
-@code{cabs}, @code{cabsf} and @code{cabsl} are declared in @file{complex.h}.
+the @code{fabs} functions are declared in @file{math.h};
+the @code{cabs} functions are declared in @file{complex.h}.
 
 @deftypefun int abs (int @var{number})
 @deftypefunx {long int} labs (long int @var{number})
@@ -1254,7 +1262,11 @@ See @ref{Integers} for a description of the @code{intmax_t} type.
 @deftypefun double fabs (double @var{number})
 @deftypefunx float fabsf (float @var{number})
 @deftypefunx {long double} fabsl (long double @var{number})
+@deftypefunx _FloatN fabsfN (_Float@var{N} @var{number})
+@deftypefunx _FloatNx fabsfNx (_Float@var{N}x @var{number})
 @standards{ISO, math.h}
+@standardsx{fabsfN, TS 18661-3:2015, math.h}
+@standardsx{fabsfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 This function returns the absolute value of the floating-point number
 @var{number}.
@@ -1263,7 +1275,11 @@ This function returns the absolute value of the floating-point number
 @deftypefun double cabs (complex double @var{z})
 @deftypefunx float cabsf (complex float @var{z})
 @deftypefunx {long double} cabsl (complex long double @var{z})
+@deftypefunx _FloatN cabsfN (complex _Float@var{N} @var{z})
+@deftypefunx _FloatNx cabsfNx (complex _Float@var{N}x @var{z})
 @standards{ISO, complex.h}
+@standardsx{cabsfN, TS 18661-3:2015, complex.h}
+@standardsx{cabsfNx, TS 18661-3:2015, complex.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return the absolute  value of the complex number @var{z}
 (@pxref{Complex Numbers}).  The absolute value of a complex number is:
@@ -1296,7 +1312,11 @@ All these functions are declared in @file{math.h}.
 @deftypefun double frexp (double @var{value}, int *@var{exponent})
 @deftypefunx float frexpf (float @var{value}, int *@var{exponent})
 @deftypefunx {long double} frexpl (long double @var{value}, int *@var{exponent})
+@deftypefunx _FloatN frexpfN (_Float@var{N} @var{value}, int *@var{exponent})
+@deftypefunx _FloatNx frexpfNx (_Float@var{N}x @var{value}, int *@var{exponent})
 @standards{ISO, math.h}
+@standardsx{frexpfN, TS 18661-3:2015, math.h}
+@standardsx{frexpfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions are used to split the number @var{value}
 into a normalized fraction and an exponent.
@@ -1317,7 +1337,11 @@ zero is stored in @code{*@var{exponent}}.
 @deftypefun double ldexp (double @var{value}, int @var{exponent})
 @deftypefunx float ldexpf (float @var{value}, int @var{exponent})
 @deftypefunx {long double} ldexpl (long double @var{value}, int @var{exponent})
+@deftypefunx _FloatN ldexpfN (_Float@var{N} @var{value}, int @var{exponent})
+@deftypefunx _FloatNx ldexpfNx (_Float@var{N}x @var{value}, int @var{exponent})
 @standards{ISO, math.h}
+@standardsx{ldexpfN, TS 18661-3:2015, math.h}
+@standardsx{ldexpfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return the result of multiplying the floating-point
 number @var{value} by 2 raised to the power @var{exponent}.  (It can
@@ -1330,6 +1354,8 @@ For example, @code{ldexp (0.8, 4)} returns @code{12.8}.
 The following functions, which come from BSD, provide facilities
 equivalent to those of @code{ldexp} and @code{frexp}.  See also the
 @w{ISO C} function @code{logb} which originally also appeared in BSD.
+The @code{_Float@var{N}} and @code{_Float@var{N}} variants of the
+following functions come from TS 18661-3:2015.
 
 @deftypefun double scalb (double @var{value}, double @var{exponent})
 @deftypefunx float scalbf (float @var{value}, float @var{exponent})
@@ -1342,7 +1368,11 @@ The @code{scalb} function is the BSD name for @code{ldexp}.
 @deftypefun double scalbn (double @var{x}, int @var{n})
 @deftypefunx float scalbnf (float @var{x}, int @var{n})
 @deftypefunx {long double} scalbnl (long double @var{x}, int @var{n})
+@deftypefunx _FloatN scalbnfN (_Float@var{N} @var{x}, int @var{n})
+@deftypefunx _FloatNx scalbnfNx (_Float@var{N}x @var{x}, int @var{n})
 @standards{BSD, math.h}
+@standardsx{scalbnfN, TS 18661-3:2015, math.h}
+@standardsx{scalbnfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 @code{scalbn} is identical to @code{scalb}, except that the exponent
 @var{n} is an @code{int} instead of a floating-point number.
@@ -1351,7 +1381,11 @@ The @code{scalb} function is the BSD name for @code{ldexp}.
 @deftypefun double scalbln (double @var{x}, long int @var{n})
 @deftypefunx float scalblnf (float @var{x}, long int @var{n})
 @deftypefunx {long double} scalblnl (long double @var{x}, long int @var{n})
+@deftypefunx _FloatN scalblnfN (_Float@var{N} @var{x}, long int @var{n})
+@deftypefunx _FloatNx scalblnfNx (_Float@var{N}x @var{x}, long int @var{n})
 @standards{BSD, math.h}
+@standardsx{scalblnfN, TS 18661-3:2015, math.h}
+@standardsx{scalblnfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 @code{scalbln} is identical to @code{scalb}, except that the exponent
 @var{n} is a @code{long int} instead of a floating-point number.
@@ -1416,7 +1450,11 @@ Round to nearest, ties round to even.
 @deftypefun double ceil (double @var{x})
 @deftypefunx float ceilf (float @var{x})
 @deftypefunx {long double} ceill (long double @var{x})
+@deftypefunx _FloatN ceilfN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx ceilfNx (_Float@var{N}x @var{x})
 @standards{ISO, math.h}
+@standardsx{ceilfN, TS 18661-3:2015, math.h}
+@standardsx{ceilfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions round @var{x} upwards to the nearest integer,
 returning that value as a @code{double}.  Thus, @code{ceil (1.5)}
@@ -1426,7 +1464,11 @@ is @code{2.0}.
 @deftypefun double floor (double @var{x})
 @deftypefunx float floorf (float @var{x})
 @deftypefunx {long double} floorl (long double @var{x})
+@deftypefunx _FloatN floorfN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx floorfNx (_Float@var{N}x @var{x})
 @standards{ISO, math.h}
+@standardsx{floorfN, TS 18661-3:2015, math.h}
+@standardsx{floorfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions round @var{x} downwards to the nearest
 integer, returning that value as a @code{double}.  Thus, @code{floor
@@ -1436,7 +1478,11 @@ integer, returning that value as a @code{double}.  Thus, @code{floor
 @deftypefun double trunc (double @var{x})
 @deftypefunx float truncf (float @var{x})
 @deftypefunx {long double} truncl (long double @var{x})
+@deftypefunx _FloatN truncfN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx truncfNx (_Float@var{N}x @var{x})
 @standards{ISO, math.h}
+@standardsx{truncfN, TS 18661-3:2015, math.h}
+@standardsx{truncfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 The @code{trunc} functions round @var{x} towards zero to the nearest
 integer (returned in floating-point format).  Thus, @code{trunc (1.5)}
@@ -1446,7 +1492,11 @@ is @code{1.0} and @code{trunc (-1.5)} is @code{-1.0}.
 @deftypefun double rint (double @var{x})
 @deftypefunx float rintf (float @var{x})
 @deftypefunx {long double} rintl (long double @var{x})
+@deftypefunx _FloatN rintfN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx rintfNx (_Float@var{N}x @var{x})
 @standards{ISO, math.h}
+@standardsx{rintfN, TS 18661-3:2015, math.h}
+@standardsx{rintfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions round @var{x} to an integer value according to the
 current rounding mode.  @xref{Floating Point Parameters}, for
@@ -1462,7 +1512,11 @@ inexact exception.
 @deftypefun double nearbyint (double @var{x})
 @deftypefunx float nearbyintf (float @var{x})
 @deftypefunx {long double} nearbyintl (long double @var{x})
+@deftypefunx _FloatN nearbyintfN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx nearbyintfNx (_Float@var{N}x @var{x})
 @standards{ISO, math.h}
+@standardsx{nearbyintfN, TS 18661-3:2015, math.h}
+@standardsx{nearbyintfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return the same value as the @code{rint} functions, but
 do not raise the inexact exception if @var{x} is not an integer.
@@ -1471,7 +1525,11 @@ do not raise the inexact exception if @var{x} is not an integer.
 @deftypefun double round (double @var{x})
 @deftypefunx float roundf (float @var{x})
 @deftypefunx {long double} roundl (long double @var{x})
+@deftypefunx _FloatN roundfN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx roundfNx (_Float@var{N}x @var{x})
 @standards{ISO, math.h}
+@standardsx{roundfN, TS 18661-3:2015, math.h}
+@standardsx{roundfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions are similar to @code{rint}, but they round halfway
 cases away from zero instead of to the nearest integer (or other
@@ -1481,16 +1539,25 @@ current rounding mode).
 @deftypefun double roundeven (double @var{x})
 @deftypefunx float roundevenf (float @var{x})
 @deftypefunx {long double} roundevenl (long double @var{x})
+@deftypefunx _FloatN roundevenfN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx roundevenfNx (_Float@var{N}x @var{x})
 @standards{ISO, math.h}
+@standardsx{roundevenfN, TS 18661-3:2015, math.h}
+@standardsx{roundevenfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
-These functions, from TS 18661-1:2014, are similar to @code{round},
-but they round halfway cases to even instead of away from zero.
+These functions, from TS 18661-1:2014 and TS 18661-3:2015, are similar
+to @code{round}, but they round halfway cases to even instead of away
+from zero.
 @end deftypefun
 
 @deftypefun {long int} lrint (double @var{x})
 @deftypefunx {long int} lrintf (float @var{x})
 @deftypefunx {long int} lrintl (long double @var{x})
+@deftypefunx {long int} lrintfN (_Float@var{N} @var{x})
+@deftypefunx {long int} lrintfNx (_Float@var{N}x @var{x})
 @standards{ISO, math.h}
+@standardsx{lrintfN, TS 18661-3:2015, math.h}
+@standardsx{lrintfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions are just like @code{rint}, but they return a
 @code{long int} instead of a floating-point number.
@@ -1499,7 +1566,11 @@ These functions are just like @code{rint}, but they return a
 @deftypefun {long long int} llrint (double @var{x})
 @deftypefunx {long long int} llrintf (float @var{x})
 @deftypefunx {long long int} llrintl (long double @var{x})
+@deftypefunx {long long int} llrintfN (_Float@var{N} @var{x})
+@deftypefunx {long long int} llrintfNx (_Float@var{N}x @var{x})
 @standards{ISO, math.h}
+@standardsx{llrintfN, TS 18661-3:2015, math.h}
+@standardsx{llrintfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions are just like @code{rint}, but they return a
 @code{long long int} instead of a floating-point number.
@@ -1508,7 +1579,11 @@ These functions are just like @code{rint}, but they return a
 @deftypefun {long int} lround (double @var{x})
 @deftypefunx {long int} lroundf (float @var{x})
 @deftypefunx {long int} lroundl (long double @var{x})
+@deftypefunx {long int} lroundfN (_Float@var{N} @var{x})
+@deftypefunx {long int} lroundfNx (_Float@var{N}x @var{x})
 @standards{ISO, math.h}
+@standardsx{lroundfN, TS 18661-3:2015, math.h}
+@standardsx{lroundfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions are just like @code{round}, but they return a
 @code{long int} instead of a floating-point number.
@@ -1517,7 +1592,11 @@ These functions are just like @code{round}, but they return a
 @deftypefun {long long int} llround (double @var{x})
 @deftypefunx {long long int} llroundf (float @var{x})
 @deftypefunx {long long int} llroundl (long double @var{x})
+@deftypefunx {long long int} llroundfN (_Float@var{N} @var{x})
+@deftypefunx {long long int} llroundfNx (_Float@var{N}x @var{x})
 @standards{ISO, math.h}
+@standardsx{llroundfN, TS 18661-3:2015, math.h}
+@standardsx{llroundfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions are just like @code{round}, but they return a
 @code{long long int} instead of a floating-point number.
@@ -1526,27 +1605,43 @@ These functions are just like @code{round}, but they return a
 @deftypefun intmax_t fromfp (double @var{x}, int @var{round}, unsigned int @var{width})
 @deftypefunx intmax_t fromfpf (float @var{x}, int @var{round}, unsigned int @var{width})
 @deftypefunx intmax_t fromfpl (long double @var{x}, int @var{round}, unsigned int @var{width})
+@deftypefunx intmax_t fromfpfN (_Float@var{N} @var{x}, int @var{round}, unsigned int @var{width})
+@deftypefunx intmax_t fromfpfNx (_Float@var{N}x @var{x}, int @var{round}, unsigned int @var{width})
 @deftypefunx uintmax_t ufromfp (double @var{x}, int @var{round}, unsigned int @var{width})
 @deftypefunx uintmax_t ufromfpf (float @var{x}, int @var{round}, unsigned int @var{width})
 @deftypefunx uintmax_t ufromfpl (long double @var{x}, int @var{round}, unsigned int @var{width})
+@deftypefunx uintmax_t ufromfpfN (_Float@var{N} @var{x}, int @var{round}, unsigned int @var{width})
+@deftypefunx uintmax_t ufromfpfNx (_Float@var{N}x @var{x}, int @var{round}, unsigned int @var{width})
 @deftypefunx intmax_t fromfpx (double @var{x}, int @var{round}, unsigned int @var{width})
 @deftypefunx intmax_t fromfpxf (float @var{x}, int @var{round}, unsigned int @var{width})
 @deftypefunx intmax_t fromfpxl (long double @var{x}, int @var{round}, unsigned int @var{width})
+@deftypefunx intmax_t fromfpxfN (_Float@var{N} @var{x}, int @var{round}, unsigned int @var{width})
+@deftypefunx intmax_t fromfpxfNx (_Float@var{N}x @var{x}, int @var{round}, unsigned int @var{width})
 @deftypefunx uintmax_t ufromfpx (double @var{x}, int @var{round}, unsigned int @var{width})
 @deftypefunx uintmax_t ufromfpxf (float @var{x}, int @var{round}, unsigned int @var{width})
 @deftypefunx uintmax_t ufromfpxl (long double @var{x}, int @var{round}, unsigned int @var{width})
+@deftypefunx uintmax_t ufromfpxfN (_Float@var{N} @var{x}, int @var{round}, unsigned int @var{width})
+@deftypefunx uintmax_t ufromfpxfNx (_Float@var{N}x @var{x}, int @var{round}, unsigned int @var{width})
 @standards{ISO, math.h}
-@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
-These functions, from TS 18661-1:2014, convert a floating-point number
-to an integer according to the rounding direction @var{round} (one of
-the @code{FP_INT_*} macros).  If the integer is outside the range of a
-signed or unsigned (depending on the return type of the function) type
-of width @var{width} bits (or outside the range of the return type, if
-@var{width} is larger), or if @var{x} is infinite or NaN, or if
-@var{width} is zero, a domain error occurs and an unspecified value is
-returned.  The functions with an @samp{x} in their names raise the
-inexact exception when a domain error does not occur and the argument
-is not an integer; the other functions do not raise the inexact
+@standardsx{fromfpfN, TS 18661-3:2015, math.h}
+@standardsx{fromfpfNx, TS 18661-3:2015, math.h}
+@standardsx{ufromfpfN, TS 18661-3:2015, math.h}
+@standardsx{ufromfpfNx, TS 18661-3:2015, math.h}
+@standardsx{fromfpxfN, TS 18661-3:2015, math.h}
+@standardsx{fromfpxfNx, TS 18661-3:2015, math.h}
+@standardsx{ufromfpxfN, TS 18661-3:2015, math.h}
+@standardsx{ufromfpxfNx, TS 18661-3:2015, math.h}
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
+These functions, from TS 18661-1:2014 and TS 18661-3:2015, convert a
+floating-point number to an integer according to the rounding direction
+@var{round} (one of the @code{FP_INT_*} macros).  If the integer is
+outside the range of a signed or unsigned (depending on the return type
+of the function) type of width @var{width} bits (or outside the range of
+the return type, if @var{width} is larger), or if @var{x} is infinite or
+NaN, or if @var{width} is zero, a domain error occurs and an unspecified
+value is returned.  The functions with an @samp{x} in their names raise
+the inexact exception when a domain error does not occur and the
+argument is not an integer; the other functions do not raise the inexact
 exception.
 @end deftypefun
 
@@ -1554,7 +1649,11 @@ exception.
 @deftypefun double modf (double @var{value}, double *@var{integer-part})
 @deftypefunx float modff (float @var{value}, float *@var{integer-part})
 @deftypefunx {long double} modfl (long double @var{value}, long double *@var{integer-part})
+@deftypefunx _FloatN modffN (_Float@var{N} @var{value}, _Float@var{N} *@var{integer-part})
+@deftypefunx _FloatNx modffNx (_Float@var{N}x @var{value}, _Float@var{N}x *@var{integer-part})
 @standards{ISO, math.h}
+@standardsx{modffN, TS 18661-3:2015, math.h}
+@standardsx{modffNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions break the argument @var{value} into an integer part and a
 fractional part (between @code{-1} and @code{1}, exclusive).  Their sum
@@ -1576,7 +1675,11 @@ suits your problem.
 @deftypefun double fmod (double @var{numerator}, double @var{denominator})
 @deftypefunx float fmodf (float @var{numerator}, float @var{denominator})
 @deftypefunx {long double} fmodl (long double @var{numerator}, long double @var{denominator})
+@deftypefunx _FloatN fmodfN (_Float@var{N} @var{numerator}, _Float@var{N} @var{denominator})
+@deftypefunx _FloatNx fmodfNx (_Float@var{N}x @var{numerator}, _Float@var{N}x @var{denominator})
 @standards{ISO, math.h}
+@standardsx{fmodfN, TS 18661-3:2015, math.h}
+@standardsx{fmodfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions compute the remainder from the division of
 @var{numerator} by @var{denominator}.  Specifically, the return value is
@@ -1594,7 +1697,11 @@ If @var{denominator} is zero, @code{fmod} signals a domain error.
 @deftypefun double remainder (double @var{numerator}, double @var{denominator})
 @deftypefunx float remainderf (float @var{numerator}, float @var{denominator})
 @deftypefunx {long double} remainderl (long double @var{numerator}, long double @var{denominator})
+@deftypefunx _FloatN remainderfN (_Float@var{N} @var{numerator}, _Float@var{N} @var{denominator})
+@deftypefunx _FloatNx remainderfNx (_Float@var{N}x @var{numerator}, _Float@var{N}x @var{denominator})
 @standards{ISO, math.h}
+@standardsx{remainderfN, TS 18661-3:2015, math.h}
+@standardsx{remainderfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions are like @code{fmod} except that they round the
 internal quotient @var{n} to the nearest integer instead of towards zero
@@ -1630,7 +1737,11 @@ bits.
 @deftypefun double copysign (double @var{x}, double @var{y})
 @deftypefunx float copysignf (float @var{x}, float @var{y})
 @deftypefunx {long double} copysignl (long double @var{x}, long double @var{y})
+@deftypefunx _FloatN copysignfN (_Float@var{N} @var{x}, _Float@var{N} @var{y})
+@deftypefunx _FloatNx copysignfNx (_Float@var{N}x @var{x}, _Float@var{N}x @var{y})
 @standards{ISO, math.h}
+@standardsx{copysignfN, TS 18661-3:2015, math.h}
+@standardsx{copysignfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return @var{x} but with the sign of @var{y}.  They work
 even if @var{x} or @var{y} are NaN or zero.  Both of these can carry a
@@ -1659,7 +1770,11 @@ false, but @code{signbit (-0.0)} will return a nonzero value.
 @deftypefun double nextafter (double @var{x}, double @var{y})
 @deftypefunx float nextafterf (float @var{x}, float @var{y})
 @deftypefunx {long double} nextafterl (long double @var{x}, long double @var{y})
+@deftypefunx _FloatN nextafterfN (_Float@var{N} @var{x}, _Float@var{N} @var{y})
+@deftypefunx _FloatNx nextafterfNx (_Float@var{N}x @var{x}, _Float@var{N}x @var{y})
 @standards{ISO, math.h}
+@standardsx{nextafterfN, TS 18661-3:2015, math.h}
+@standardsx{nextafterfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 The @code{nextafter} function returns the next representable neighbor of
 @var{x} in the direction towards @var{y}.  The size of the step between
@@ -1688,7 +1803,11 @@ double}.
 @deftypefun double nextup (double @var{x})
 @deftypefunx float nextupf (float @var{x})
 @deftypefunx {long double} nextupl (long double @var{x})
+@deftypefunx _FloatN nextupfN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx nextupfNx (_Float@var{N}x @var{x})
 @standards{ISO, math.h}
+@standardsx{nextupfN, TS 18661-3:2015, math.h}
+@standardsx{nextupfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 The @code{nextup} function returns the next representable neighbor of @var{x}
 in the direction of positive infinity.  If @var{x} is the smallest negative
@@ -1696,14 +1815,18 @@ subnormal number in the type of @var{x} the function returns @code{-0}.  If
 @math{@var{x} = @code{0}} the function returns the smallest positive subnormal
 number in the type of @var{x}.  If @var{x} is NaN, NaN is returned.
 If @var{x} is @math{+@infinity{}}, @math{+@infinity{}} is returned.
-@code{nextup} is from TS 18661-1:2014.
+@code{nextup} is from TS 18661-1:2014 and TS 18661-3:2015.
 @code{nextup} never raises an exception except for signaling NaNs.
 @end deftypefun
 
 @deftypefun double nextdown (double @var{x})
 @deftypefunx float nextdownf (float @var{x})
 @deftypefunx {long double} nextdownl (long double @var{x})
+@deftypefunx _FloatN nextdownfN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx nextdownfNx (_Float@var{N}x @var{x})
 @standards{ISO, math.h}
+@standardsx{nextdownfN, TS 18661-3:2015, math.h}
+@standardsx{nextdownfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 The @code{nextdown} function returns the next representable neighbor of @var{x}
 in the direction of negative infinity.  If @var{x} is the smallest positive
@@ -1711,7 +1834,7 @@ subnormal number in the type of @var{x} the function returns @code{+0}.  If
 @math{@var{x} = @code{0}} the function returns the smallest negative subnormal
 number in the type of @var{x}.  If @var{x} is NaN, NaN is returned.
 If @var{x} is @math{-@infinity{}}, @math{-@infinity{}} is returned.
-@code{nextdown} is from TS 18661-1:2014.
+@code{nextdown} is from TS 18661-1:2014 and TS 18661-3:2015.
 @code{nextdown} never raises an exception except for signaling NaNs.
 @end deftypefun
 
@@ -1719,7 +1842,11 @@ If @var{x} is @math{-@infinity{}}, @math{-@infinity{}} is returned.
 @deftypefun double nan (const char *@var{tagp})
 @deftypefunx float nanf (const char *@var{tagp})
 @deftypefunx {long double} nanl (const char *@var{tagp})
+@deftypefunx _FloatN nanfN (const char *@var{tagp})
+@deftypefunx _FloatNx nanfNx (const char *@var{tagp})
 @standards{ISO, math.h}
+@standardsx{nanfN, TS 18661-3:2015, math.h}
+@standardsx{nanfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{@mtslocale{}}@assafe{}@acsafe{}}
 @c The unsafe-but-ruled-safe locale use comes from strtod.
 The @code{nan} function returns a representation of NaN, provided that
@@ -1735,13 +1862,17 @@ selects one.  On other systems it may do nothing.
 @deftypefun int canonicalize (double *@var{cx}, const double *@var{x})
 @deftypefunx int canonicalizef (float *@var{cx}, const float *@var{x})
 @deftypefunx int canonicalizel (long double *@var{cx}, const long double *@var{x})
+@deftypefunx int canonicalizefN (_Float@var{N} *@var{cx}, const _Float@var{N} *@var{x})
+@deftypefunx int canonicalizefNx (_Float@var{N}x *@var{cx}, const _Float@var{N}x *@var{x})
 @standards{ISO, math.h}
+@standardsx{canonicalizefN, TS 18661-3:2015, math.h}
+@standardsx{canonicalizefNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 In some floating-point formats, some values have canonical (preferred)
 and noncanonical encodings (for IEEE interchange binary formats, all
 encodings are canonical).  These functions, defined by TS
-18661-1:2014, attempt to produce a canonical version of the
-floating-point value pointed to by @var{x}; if that value is a
+18661-1:2014 and TS 18661-3:2015, attempt to produce a canonical version
+of the floating-point value pointed to by @var{x}; if that value is a
 signaling NaN, they raise the invalid exception and produce a quiet
 NaN.  If a canonical value is produced, it is stored in the object
 pointed to by @var{cx}, and these functions return zero.  Otherwise
@@ -1760,42 +1891,56 @@ produced as output.
 @deftypefun double getpayload (const double *@var{x})
 @deftypefunx float getpayloadf (const float *@var{x})
 @deftypefunx {long double} getpayloadl (const long double *@var{x})
+@deftypefunx _FloatN getpayloadfN (const _Float@var{N} *@var{x})
+@deftypefunx _FloatNx getpayloadfNx (const _Float@var{N}x *@var{x})
 @standards{ISO, math.h}
+@standardsx{getpayloadfN, TS 18661-3:2015, math.h}
+@standardsx{getpayloadfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 IEEE 754 defines the @dfn{payload} of a NaN to be an integer value
 encoded in the representation of the NaN.  Payloads are typically
 propagated from NaN inputs to the result of a floating-point
-operation.  These functions, defined by TS 18661-1:2014, return the
-payload of the NaN pointed to by @var{x} (returned as a positive
-integer, or positive zero, represented as a floating-point number); if
-@var{x} is not a NaN, they return an unspecified value.  They raise no
-floating-point exceptions even for signaling NaNs.
+operation.  These functions, defined by TS 18661-1:2014 and TS
+18661-3:2015, return the payload of the NaN pointed to by @var{x}
+(returned as a positive integer, or positive zero, represented as a
+floating-point number); if @var{x} is not a NaN, they return an
+unspecified value.  They raise no floating-point exceptions even for
+signaling NaNs.
 @end deftypefun
 
 @deftypefun int setpayload (double *@var{x}, double @var{payload})
 @deftypefunx int setpayloadf (float *@var{x}, float @var{payload})
 @deftypefunx int setpayloadl (long double *@var{x}, long double @var{payload})
+@deftypefunx int setpayloadfN (_Float@var{N} *@var{x}, _Float@var{N} @var{payload})
+@deftypefunx int setpayloadfNx (_Float@var{N}x *@var{x}, _Float@var{N}x @var{payload})
 @standards{ISO, math.h}
+@standardsx{setpayloadfN, TS 18661-3:2015, math.h}
+@standardsx{setpayloadfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
-These functions, defined by TS 18661-1:2014, set the object pointed to
-by @var{x} to a quiet NaN with payload @var{payload} and a zero sign
-bit and return zero.  If @var{payload} is not a positive-signed
-integer that is a valid payload for a quiet NaN of the given type, the
-object pointed to by @var{x} is set to positive zero and a nonzero
-value is returned.  They raise no floating-point exceptions.
+These functions, defined by TS 18661-1:2014 and TS 18661-3:2015, set the
+object pointed to by @var{x} to a quiet NaN with payload @var{payload}
+and a zero sign bit and return zero.  If @var{payload} is not a
+positive-signed integer that is a valid payload for a quiet NaN of the
+given type, the object pointed to by @var{x} is set to positive zero and
+a nonzero value is returned.  They raise no floating-point exceptions.
 @end deftypefun
 
 @deftypefun int setpayloadsig (double *@var{x}, double @var{payload})
 @deftypefunx int setpayloadsigf (float *@var{x}, float @var{payload})
 @deftypefunx int setpayloadsigl (long double *@var{x}, long double @var{payload})
+@deftypefunx int setpayloadsigfN (_Float@var{N} *@var{x}, _Float@var{N} @var{payload})
+@deftypefunx int setpayloadsigfNx (_Float@var{N}x *@var{x}, _Float@var{N}x @var{payload})
 @standards{ISO, math.h}
+@standardsx{setpayloadsigfN, TS 18661-3:2015, math.h}
+@standardsx{setpayloadsigfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
-These functions, defined by TS 18661-1:2014, set the object pointed to
-by @var{x} to a signaling NaN with payload @var{payload} and a zero
-sign bit and return zero.  If @var{payload} is not a positive-signed
-integer that is a valid payload for a signaling NaN of the given type,
-the object pointed to by @var{x} is set to positive zero and a nonzero
-value is returned.  They raise no floating-point exceptions.
+These functions, defined by TS 18661-1:2014 and TS 18661-3:2015, set the
+object pointed to by @var{x} to a signaling NaN with payload
+@var{payload} and a zero sign bit and return zero.  If @var{payload} is
+not a positive-signed integer that is a valid payload for a signaling
+NaN of the given type, the object pointed to by @var{x} is set to
+positive zero and a nonzero value is returned.  They raise no
+floating-point exceptions.
 @end deftypefun
 
 @node FP Comparison Functions
@@ -1886,7 +2031,11 @@ NaN.
 @deftypefun int totalorder (double @var{x}, double @var{y})
 @deftypefunx int totalorderf (float @var{x}, float @var{y})
 @deftypefunx int totalorderl (long double @var{x}, long double @var{y})
+@deftypefunx int totalorderfN (_Float@var{N} @var{x}, _Float@var{N} @var{y})
+@deftypefunx int totalorderfNx (_Float@var{N}x @var{x}, _Float@var{N}x @var{y})
 @standards{TS 18661-1:2014, math.h}
+@standardsx{totalorderfN, TS 18661-3:2015, math.h}
+@standardsx{totalorderfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions determine whether the total order relationship,
 defined in IEEE 754-2008, is true for @var{x} and @var{y}, returning
@@ -1905,7 +2054,11 @@ payload.
 @deftypefun int totalordermag (double @var{x}, double @var{y})
 @deftypefunx int totalordermagf (float @var{x}, float @var{y})
 @deftypefunx int totalordermagl (long double @var{x}, long double @var{y})
+@deftypefunx int totalordermagfN (_Float@var{N} @var{x}, _Float@var{N} @var{y})
+@deftypefunx int totalordermagfNx (_Float@var{N}x @var{x}, _Float@var{N}x @var{y})
 @standards{TS 18661-1:2014, math.h}
+@standardsx{totalordermagfN, TS 18661-3:2015, math.h}
+@standardsx{totalordermagfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions determine whether the total order relationship,
 defined in IEEE 754-2008, is true for the absolute values of @var{x}
@@ -1936,7 +2089,11 @@ perform these operations faster than the equivalent C code.
 @deftypefun double fmin (double @var{x}, double @var{y})
 @deftypefunx float fminf (float @var{x}, float @var{y})
 @deftypefunx {long double} fminl (long double @var{x}, long double @var{y})
+@deftypefunx _FloatN fminfN (_Float@var{N} @var{x}, _Float@var{N} @var{y})
+@deftypefunx _FloatNx fminfNx (_Float@var{N}x @var{x}, _Float@var{N}x @var{y})
 @standards{ISO, math.h}
+@standardsx{fminfN, TS 18661-3:2015, math.h}
+@standardsx{fminfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 The @code{fmin} function returns the lesser of the two values @var{x}
 and @var{y}.  It is similar to the expression
@@ -1952,7 +2109,11 @@ are NaN, NaN is returned.
 @deftypefun double fmax (double @var{x}, double @var{y})
 @deftypefunx float fmaxf (float @var{x}, float @var{y})
 @deftypefunx {long double} fmaxl (long double @var{x}, long double @var{y})
+@deftypefunx _FloatN fmaxfN (_Float@var{N} @var{x}, _Float@var{N} @var{y})
+@deftypefunx _FloatNx fmaxfNx (_Float@var{N}x @var{x}, _Float@var{N}x @var{y})
 @standards{ISO, math.h}
+@standardsx{fmaxfN, TS 18661-3:2015, math.h}
+@standardsx{fmaxfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 The @code{fmax} function returns the greater of the two values @var{x}
 and @var{y}.
@@ -1964,18 +2125,26 @@ are NaN, NaN is returned.
 @deftypefun double fminmag (double @var{x}, double @var{y})
 @deftypefunx float fminmagf (float @var{x}, float @var{y})
 @deftypefunx {long double} fminmagl (long double @var{x}, long double @var{y})
+@deftypefunx _FloatN fminmagfN (_Float@var{N} @var{x}, _Float@var{N} @var{y})
+@deftypefunx _FloatNx fminmagfNx (_Float@var{N}x @var{x}, _Float@var{N}x @var{y})
 @standards{ISO, math.h}
+@standardsx{fminmagfN, TS 18661-3:2015, math.h}
+@standardsx{fminmagfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
-These functions, from TS 18661-1:2014, return whichever of the two
-values @var{x} and @var{y} has the smaller absolute value.  If both
-have the same absolute value, or either is NaN, they behave the same
-as the @code{fmin} functions.
+These functions, from TS 18661-1:2014 and TS 18661-3:2015, return
+whichever of the two values @var{x} and @var{y} has the smaller absolute
+value.  If both have the same absolute value, or either is NaN, they
+behave the same as the @code{fmin} functions.
 @end deftypefun
 
 @deftypefun double fmaxmag (double @var{x}, double @var{y})
 @deftypefunx float fmaxmagf (float @var{x}, float @var{y})
 @deftypefunx {long double} fmaxmagl (long double @var{x}, long double @var{y})
+@deftypefunx _FloatN fmaxmagfN (_Float@var{N} @var{x}, _Float@var{N} @var{y})
+@deftypefunx _FloatNx fmaxmagfNx (_Float@var{N}x @var{x}, _Float@var{N}x @var{y})
 @standards{ISO, math.h}
+@standardsx{fmaxmagfN, TS 18661-3:2015, math.h}
+@standardsx{fmaxmagfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions, from TS 18661-1:2014, return whichever of the two
 values @var{x} and @var{y} has the greater absolute value.  If both
@@ -1986,7 +2155,11 @@ as the @code{fmax} functions.
 @deftypefun double fdim (double @var{x}, double @var{y})
 @deftypefunx float fdimf (float @var{x}, float @var{y})
 @deftypefunx {long double} fdiml (long double @var{x}, long double @var{y})
+@deftypefunx _FloatN fdimfN (_Float@var{N} @var{x}, _Float@var{N} @var{y})
+@deftypefunx _FloatNx fdimfNx (_Float@var{N}x @var{x}, _Float@var{N}x @var{y})
 @standards{ISO, math.h}
+@standardsx{fdimfN, TS 18661-3:2015, math.h}
+@standardsx{fdimfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 The @code{fdim} function returns the positive difference between
 @var{x} and @var{y}.  The positive difference is @math{@var{x} -
@@ -1998,7 +2171,11 @@ If @var{x}, @var{y}, or both are NaN, NaN is returned.
 @deftypefun double fma (double @var{x}, double @var{y}, double @var{z})
 @deftypefunx float fmaf (float @var{x}, float @var{y}, float @var{z})
 @deftypefunx {long double} fmal (long double @var{x}, long double @var{y}, long double @var{z})
+@deftypefunx _FloatN fmafN (_Float@var{N} @var{x}, _Float@var{N} @var{y}, _Float@var{N} @var{z})
+@deftypefunx _FloatNx fmafNx (_Float@var{N}x @var{x}, _Float@var{N}x @var{y}, _Float@var{N}x @var{z})
 @standards{ISO, math.h}
+@standardsx{fmafN, TS 18661-3:2015, math.h}
+@standardsx{fmafNx, TS 18661-3:2015, math.h}
 @cindex butterfly
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 The @code{fma} function performs floating-point multiply-add.  This is
@@ -2033,6 +2210,11 @@ if @file{complex.h} has been included.  There are three complex types,
 corresponding to the three real types:  @code{float complex},
 @code{double complex}, and @code{long double complex}.
 
+Likewise, on machines that have support for @code{_Float@var{N}} or
+@code{_Float@var{N}x} enabled, the complex types @code{_Float@var{N}
+complex} and @code{_Float@var{N}x complex} are also available if
+@file{complex.h} has been included; @pxref{Mathematics}.
+
 To construct complex numbers you need a way to indicate the imaginary
 part of a number.  There is no standard notation for an imaginary
 floating point constant.  Instead, @file{complex.h} defines two macros
@@ -2126,7 +2308,11 @@ available in three variants, one for each of the three complex types.
 @deftypefun double creal (complex double @var{z})
 @deftypefunx float crealf (complex float @var{z})
 @deftypefunx {long double} creall (complex long double @var{z})
+@deftypefunx _FloatN crealfN (complex _Float@var{N} @var{z})
+@deftypefunx _FloatNx crealfNx (complex _Float@var{N}x @var{z})
 @standards{ISO, complex.h}
+@standardsx{crealfN, TS 18661-3:2015, complex.h}
+@standardsx{crealfNx, TS 18661-3:2015, complex.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return the real part of the complex number @var{z}.
 @end deftypefun
@@ -2134,7 +2320,11 @@ These functions return the real part of the complex number @var{z}.
 @deftypefun double cimag (complex double @var{z})
 @deftypefunx float cimagf (complex float @var{z})
 @deftypefunx {long double} cimagl (complex long double @var{z})
+@deftypefunx _FloatN cimagfN (complex _Float@var{N} @var{z})
+@deftypefunx _FloatNx cimagfNx (complex _Float@var{N}x @var{z})
 @standards{ISO, complex.h}
+@standardsx{cimagfN, TS 18661-3:2015, complex.h}
+@standardsx{cimagfNx, TS 18661-3:2015, complex.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return the imaginary part of the complex number @var{z}.
 @end deftypefun
@@ -2142,7 +2332,11 @@ These functions return the imaginary part of the complex number @var{z}.
 @deftypefun {complex double} conj (complex double @var{z})
 @deftypefunx {complex float} conjf (complex float @var{z})
 @deftypefunx {complex long double} conjl (complex long double @var{z})
+@deftypefunx {complex _FloatN} conjfN (complex _Float@var{N} @var{z})
+@deftypefunx {complex _FloatNx} conjfNx (complex _Float@var{N}x @var{z})
 @standards{ISO, complex.h}
+@standardsx{conjfN, TS 18661-3:2015, complex.h}
+@standardsx{conjfNx, TS 18661-3:2015, complex.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return the conjugate value of the complex number
 @var{z}.  The conjugate of a complex number has the same real part and a
@@ -2152,7 +2346,11 @@ negated imaginary part.  In other words, @samp{conj(a + bi) = a + -bi}.
 @deftypefun double carg (complex double @var{z})
 @deftypefunx float cargf (complex float @var{z})
 @deftypefunx {long double} cargl (complex long double @var{z})
+@deftypefunx _FloatN cargfN (complex _Float@var{N} @var{z})
+@deftypefunx _FloatNx cargfNx (complex _Float@var{N}x @var{z})
 @standards{ISO, complex.h}
+@standardsx{cargfN, TS 18661-3:2015, complex.h}
+@standardsx{cargfNx, TS 18661-3:2015, complex.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return the argument of the complex number @var{z}.
 The argument of a complex number is the angle in the complex plane
@@ -2166,7 +2364,11 @@ number.  This angle is measured in the usual fashion and ranges from
 @deftypefun {complex double} cproj (complex double @var{z})
 @deftypefunx {complex float} cprojf (complex float @var{z})
 @deftypefunx {complex long double} cprojl (complex long double @var{z})
+@deftypefunx {complex _FloatN} cprojfN (complex _Float@var{N} @var{z})
+@deftypefunx {complex _FloatNx} cprojfNx (complex _Float@var{N}x @var{z})
 @standards{ISO, complex.h}
+@standardsx{cprojfN, TS 18661-3:2015, complex.h}
+@standardsx{cprojfNx, TS 18661-3:2015, complex.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return the projection of the complex value @var{z} onto
 the Riemann sphere.  Values with an infinite imaginary part are projected
diff --git a/manual/math.texi b/manual/math.texi
index 912e740..5bd3341 100644
--- a/manual/math.texi
+++ b/manual/math.texi
@@ -59,7 +59,11 @@ On some machines, @theglibc{} also provides @code{_Float@var{N}} and
 are not machine-dependent.  When such a type, such as @code{_Float128},
 is supported by @theglibc{}, extra variants for most of the mathematical
 functions provided for @code{double}, @code{float}, and @code{long
-double} are also provided for the supported type.
+double} are also provided for the supported type.  Throughout this
+manual, the @code{_Float@var{N}} and @code{_Float@var{N}x} variants of
+these functions are described along with the @code{double},
+@code{float}, and @code{long double} variants and they come from
+@w{ISO/IEC TS 18661-3}, unless explicitly stated otherwise.
 
 Currently, support for @code{_Float@var{N}} or @code{_Float@var{N}x}
 types is not provided for any machine.
@@ -128,6 +132,13 @@ also defines these constants with type @code{long double}.  The
 names: @code{M_El}, @code{M_PIl}, and so forth.  These are only
 available if @code{_GNU_SOURCE} is defined.
 
+Likewise, @theglibc{} also defines these constants with the types
+@code{_Float@var{N}} and @code{_Float@var{N}x} for the machines that
+have support for such types enabled (@pxref{Mathematics}) and if
+@code{_GNU_SOURCE} is defined.  When available, the macros names are
+appended with @samp{f@var{N}} or @samp{f@var{N}x}, such as @samp{f128}
+for the type @code{_Float128}.
+
 @vindex PI
 @emph{Note:} Some programs use a constant named @code{PI} which has the
 same value as @code{M_PI}.  This constant is not standard; it may have
@@ -162,7 +173,11 @@ You can also compute the value of pi with the expression @code{acos
 @deftypefun double sin (double @var{x})
 @deftypefunx float sinf (float @var{x})
 @deftypefunx {long double} sinl (long double @var{x})
+@deftypefunx _FloatN sinfN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx sinfNx (_Float@var{N}x @var{x})
 @standards{ISO, math.h}
+@standardsx{sinfN, TS 18661-3:2015, math.h}
+@standardsx{sinfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return the sine of @var{x}, where @var{x} is given in
 radians.  The return value is in the range @code{-1} to @code{1}.
@@ -171,7 +186,11 @@ radians.  The return value is in the range @code{-1} to @code{1}.
 @deftypefun double cos (double @var{x})
 @deftypefunx float cosf (float @var{x})
 @deftypefunx {long double} cosl (long double @var{x})
+@deftypefunx _FloatN cosfN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx cosfNx (_Float@var{N}x @var{x})
 @standards{ISO, math.h}
+@standardsx{cosfN, TS 18661-3:2015, math.h}
+@standardsx{cosfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return the cosine of @var{x}, where @var{x} is given in
 radians.  The return value is in the range @code{-1} to @code{1}.
@@ -180,7 +199,11 @@ radians.  The return value is in the range @code{-1} to @code{1}.
 @deftypefun double tan (double @var{x})
 @deftypefunx float tanf (float @var{x})
 @deftypefunx {long double} tanl (long double @var{x})
+@deftypefunx _FloatN tanfN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx tanfNx (_Float@var{N}x @var{x})
 @standards{ISO, math.h}
+@standardsx{tanfN, TS 18661-3:2015, math.h}
+@standardsx{tanfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return the tangent of @var{x}, where @var{x} is given in
 radians.
@@ -198,6 +221,8 @@ function to do that.
 @deftypefun void sincos (double @var{x}, double *@var{sinx}, double *@var{cosx})
 @deftypefunx void sincosf (float @var{x}, float *@var{sinx}, float *@var{cosx})
 @deftypefunx void sincosl (long double @var{x}, long double *@var{sinx}, long double *@var{cosx})
+@deftypefunx _FloatN sincosfN (_Float@var{N} @var{x}, _Float@var{N} *@var{sinx}, _Float@var{N} *@var{cosx})
+@deftypefunx _FloatNx sincosfNx (_Float@var{N}x @var{x}, _Float@var{N}x *@var{sinx}, _Float@var{N}x *@var{cosx})
 @standards{GNU, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return the sine of @var{x} in @code{*@var{sinx}} and the
@@ -205,8 +230,9 @@ cosine of @var{x} in @code{*@var{cosx}}, where @var{x} is given in
 radians.  Both values, @code{*@var{sinx}} and @code{*@var{cosx}}, are in
 the range of @code{-1} to @code{1}.
 
-This function is a GNU extension.  Portable programs should be prepared
-to cope with its absence.
+All these functions, including the @code{_Float@var{N}} and
+@code{_Float@var{N}x} variants, are GNU extensions.  Portable programs
+should be prepared to cope with its absence.
 @end deftypefun
 
 @cindex complex trigonometric functions
@@ -222,7 +248,11 @@ the implementation.)
 @deftypefun {complex double} csin (complex double @var{z})
 @deftypefunx {complex float} csinf (complex float @var{z})
 @deftypefunx {complex long double} csinl (complex long double @var{z})
+@deftypefunx {complex _FloatN} csinfN (complex _Float@var{N} @var{z})
+@deftypefunx {complex _FloatNx} csinfNx (complex _Float@var{N}x @var{z})
 @standards{ISO, complex.h}
+@standardsx{csinfN, TS 18661-3:2015, complex.h}
+@standardsx{csinfNx, TS 18661-3:2015, complex.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 @c There are calls to nan* that could trigger @mtslocale if they didn't get
 @c empty strings.
@@ -240,7 +270,11 @@ $$\sin(z) = {1\over 2i} (e^{zi} - e^{-zi})$$
 @deftypefun {complex double} ccos (complex double @var{z})
 @deftypefunx {complex float} ccosf (complex float @var{z})
 @deftypefunx {complex long double} ccosl (complex long double @var{z})
+@deftypefunx {complex _FloatN} ccosfN (complex _Float@var{N} @var{z})
+@deftypefunx {complex _FloatNx} ccosfNx (complex _Float@var{N}x @var{z})
 @standards{ISO, complex.h}
+@standardsx{ccosfN, TS 18661-3:2015, complex.h}
+@standardsx{ccosfNx, TS 18661-3:2015, complex.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return the complex cosine of @var{z}.
 The mathematical definition of the complex cosine is
@@ -256,7 +290,11 @@ $$\cos(z) = {1\over 2} (e^{zi} + e^{-zi})$$
 @deftypefun {complex double} ctan (complex double @var{z})
 @deftypefunx {complex float} ctanf (complex float @var{z})
 @deftypefunx {complex long double} ctanl (complex long double @var{z})
+@deftypefunx {complex _FloatN} ctanfN (complex _Float@var{N} @var{z})
+@deftypefunx {complex _FloatNx} ctanfNx (complex _Float@var{N}x @var{z})
 @standards{ISO, complex.h}
+@standardsx{ctanfN, TS 18661-3:2015, complex.h}
+@standardsx{ctanfNx, TS 18661-3:2015, complex.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return the complex tangent of @var{z}.
 The mathematical definition of the complex tangent is
@@ -286,7 +324,11 @@ respectively.
 @deftypefun double asin (double @var{x})
 @deftypefunx float asinf (float @var{x})
 @deftypefunx {long double} asinl (long double @var{x})
+@deftypefunx _FloatN asinfN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx asinfNx (_Float@var{N}x @var{x})
 @standards{ISO, math.h}
+@standardsx{asinfN, TS 18661-3:2015, math.h}
+@standardsx{asinfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions compute the arcsine of @var{x}---that is, the value whose
 sine is @var{x}.  The value is in units of radians.  Mathematically,
@@ -301,7 +343,11 @@ domain, @code{asin} signals a domain error.
 @deftypefun double acos (double @var{x})
 @deftypefunx float acosf (float @var{x})
 @deftypefunx {long double} acosl (long double @var{x})
+@deftypefunx _FloatN acosfN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx acosfNx (_Float@var{N}x @var{x})
 @standards{ISO, math.h}
+@standardsx{acosfN, TS 18661-3:2015, math.h}
+@standardsx{acosfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions compute the arccosine of @var{x}---that is, the value
 whose cosine is @var{x}.  The value is in units of radians.
@@ -316,7 +362,11 @@ domain, @code{acos} signals a domain error.
 @deftypefun double atan (double @var{x})
 @deftypefunx float atanf (float @var{x})
 @deftypefunx {long double} atanl (long double @var{x})
+@deftypefunx _FloatN atanfN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx atanfNx (_Float@var{N}x @var{x})
 @standards{ISO, math.h}
+@standardsx{atanfN, TS 18661-3:2015, math.h}
+@standardsx{atanfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions compute the arctangent of @var{x}---that is, the value
 whose tangent is @var{x}.  The value is in units of radians.
@@ -327,7 +377,11 @@ returned is the one between @code{-pi/2} and @code{pi/2} (inclusive).
 @deftypefun double atan2 (double @var{y}, double @var{x})
 @deftypefunx float atan2f (float @var{y}, float @var{x})
 @deftypefunx {long double} atan2l (long double @var{y}, long double @var{x})
+@deftypefunx _FloatN atan2fN (_Float@var{N} @var{y}, _Float@var{N} @var{x})
+@deftypefunx _FloatNx atan2fNx (_Float@var{N}x @var{y}, _Float@var{N}x @var{x})
 @standards{ISO, math.h}
+@standardsx{atan2fN, TS 18661-3:2015, math.h}
+@standardsx{atan2fNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 This function computes the arctangent of @var{y}/@var{x}, but the signs
 of both arguments are used to determine the quadrant of the result, and
@@ -351,7 +405,11 @@ If both @var{x} and @var{y} are zero, @code{atan2} returns zero.
 @deftypefun {complex double} casin (complex double @var{z})
 @deftypefunx {complex float} casinf (complex float @var{z})
 @deftypefunx {complex long double} casinl (complex long double @var{z})
+@deftypefunx {complex _FloatN} casinfN (complex _Float@var{N} @var{z})
+@deftypefunx {complex _FloatNx} casinfNx (complex _Float@var{N}x @var{z})
 @standards{ISO, complex.h}
+@standardsx{casinfN, TS 18661-3:2015, complex.h}
+@standardsx{casinfNx, TS 18661-3:2015, complex.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions compute the complex arcsine of @var{z}---that is, the
 value whose sine is @var{z}.  The value returned is in radians.
@@ -363,7 +421,11 @@ values of @var{z}.
 @deftypefun {complex double} cacos (complex double @var{z})
 @deftypefunx {complex float} cacosf (complex float @var{z})
 @deftypefunx {complex long double} cacosl (complex long double @var{z})
+@deftypefunx {complex _FloatN} cacosfN (complex _Float@var{N} @var{z})
+@deftypefunx {complex _FloatNx} cacosfNx (complex _Float@var{N}x @var{z})
 @standards{ISO, complex.h}
+@standardsx{cacosfN, TS 18661-3:2015, complex.h}
+@standardsx{cacosfNx, TS 18661-3:2015, complex.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions compute the complex arccosine of @var{z}---that is, the
 value whose cosine is @var{z}.  The value returned is in radians.
@@ -376,7 +438,11 @@ values of @var{z}.
 @deftypefun {complex double} catan (complex double @var{z})
 @deftypefunx {complex float} catanf (complex float @var{z})
 @deftypefunx {complex long double} catanl (complex long double @var{z})
+@deftypefunx {complex _FloatN} catanfN (complex _Float@var{N} @var{z})
+@deftypefunx {complex _FloatNx} catanfNx (complex _Float@var{N}x @var{z})
 @standards{ISO, complex.h}
+@standardsx{catanfN, TS 18661-3:2015, complex.h}
+@standardsx{catanfNx, TS 18661-3:2015, complex.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions compute the complex arctangent of @var{z}---that is,
 the value whose tangent is @var{z}.  The value is in units of radians.
@@ -392,7 +458,11 @@ the value whose tangent is @var{z}.  The value is in units of radians.
 @deftypefun double exp (double @var{x})
 @deftypefunx float expf (float @var{x})
 @deftypefunx {long double} expl (long double @var{x})
+@deftypefunx _FloatN expfN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx expfNx (_Float@var{N}x @var{x})
 @standards{ISO, math.h}
+@standardsx{expfN, TS 18661-3:2015, math.h}
+@standardsx{expfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions compute @code{e} (the base of natural logarithms) raised
 to the power @var{x}.
@@ -404,7 +474,11 @@ If the magnitude of the result is too large to be representable,
 @deftypefun double exp2 (double @var{x})
 @deftypefunx float exp2f (float @var{x})
 @deftypefunx {long double} exp2l (long double @var{x})
+@deftypefunx _FloatN exp2fN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx exp2fNx (_Float@var{N}x @var{x})
 @standards{ISO, math.h}
+@standardsx{exp2fN, TS 18661-3:2015, math.h}
+@standardsx{exp2fNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions compute @code{2} raised to the power @var{x}.
 Mathematically, @code{exp2 (x)} is the same as @code{exp (x * log (2))}.
@@ -413,10 +487,14 @@ Mathematically, @code{exp2 (x)} is the same as @code{exp (x * log (2))}.
 @deftypefun double exp10 (double @var{x})
 @deftypefunx float exp10f (float @var{x})
 @deftypefunx {long double} exp10l (long double @var{x})
+@deftypefunx _FloatN exp10fN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx exp10fNx (_Float@var{N}x @var{x})
 @deftypefunx double pow10 (double @var{x})
 @deftypefunx float pow10f (float @var{x})
 @deftypefunx {long double} pow10l (long double @var{x})
 @standards{ISO, math.h}
+@standardsx{exp10fN, GNU, math.h}
+@standardsx{exp10fNx, GNU, math.h}
 @standardsx{pow10, GNU, math.h}
 @standardsx{pow10f, GNU, math.h}
 @standardsx{pow10l, GNU, math.h}
@@ -424,16 +502,22 @@ Mathematically, @code{exp2 (x)} is the same as @code{exp (x * log (2))}.
 These functions compute @code{10} raised to the power @var{x}.
 Mathematically, @code{exp10 (x)} is the same as @code{exp (x * log (10))}.
 
-The @code{exp10} functions are from TS 18661-4:2015; the @code{pow10}
-names are GNU extensions.  The name @code{exp10} is
-preferred, since it is analogous to @code{exp} and @code{exp2}.
+The @code{exp10}, @code{exp10f}, and @code{exp10l} functions are from TS
+18661-4:2015; the @code{pow10} names are GNU extensions.  Likewise, the
+@code{exp10f@var{N}} and @code{exp10f@var{N}x} functions are GNU
+extensions. The name @code{exp10} is preferred, since it is analogous to
+@code{exp} and @code{exp2}.
 @end deftypefun
 
 
 @deftypefun double log (double @var{x})
 @deftypefunx float logf (float @var{x})
 @deftypefunx {long double} logl (long double @var{x})
+@deftypefunx _FloatN logfN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx logfNx (_Float@var{N}x @var{x})
 @standards{ISO, math.h}
+@standardsx{logfN, TS 18661-3:2015, math.h}
+@standardsx{logfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions compute the natural logarithm of @var{x}.  @code{exp (log
 (@var{x}))} equals @var{x}, exactly in mathematics and approximately in
@@ -447,7 +531,11 @@ it may signal overflow.
 @deftypefun double log10 (double @var{x})
 @deftypefunx float log10f (float @var{x})
 @deftypefunx {long double} log10l (long double @var{x})
+@deftypefunx _FloatN log10fN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx log10fNx (_Float@var{N}x @var{x})
 @standards{ISO, math.h}
+@standardsx{log10fN, TS 18661-3:2015, math.h}
+@standardsx{log10fNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return the base-10 logarithm of @var{x}.
 @code{log10 (@var{x})} equals @code{log (@var{x}) / log (10)}.
@@ -457,7 +545,11 @@ These functions return the base-10 logarithm of @var{x}.
 @deftypefun double log2 (double @var{x})
 @deftypefunx float log2f (float @var{x})
 @deftypefunx {long double} log2l (long double @var{x})
+@deftypefunx _FloatN log2fN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx log2fNx (_Float@var{N}x @var{x})
 @standards{ISO, math.h}
+@standardsx{log2fN, TS 18661-3:2015, math.h}
+@standardsx{log2fNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return the base-2 logarithm of @var{x}.
 @code{log2 (@var{x})} equals @code{log (@var{x}) / log (2)}.
@@ -466,7 +558,11 @@ These functions return the base-2 logarithm of @var{x}.
 @deftypefun double logb (double @var{x})
 @deftypefunx float logbf (float @var{x})
 @deftypefunx {long double} logbl (long double @var{x})
+@deftypefunx _FloatN logbfN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx logbfNx (_Float@var{N}x @var{x})
 @standards{ISO, math.h}
+@standardsx{logbfN, TS 18661-3:2015, math.h}
+@standardsx{logbfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions extract the exponent of @var{x} and return it as a
 floating-point value.  If @code{FLT_RADIX} is two, @code{logb} is equal
@@ -481,15 +577,25 @@ negative), @code{logb} returns @math{@infinity{}}.  If @var{x} is zero,
 @deftypefun int ilogb (double @var{x})
 @deftypefunx int ilogbf (float @var{x})
 @deftypefunx int ilogbl (long double @var{x})
+@deftypefunx int ilogbfN (_Float@var{N} @var{x})
+@deftypefunx int ilogbfNx (_Float@var{N}x @var{x})
 @deftypefunx {long int} llogb (double @var{x})
 @deftypefunx {long int} llogbf (float @var{x})
 @deftypefunx {long int} llogbl (long double @var{x})
+@deftypefunx {long int} llogbfN (_Float@var{N} @var{x})
+@deftypefunx {long int} llogbfNx (_Float@var{N}x @var{x})
 @standards{ISO, math.h}
+@standardsx{ilogbfN, TS 18661-3:2015, math.h}
+@standardsx{ilogbfNx, TS 18661-3:2015, math.h}
+@standardsx{llogbfN, TS 18661-3:2015, math.h}
+@standardsx{llogbfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions are equivalent to the corresponding @code{logb}
 functions except that they return signed integer values.  The
-@code{ilogb} functions are from ISO C99; the @code{llogb} functions
-are from TS 18661-1:2014.
+@code{ilogb}, @code{ilogbf}, and @code{ilogbl} functions are from ISO
+C99; the @code{llogb}, @code{llogbf}, @code{llogbl} functions are from
+TS 18661-1:2014; the @code{ilogbfN}, @code{ilogbfNx}, @code{llogbfN},
+and @code{llogbfNx} functions are from TS 18661-3:2015.
 @end deftypefun
 
 @noindent
@@ -555,7 +661,11 @@ if (i == FP_ILOGB0 || i == FP_ILOGBNAN)
 @deftypefun double pow (double @var{base}, double @var{power})
 @deftypefunx float powf (float @var{base}, float @var{power})
 @deftypefunx {long double} powl (long double @var{base}, long double @var{power})
+@deftypefunx _FloatN powfN (_Float@var{N} @var{base}, _Float@var{N} @var{power})
+@deftypefunx _FloatNx powfNx (_Float@var{N}x @var{base}, _Float@var{N}x @var{power})
 @standards{ISO, math.h}
+@standardsx{powfN, TS 18661-3:2015, math.h}
+@standardsx{powfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These are general exponentiation functions, returning @var{base} raised
 to @var{power}.
@@ -570,7 +680,11 @@ underflow or overflow the destination type.
 @deftypefun double sqrt (double @var{x})
 @deftypefunx float sqrtf (float @var{x})
 @deftypefunx {long double} sqrtl (long double @var{x})
+@deftypefunx _FloatN sqrtfN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx sqrtfNx (_Float@var{N}x @var{x})
 @standards{ISO, math.h}
+@standardsx{sqrtfN, TS 18661-3:2015, math.h}
+@standardsx{sqrtfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return the nonnegative square root of @var{x}.
 
@@ -582,7 +696,11 @@ Mathematically, it should return a complex number.
 @deftypefun double cbrt (double @var{x})
 @deftypefunx float cbrtf (float @var{x})
 @deftypefunx {long double} cbrtl (long double @var{x})
+@deftypefunx _FloatN cbrtfN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx cbrtfNx (_Float@var{N}x @var{x})
 @standards{BSD, math.h}
+@standardsx{cbrtfN, TS 18661-3:2015, math.h}
+@standardsx{cbrtfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return the cube root of @var{x}.  They cannot
 fail; every representable real value has a representable real cube root.
@@ -591,7 +709,11 @@ fail; every representable real value has a representable real cube root.
 @deftypefun double hypot (double @var{x}, double @var{y})
 @deftypefunx float hypotf (float @var{x}, float @var{y})
 @deftypefunx {long double} hypotl (long double @var{x}, long double @var{y})
+@deftypefunx _FloatN hypotfN (_Float@var{N} @var{x}, _Float@var{N} @var{y})
+@deftypefunx _FloatNx hypotfNx (_Float@var{N}x @var{x}, _Float@var{N}x @var{y})
 @standards{ISO, math.h}
+@standardsx{hypotfN, TS 18661-3:2015, math.h}
+@standardsx{hypotfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return @code{sqrt (@var{x}*@var{x} +
 @var{y}*@var{y})}.  This is the length of the hypotenuse of a right
@@ -604,7 +726,11 @@ much smaller.  See also the function @code{cabs} in @ref{Absolute Value}.
 @deftypefun double expm1 (double @var{x})
 @deftypefunx float expm1f (float @var{x})
 @deftypefunx {long double} expm1l (long double @var{x})
+@deftypefunx _FloatN expm1fN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx expm1fNx (_Float@var{N}x @var{x})
 @standards{ISO, math.h}
+@standardsx{expm1fN, TS 18661-3:2015, math.h}
+@standardsx{expm1fNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return a value equivalent to @code{exp (@var{x}) - 1}.
 They are computed in a way that is accurate even if @var{x} is
@@ -615,7 +741,11 @@ to subtraction of two numbers that are nearly equal.
 @deftypefun double log1p (double @var{x})
 @deftypefunx float log1pf (float @var{x})
 @deftypefunx {long double} log1pl (long double @var{x})
+@deftypefunx _FloatN log1pfN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx log1pfNx (_Float@var{N}x @var{x})
 @standards{ISO, math.h}
+@standardsx{log1pfN, TS 18661-3:2015, math.h}
+@standardsx{log1pfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return a value equivalent to @w{@code{log (1 + @var{x})}}.
 They are computed in a way that is accurate even if @var{x} is
@@ -631,7 +761,11 @@ logarithm functions.
 @deftypefun {complex double} cexp (complex double @var{z})
 @deftypefunx {complex float} cexpf (complex float @var{z})
 @deftypefunx {complex long double} cexpl (complex long double @var{z})
+@deftypefunx {complex _FloatN} cexpfN (complex _Float@var{N} @var{z})
+@deftypefunx {complex _FloatNx} cexpfNx (complex _Float@var{N}x @var{z})
 @standards{ISO, complex.h}
+@standardsx{cexpfN, TS 18661-3:2015, complex.h}
+@standardsx{cexpfNx, TS 18661-3:2015, complex.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return @code{e} (the base of natural
 logarithms) raised to the power of @var{z}.
@@ -648,7 +782,11 @@ $$\exp(z) = e^z = e^{{\rm Re}\,z} (\cos ({\rm Im}\,z) + i \sin ({\rm Im}\,z))$$
 @deftypefun {complex double} clog (complex double @var{z})
 @deftypefunx {complex float} clogf (complex float @var{z})
 @deftypefunx {complex long double} clogl (complex long double @var{z})
+@deftypefunx {complex _FloatN} clogfN (complex _Float@var{N} @var{z})
+@deftypefunx {complex _FloatNx} clogfNx (complex _Float@var{N}x @var{z})
 @standards{ISO, complex.h}
+@standardsx{clogfN, TS 18661-3:2015, complex.h}
+@standardsx{clogfNx, TS 18661-3:2015, complex.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return the natural logarithm of @var{z}.
 Mathematically, this corresponds to the value
@@ -670,6 +808,8 @@ or is very close to 0.  It is well-defined for all other values of
 @deftypefun {complex double} clog10 (complex double @var{z})
 @deftypefunx {complex float} clog10f (complex float @var{z})
 @deftypefunx {complex long double} clog10l (complex long double @var{z})
+@deftypefunx {complex _FloatN} clog10fN (complex _Float@var{N} @var{z})
+@deftypefunx {complex _FloatNx} clog10fNx (complex _Float@var{N}x @var{z})
 @standards{GNU, complex.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return the base 10 logarithm of the complex value
@@ -682,13 +822,18 @@ These functions return the base 10 logarithm of the complex value
 $$\log_{10}(z) = \log_{10}|z| + i \arg z / \log (10)$$
 @end tex
 
-These functions are GNU extensions.
+All these functions, including the @code{_Float@var{N}} and
+@code{_Float@var{N}x} variants, are GNU extensions.
 @end deftypefun
 
 @deftypefun {complex double} csqrt (complex double @var{z})
 @deftypefunx {complex float} csqrtf (complex float @var{z})
 @deftypefunx {complex long double} csqrtl (complex long double @var{z})
+@deftypefunx {complex _FloatN} csqrtfN (_Float@var{N} @var{z})
+@deftypefunx {complex _FloatNx} csqrtfNx (complex _Float@var{N}x @var{z})
 @standards{ISO, complex.h}
+@standardsx{csqrtfN, TS 18661-3:2015, complex.h}
+@standardsx{csqrtfNx, TS 18661-3:2015, complex.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return the complex square root of the argument @var{z}.  Unlike
 the real-valued functions, they are defined for all values of @var{z}.
@@ -697,7 +842,11 @@ the real-valued functions, they are defined for all values of @var{z}.
 @deftypefun {complex double} cpow (complex double @var{base}, complex double @var{power})
 @deftypefunx {complex float} cpowf (complex float @var{base}, complex float @var{power})
 @deftypefunx {complex long double} cpowl (complex long double @var{base}, complex long double @var{power})
+@deftypefunx {complex _FloatN} cpowfN (complex _Float@var{N} @var{base}, complex _Float@var{N} @var{power})
+@deftypefunx {complex _FloatNx} cpowfNx (complex _Float@var{N}x @var{base}, complex _Float@var{N}x @var{power})
 @standards{ISO, complex.h}
+@standardsx{cpowfN, TS 18661-3:2015, complex.h}
+@standardsx{cpowfNx, TS 18661-3:2015, complex.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return @var{base} raised to the power of
 @var{power}.  This is equivalent to @w{@code{cexp (y * clog (x))}}
@@ -713,7 +862,11 @@ see @ref{Exponents and Logarithms}.
 @deftypefun double sinh (double @var{x})
 @deftypefunx float sinhf (float @var{x})
 @deftypefunx {long double} sinhl (long double @var{x})
+@deftypefunx _FloatN sinhfN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx sinhfNx (_Float@var{N}x @var{x})
 @standards{ISO, math.h}
+@standardsx{sinhfN, TS 18661-3:2015, math.h}
+@standardsx{sinhfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return the hyperbolic sine of @var{x}, defined
 mathematically as @w{@code{(exp (@var{x}) - exp (-@var{x})) / 2}}.  They
@@ -723,7 +876,11 @@ may signal overflow if @var{x} is too large.
 @deftypefun double cosh (double @var{x})
 @deftypefunx float coshf (float @var{x})
 @deftypefunx {long double} coshl (long double @var{x})
+@deftypefunx _FloatN coshfN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx coshfNx (_Float@var{N}x @var{x})
 @standards{ISO, math.h}
+@standardsx{coshfN, TS 18661-3:2015, math.h}
+@standardsx{coshfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return the hyperbolic cosine of @var{x},
 defined mathematically as @w{@code{(exp (@var{x}) + exp (-@var{x})) / 2}}.
@@ -733,7 +890,11 @@ They may signal overflow if @var{x} is too large.
 @deftypefun double tanh (double @var{x})
 @deftypefunx float tanhf (float @var{x})
 @deftypefunx {long double} tanhl (long double @var{x})
+@deftypefunx _FloatN tanhfN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx tanhfNx (_Float@var{N}x @var{x})
 @standards{ISO, math.h}
+@standardsx{tanhfN, TS 18661-3:2015, math.h}
+@standardsx{tanhfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return the hyperbolic tangent of @var{x},
 defined mathematically as @w{@code{sinh (@var{x}) / cosh (@var{x})}}.
@@ -748,7 +909,11 @@ complex arguments.
 @deftypefun {complex double} csinh (complex double @var{z})
 @deftypefunx {complex float} csinhf (complex float @var{z})
 @deftypefunx {complex long double} csinhl (complex long double @var{z})
+@deftypefunx {complex _FloatN} csinhfN (complex _Float@var{N} @var{z})
+@deftypefunx {complex _FloatNx} csinhfNx (complex _Float@var{N}x @var{z})
 @standards{ISO, complex.h}
+@standardsx{csinhfN, TS 18661-3:2015, complex.h}
+@standardsx{csinhfNx, TS 18661-3:2015, complex.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return the complex hyperbolic sine of @var{z}, defined
 mathematically as @w{@code{(exp (@var{z}) - exp (-@var{z})) / 2}}.
@@ -757,7 +922,11 @@ mathematically as @w{@code{(exp (@var{z}) - exp (-@var{z})) / 2}}.
 @deftypefun {complex double} ccosh (complex double @var{z})
 @deftypefunx {complex float} ccoshf (complex float @var{z})
 @deftypefunx {complex long double} ccoshl (complex long double @var{z})
+@deftypefunx {complex _FloatN} ccoshfN (complex _Float@var{N} @var{z})
+@deftypefunx {complex _FloatNx} ccoshfNx (complex _Float@var{N}x @var{z})
 @standards{ISO, complex.h}
+@standardsx{ccoshfN, TS 18661-3:2015, complex.h}
+@standardsx{ccoshfNx, TS 18661-3:2015, complex.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return the complex hyperbolic cosine of @var{z}, defined
 mathematically as @w{@code{(exp (@var{z}) + exp (-@var{z})) / 2}}.
@@ -766,7 +935,11 @@ mathematically as @w{@code{(exp (@var{z}) + exp (-@var{z})) / 2}}.
 @deftypefun {complex double} ctanh (complex double @var{z})
 @deftypefunx {complex float} ctanhf (complex float @var{z})
 @deftypefunx {complex long double} ctanhl (complex long double @var{z})
+@deftypefunx {complex _FloatN} ctanhfN (complex _Float@var{N} @var{z})
+@deftypefunx {complex _FloatNx} ctanhfNx (complex _Float@var{N}x @var{z})
 @standards{ISO, complex.h}
+@standardsx{ctanhfN, TS 18661-3:2015, complex.h}
+@standardsx{ctanhfNx, TS 18661-3:2015, complex.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return the complex hyperbolic tangent of @var{z},
 defined mathematically as @w{@code{csinh (@var{z}) / ccosh (@var{z})}}.
@@ -778,7 +951,11 @@ defined mathematically as @w{@code{csinh (@var{z}) / ccosh (@var{z})}}.
 @deftypefun double asinh (double @var{x})
 @deftypefunx float asinhf (float @var{x})
 @deftypefunx {long double} asinhl (long double @var{x})
+@deftypefunx _FloatN asinhfN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx asinhfNx (_Float@var{N}x @var{x})
 @standards{ISO, math.h}
+@standardsx{asinhfN, TS 18661-3:2015, math.h}
+@standardsx{asinhfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return the inverse hyperbolic sine of @var{x}---the
 value whose hyperbolic sine is @var{x}.
@@ -787,7 +964,11 @@ value whose hyperbolic sine is @var{x}.
 @deftypefun double acosh (double @var{x})
 @deftypefunx float acoshf (float @var{x})
 @deftypefunx {long double} acoshl (long double @var{x})
+@deftypefunx _FloatN acoshfN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx acoshfNx (_Float@var{N}x @var{x})
 @standards{ISO, math.h}
+@standardsx{acoshfN, TS 18661-3:2015, math.h}
+@standardsx{acoshfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return the inverse hyperbolic cosine of @var{x}---the
 value whose hyperbolic cosine is @var{x}.  If @var{x} is less than
@@ -797,7 +978,11 @@ value whose hyperbolic cosine is @var{x}.  If @var{x} is less than
 @deftypefun double atanh (double @var{x})
 @deftypefunx float atanhf (float @var{x})
 @deftypefunx {long double} atanhl (long double @var{x})
+@deftypefunx _FloatN atanhfN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx atanhfNx (_Float@var{N}x @var{x})
 @standards{ISO, math.h}
+@standardsx{atanhfN, TS 18661-3:2015, math.h}
+@standardsx{atanhfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return the inverse hyperbolic tangent of @var{x}---the
 value whose hyperbolic tangent is @var{x}.  If the absolute value of
@@ -810,7 +995,11 @@ if it is equal to 1, @code{atanh} returns infinity.
 @deftypefun {complex double} casinh (complex double @var{z})
 @deftypefunx {complex float} casinhf (complex float @var{z})
 @deftypefunx {complex long double} casinhl (complex long double @var{z})
+@deftypefunx {complex _FloatN} casinhfN (complex _Float@var{N} @var{z})
+@deftypefunx {complex _FloatNx} casinhfNx (complex _Float@var{N}x @var{z})
 @standards{ISO, complex.h}
+@standardsx{casinhfN, TS 18661-3:2015, complex.h}
+@standardsx{casinhfNx, TS 18661-3:2015, complex.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return the inverse complex hyperbolic sine of
 @var{z}---the value whose complex hyperbolic sine is @var{z}.
@@ -819,7 +1008,11 @@ These functions return the inverse complex hyperbolic sine of
 @deftypefun {complex double} cacosh (complex double @var{z})
 @deftypefunx {complex float} cacoshf (complex float @var{z})
 @deftypefunx {complex long double} cacoshl (complex long double @var{z})
+@deftypefunx {complex _FloatN} cacoshfN (complex _Float@var{N} @var{z})
+@deftypefunx {complex _FloatNx} cacoshfNx (complex _Float@var{N}x @var{z})
 @standards{ISO, complex.h}
+@standardsx{cacoshfN, TS 18661-3:2015, complex.h}
+@standardsx{cacoshfNx, TS 18661-3:2015, complex.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return the inverse complex hyperbolic cosine of
 @var{z}---the value whose complex hyperbolic cosine is @var{z}.  Unlike
@@ -829,7 +1022,11 @@ the real-valued functions, there are no restrictions on the value of @var{z}.
 @deftypefun {complex double} catanh (complex double @var{z})
 @deftypefunx {complex float} catanhf (complex float @var{z})
 @deftypefunx {complex long double} catanhl (complex long double @var{z})
+@deftypefunx {complex _FloatN} catanhfN (complex _Float@var{N} @var{z})
+@deftypefunx {complex _FloatNx} catanhfNx (complex _Float@var{N}x @var{z})
 @standards{ISO, complex.h}
+@standardsx{catanhfN, TS 18661-3:2015, complex.h}
+@standardsx{catanhfNx, TS 18661-3:2015, complex.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 These functions return the inverse complex hyperbolic tangent of
 @var{z}---the value whose complex hyperbolic tangent is @var{z}.  Unlike
@@ -849,7 +1046,11 @@ useful.  Currently they only have real-valued versions.
 @deftypefun double erf (double @var{x})
 @deftypefunx float erff (float @var{x})
 @deftypefunx {long double} erfl (long double @var{x})
+@deftypefunx _FloatN erffN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx erffNx (_Float@var{N}x @var{x})
 @standards{SVID, math.h}
+@standardsx{erffN, TS 18661-3:2015, math.h}
+@standardsx{erffNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 @code{erf} returns the error function of @var{x}.  The error
 function is defined as
@@ -866,7 +1067,11 @@ erf (x) = 2/sqrt(pi) * integral from 0 to x of exp(-t^2) dt
 @deftypefun double erfc (double @var{x})
 @deftypefunx float erfcf (float @var{x})
 @deftypefunx {long double} erfcl (long double @var{x})
+@deftypefunx _FloatN erfcfN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx erfcfNx (_Float@var{N}x @var{x})
 @standards{SVID, math.h}
+@standardsx{erfcfN, TS 18661-3:2015, math.h}
+@standardsx{erfcfNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 @code{erfc} returns @code{1.0 - erf(@var{x})}, but computed in a
 fashion that avoids round-off error when @var{x} is large.
@@ -875,7 +1080,11 @@ fashion that avoids round-off error when @var{x} is large.
 @deftypefun double lgamma (double @var{x})
 @deftypefunx float lgammaf (float @var{x})
 @deftypefunx {long double} lgammal (long double @var{x})
+@deftypefunx _FloatN lgammafN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx lgammafNx (_Float@var{N}x @var{x})
 @standards{SVID, math.h}
+@standardsx{lgammafN, TS 18661-3:2015, math.h}
+@standardsx{lgammafNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtunsafe{@mtasurace{:signgam}}@asunsafe{}@acsafe{}}
 @code{lgamma} returns the natural logarithm of the absolute value of
 the gamma function of @var{x}.  The gamma function is defined as
@@ -909,11 +1118,18 @@ singularity.
 @deftypefun double lgamma_r (double @var{x}, int *@var{signp})
 @deftypefunx float lgammaf_r (float @var{x}, int *@var{signp})
 @deftypefunx {long double} lgammal_r (long double @var{x}, int *@var{signp})
+@deftypefunx _FloatN lgammafN_r (_Float@var{N} @var{x}, int *@var{signp})
+@deftypefunx _FloatNx lgammafNx_r (_Float@var{N}x @var{x}, int *@var{signp})
 @standards{XPG, math.h}
+@standardsx{lgammafN_r, GNU, math.h}
+@standardsx{lgammafNx_r, GNU, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 @code{lgamma_r} is just like @code{lgamma}, but it stores the sign of
 the intermediate result in the variable pointed to by @var{signp}
 instead of in the @var{signgam} global.  This means it is reentrant.
+
+The @code{lgammaf@var{N}_r} and @code{lgammaf@var{N}x_r} functions are
+GNU extensions.
 @end deftypefun
 
 @deftypefun double gamma (double @var{x})
@@ -930,12 +1146,16 @@ standardized in @w{ISO C99} while @code{gamma} is not.
 @deftypefun double tgamma (double @var{x})
 @deftypefunx float tgammaf (float @var{x})
 @deftypefunx {long double} tgammal (long double @var{x})
+@deftypefunx _FloatN tgammafN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx tgammafNx (_Float@var{N}x @var{x})
 @standardsx{tgamma, XPG, math.h}
 @standardsx{tgamma, ISO, math.h}
 @standardsx{tgammaf, XPG, math.h}
 @standardsx{tgammaf, ISO, math.h}
 @standardsx{tgammal, XPG, math.h}
 @standardsx{tgammal, ISO, math.h}
+@standardsx{tgammafN, TS 18661-3:2015, math.h}
+@standardsx{tgammafNx, TS 18661-3:2015, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 @code{tgamma} applies the gamma function to @var{x}.  The gamma
 function is defined as
@@ -948,67 +1168,111 @@ gamma (x) = integral from 0 to @infinity{} of t^(x-1) e^-t dt
 @end smallexample
 @end ifnottex
 
-This function was introduced in @w{ISO C99}.
+This function was introduced in @w{ISO C99}.  The @code{_Float@var{N}}
+and @code{_Float@var{N}x} variants were introduced in @w{ISO/IEC TS
+18661-3}.
 @end deftypefun
 
 @deftypefun double j0 (double @var{x})
 @deftypefunx float j0f (float @var{x})
 @deftypefunx {long double} j0l (long double @var{x})
+@deftypefunx _FloatN j0fN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx j0fNx (_Float@var{N}x @var{x})
 @standards{SVID, math.h}
+@standardsx{j0fN, GNU, math.h}
+@standardsx{j0fNx, GNU, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 @code{j0} returns the Bessel function of the first kind of order 0 of
 @var{x}.  It may signal underflow if @var{x} is too large.
+
+The @code{_Float@var{N}} and @code{_Float@var{N}x} variants are GNU
+extensions.
 @end deftypefun
 
 @deftypefun double j1 (double @var{x})
 @deftypefunx float j1f (float @var{x})
 @deftypefunx {long double} j1l (long double @var{x})
+@deftypefunx _FloatN j1fN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx j1fNx (_Float@var{N}x @var{x})
 @standards{SVID, math.h}
+@standardsx{j1fN, GNU, math.h}
+@standardsx{j1fNx, GNU, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 @code{j1} returns the Bessel function of the first kind of order 1 of
 @var{x}.  It may signal underflow if @var{x} is too large.
+
+The @code{_Float@var{N}} and @code{_Float@var{N}x} variants are GNU
+extensions.
 @end deftypefun
 
 @deftypefun double jn (int @var{n}, double @var{x})
 @deftypefunx float jnf (int @var{n}, float @var{x})
 @deftypefunx {long double} jnl (int @var{n}, long double @var{x})
+@deftypefunx _FloatN jnfN (int @var{n}, _Float@var{N} @var{x})
+@deftypefunx _FloatNx jnfNx (int @var{n}, _Float@var{N}x @var{x})
 @standards{SVID, math.h}
+@standardsx{jnfN, GNU, math.h}
+@standardsx{jnfNx, GNU, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 @code{jn} returns the Bessel function of the first kind of order
 @var{n} of @var{x}.  It may signal underflow if @var{x} is too large.
+
+The @code{_Float@var{N}} and @code{_Float@var{N}x} variants are GNU
+extensions.
 @end deftypefun
 
 @deftypefun double y0 (double @var{x})
 @deftypefunx float y0f (float @var{x})
 @deftypefunx {long double} y0l (long double @var{x})
+@deftypefunx _FloatN y0fN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx y0fNx (_Float@var{N}x @var{x})
 @standards{SVID, math.h}
+@standardsx{y0fN, GNU, math.h}
+@standardsx{y0fNx, GNU, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 @code{y0} returns the Bessel function of the second kind of order 0 of
 @var{x}.  It may signal underflow if @var{x} is too large.  If @var{x}
 is negative, @code{y0} signals a domain error; if it is zero,
 @code{y0} signals overflow and returns @math{-@infinity}.
+
+The @code{_Float@var{N}} and @code{_Float@var{N}x} variants are GNU
+extensions.
 @end deftypefun
 
 @deftypefun double y1 (double @var{x})
 @deftypefunx float y1f (float @var{x})
 @deftypefunx {long double} y1l (long double @var{x})
+@deftypefunx _FloatN y1fN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx y1fNx (_Float@var{N}x @var{x})
 @standards{SVID, math.h}
+@standardsx{y1fN, GNU, math.h}
+@standardsx{y1fNx, GNU, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 @code{y1} returns the Bessel function of the second kind of order 1 of
 @var{x}.  It may signal underflow if @var{x} is too large.  If @var{x}
 is negative, @code{y1} signals a domain error; if it is zero,
 @code{y1} signals overflow and returns @math{-@infinity}.
+
+The @code{_Float@var{N}} and @code{_Float@var{N}x} variants are GNU
+extensions.
 @end deftypefun
 
 @deftypefun double yn (int @var{n}, double @var{x})
 @deftypefunx float ynf (int @var{n}, float @var{x})
 @deftypefunx {long double} ynl (int @var{n}, long double @var{x})
+@deftypefunx _FloatN ynfN (int @var{n}, _Float@var{N} @var{x})
+@deftypefunx _FloatNx ynfNx (int @var{n}, _Float@var{N}x @var{x})
 @standards{SVID, math.h}
+@standardsx{ynfN, GNU, math.h}
+@standardsx{ynfNx, GNU, math.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 @code{yn} returns the Bessel function of the second kind of order @var{n} of
 @var{x}.  It may signal underflow if @var{x} is too large.  If @var{x}
 is negative, @code{yn} signals a domain error; if it is zero,
 @code{yn} signals overflow and returns @math{-@infinity}.
+
+The @code{_Float@var{N}} and @code{_Float@var{N}x} variants are GNU
+extensions.
 @end deftypefun
 
 @node Errors in Math Functions
-- 
2.4.11

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

* Re: [PATCH v3 4/7] Update string to float128 functions to use bits/types/locale_t.h
  2017-06-23 12:34 ` [PATCH v3 4/7] Update string to float128 functions to use bits/types/locale_t.h Gabriel F. T. Gomes
@ 2017-06-23 12:57   ` Gabriel F. T. Gomes
  0 siblings, 0 replies; 83+ messages in thread
From: Gabriel F. T. Gomes @ 2017-06-23 12:57 UTC (permalink / raw)
  To: libc-alpha

On Fri, 23 Jun 2017 09:33:23 -0300
"Gabriel F. T. Gomes" <gftg@linux.vnet.ibm.com> wrote:

> New since v2:
> 
>   - This patch updates float128 files to reflect new code on master
>     (detected after a rebase).

I just noticed that this has already been fixed on master by commit ID
33711da4e90f.  Please disregard this patch.

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

* Re: [PATCH v3 0/7] Enable float128 on powerpc64le
  2017-06-23 12:33 [PATCH v3 0/7] Enable float128 on powerpc64le Gabriel F. T. Gomes
                   ` (6 preceding siblings ...)
  2017-06-23 12:34 ` [PATCH v3 2/7] Prepare the manual to display math errors for float128 functions Gabriel F. T. Gomes
@ 2017-06-23 12:59 ` Joseph Myers
  7 siblings, 0 replies; 83+ messages in thread
From: Joseph Myers @ 2017-06-23 12:59 UTC (permalink / raw)
  To: Gabriel F. T. Gomes; +Cc: libc-alpha

Patches 1 and 2 were already approved and should be committed.

-- 
Joseph S. Myers
joseph@codesourcery.com

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

* Re: [PATCH v3 3/7] Add libio-mtsafe flags to the build of strfromf128
  2017-06-23 12:33 ` [PATCH v3 3/7] Add libio-mtsafe flags to the build of strfromf128 Gabriel F. T. Gomes
@ 2017-06-23 12:59   ` Joseph Myers
  0 siblings, 0 replies; 83+ messages in thread
From: Joseph Myers @ 2017-06-23 12:59 UTC (permalink / raw)
  To: Gabriel F. T. Gomes; +Cc: libc-alpha

On Fri, 23 Jun 2017, Gabriel F. T. Gomes wrote:

> New since v2:
> 
>   - This patch has been split from the last patch in this set, because it
>     isn't powerpc64le-specific.
> 
> -- 8< --
> Similar to the other functions in the strfrom class, strfromf128 calls
> __printf_fp in order to convert the floating-point value to characters.
> This requires the value of IO_MTSAFE_IO.
> 
> Tested for powerpc64le and s390x.
> 
> 	* sysdeps/ieee754/float128/Makefile (CFLAGS-strfromf128.c): Add
> 	$(libio-mtsafe) to get the value of IO_MTSAFE_IO.

OK.

-- 
Joseph S. Myers
joseph@codesourcery.com

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

* Re: [PATCH v3 5/7] Document _FloatN and _FloatNx versions of math functions
  2017-06-23 12:34 ` [PATCH v3 5/7] Document _FloatN and _FloatNx versions of math functions Gabriel F. T. Gomes
@ 2017-06-23 13:11   ` Joseph Myers
  0 siblings, 0 replies; 83+ messages in thread
From: Joseph Myers @ 2017-06-23 13:11 UTC (permalink / raw)
  To: Gabriel F. T. Gomes; +Cc: libc-alpha

On Fri, 23 Jun 2017, Gabriel F. T. Gomes wrote:

> @@ -413,10 +487,14 @@ Mathematically, @code{exp2 (x)} is the same as @code{exp (x * log (2))}.
>  @deftypefun double exp10 (double @var{x})
>  @deftypefunx float exp10f (float @var{x})
>  @deftypefunx {long double} exp10l (long double @var{x})
> +@deftypefunx _FloatN exp10fN (_Float@var{N} @var{x})
> +@deftypefunx _FloatNx exp10fNx (_Float@var{N}x @var{x})
>  @deftypefunx double pow10 (double @var{x})
>  @deftypefunx float pow10f (float @var{x})
>  @deftypefunx {long double} pow10l (long double @var{x})
>  @standards{ISO, math.h}
> +@standardsx{exp10fN, GNU, math.h}
> +@standardsx{exp10fNx, GNU, math.h}
>  @standardsx{pow10, GNU, math.h}
>  @standardsx{pow10f, GNU, math.h}
>  @standardsx{pow10l, GNU, math.h}
> @@ -424,16 +502,22 @@ Mathematically, @code{exp2 (x)} is the same as @code{exp (x * log (2))}.
>  These functions compute @code{10} raised to the power @var{x}.
>  Mathematically, @code{exp10 (x)} is the same as @code{exp (x * log (10))}.
>  
> -The @code{exp10} functions are from TS 18661-4:2015; the @code{pow10}
> -names are GNU extensions.  The name @code{exp10} is
> -preferred, since it is analogous to @code{exp} and @code{exp2}.
> +The @code{exp10}, @code{exp10f}, and @code{exp10l} functions are from TS
> +18661-4:2015; the @code{pow10} names are GNU extensions.  Likewise, the
> +@code{exp10f@var{N}} and @code{exp10f@var{N}x} functions are GNU
> +extensions. The name @code{exp10} is preferred, since it is analogous to
> +@code{exp} and @code{exp2}.
>  @end deftypefun

No, exp10fN and exp10fNx aren't GNU extensions; they're also from TS 
18661-4 (strictly, the combination of TS 18661-3 and TS 18661-4: "The 
following identifiers are declared only if 
__STDC_WANT_IEC_60559_TYPES_EXT__ and __STDC_WANT_IEC_60559_FUNCS_EXT__ 
are defined as macros at the point in the source file where <math.h> is 
first included").

The patch is OK with that fixed (in both the @standardsx and the textual 
description).

-- 
Joseph S. Myers
joseph@codesourcery.com

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

* Re: [PATCH v3 7/7] powerpc64le: Enable float128
  2017-06-23 12:34 ` [PATCH v3 7/7] powerpc64le: Enable float128 Gabriel F. T. Gomes
@ 2017-06-23 13:18   ` Joseph Myers
  2017-06-26 17:11   ` Tulio Magno Quites Machado Filho
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 83+ messages in thread
From: Joseph Myers @ 2017-06-23 13:18 UTC (permalink / raw)
  To: Gabriel F. T. Gomes; +Cc: libc-alpha

This is OK, subject to any fixes requested by powerpc maintainers.

-- 
Joseph S. Myers
joseph@codesourcery.com

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

* Re: [PATCH v3 6/7] powerpc64le: Check for compiler features for float128
  2017-06-23 12:34 ` [PATCH v3 6/7] powerpc64le: Check for compiler features for float128 Gabriel F. T. Gomes
@ 2017-06-23 16:37   ` Joseph Myers
  2017-06-23 20:47     ` Steven Munroe
  0 siblings, 1 reply; 83+ messages in thread
From: Joseph Myers @ 2017-06-23 16:37 UTC (permalink / raw)
  To: Gabriel F. T. Gomes; +Cc: libc-alpha

On Fri, 23 Jun 2017, Gabriel F. T. Gomes wrote:

> 2017-06-12  Gabriel F. T. Gomes  <gftg@linux.vnet.ibm.com>
> 	    Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>
> 
> 	* manual/install.texi (Recommended Tools for Compilation): Mention
> 	the powerpc64le-specific requirement in the manual.

Note that INSTALL needs regenerating when changing install.texi.

-- 
Joseph S. Myers
joseph@codesourcery.com

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

* Re: [PATCH v3 6/7] powerpc64le: Check for compiler features for float128
  2017-06-23 16:37   ` Joseph Myers
@ 2017-06-23 20:47     ` Steven Munroe
  0 siblings, 0 replies; 83+ messages in thread
From: Steven Munroe @ 2017-06-23 20:47 UTC (permalink / raw)
  To: Joseph Myers; +Cc: Gabriel F. T. Gomes, libc-alpha

On Fri, 2017-06-23 at 16:37 +0000, Joseph Myers wrote:
> On Fri, 23 Jun 2017, Gabriel F. T. Gomes wrote:
> 
> > 2017-06-12  Gabriel F. T. Gomes  <gftg@linux.vnet.ibm.com>
> > 	    Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>
> > 
> > 	* manual/install.texi (Recommended Tools for Compilation): Mention
> > 	the powerpc64le-specific requirement in the manual.
> 
> Note that INSTALL needs regenerating when changing install.texi.
> 
LGTM, be sure and regen INSTALL.

Thanks



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

* Re: [PATCH v3 7/7] powerpc64le: Enable float128
  2017-06-23 12:34 ` [PATCH v3 7/7] powerpc64le: Enable float128 Gabriel F. T. Gomes
  2017-06-23 13:18   ` Joseph Myers
@ 2017-06-26 17:11   ` Tulio Magno Quites Machado Filho
  2017-06-26 23:02     ` Joseph Myers
  2017-06-27  7:20   ` Andreas Schwab
                     ` (2 subsequent siblings)
  4 siblings, 1 reply; 83+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2017-06-26 17:11 UTC (permalink / raw)
  To: Gabriel F. T. Gomes, libc-alpha

"Gabriel F. T. Gomes" <gftg@linux.vnet.ibm.com> writes:

> This patch adds ULPs for the float128 type, updates the abilist for libc
> and libm, and adds the files bits/floatn.h and float128-abi.h, in order to
> enable the new type for powerpc64le.
>
> This patch also adds the implementation of sqrtf128 for powerpc64le, since
> it is not implemented in libgcc.  The sfp-machine.h header is taken from
> libgcc.
>
> Tested for powerpc64le (GCC 6.2 and GCC 7.1), powerpc64 and s390x.
>
> 	* NEWS: Mention the addition of float128 features for powerpc64le.
> 	* manual/math.texi (Mathematics): Mention the enabling of float128
> 	for powerpc64le.
> 	* sysdeps/powerpc/bits/floatn.h: New file.
> 	* sysdeps/powerpc/fpu/libm-test-ulps: Regenerated.
> 	* sysdeps/powerpc/fpu/math_private.h:
> 	(__ieee754_sqrtf128): New inline override.
> 	* sysdeps/powerpc/powerpc64le/Implies-before: New file.
> 	* sysdeps/powerpc/powerpc64le/Makefile: New file.
> 	* sysdeps/powerpc/powerpc64le/fpu/e_sqrtf128.c: New file.
> 	* sysdeps/powerpc/powerpc64le/fpu/sfp-machine.h: New file.
> 	* sysdeps/powerpc/powerpc64le/power9/fpu/e_sqrtf128.c: New file.
> 	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist:
> 	Updated.
> 	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
> 	Likewise.
> 	* sysdeps/unix/sysv/linux/powerpc/powerpc64le/float128-abi.h:
> 	New file.

Looks good to me.

-- 
Tulio Magno

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

* Re: [PATCH v3 7/7] powerpc64le: Enable float128
  2017-06-26 17:11   ` Tulio Magno Quites Machado Filho
@ 2017-06-26 23:02     ` Joseph Myers
  2017-06-27  3:29       ` Alan Modra
                         ` (2 more replies)
  0 siblings, 3 replies; 83+ messages in thread
From: Joseph Myers @ 2017-06-26 23:02 UTC (permalink / raw)
  To: Tulio Magno Quites Machado Filho; +Cc: Gabriel F. T. Gomes, libc-alpha

I'm seeing a testsuite regression for powerpc64le with 
build-many-glibcs.py with this patch (elf/check-localplt fails), did you 
not see that in your testing?

https://sourceware.org/ml/libc-testresults/2017-q2/msg00427.html

The failure is: "Extra PLT reference: libc.so: __getauxval".  As the 
__getauxval reference comes from have_ieee_hw_p in libgcc, presumably you 
need to allow that PLT reference in localplt.data with an appropriate 
comment, as it won't be readily possible to avoid it.

-- 
Joseph S. Myers
joseph@codesourcery.com

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

* Re: [PATCH v3 7/7] powerpc64le: Enable float128
  2017-06-26 23:02     ` Joseph Myers
@ 2017-06-27  3:29       ` Alan Modra
  2017-06-27  7:05       ` Florian Weimer
  2017-06-27 17:46       ` [PATCH v3 7/7] powerpc64le: Enable float128 Gabriel F. T. Gomes
  2 siblings, 0 replies; 83+ messages in thread
From: Alan Modra @ 2017-06-27  3:29 UTC (permalink / raw)
  To: Joseph Myers
  Cc: Tulio Magno Quites Machado Filho, Gabriel F. T. Gomes, libc-alpha

On Mon, Jun 26, 2017 at 11:02:04PM +0000, Joseph Myers wrote:
> I'm seeing a testsuite regression for powerpc64le with 
> build-many-glibcs.py with this patch (elf/check-localplt fails), did you 
> not see that in your testing?
> 
> https://sourceware.org/ml/libc-testresults/2017-q2/msg00427.html
> 
> The failure is: "Extra PLT reference: libc.so: __getauxval".  As the 
> __getauxval reference comes from have_ieee_hw_p in libgcc, presumably you 
> need to allow that PLT reference in localplt.data with an appropriate 
> comment, as it won't be readily possible to avoid it.

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81193

I'm not sure the check-localplt fail should be swept under the rug.

-- 
Alan Modra
Australia Development Lab, IBM

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

* Re: [PATCH v3 7/7] powerpc64le: Enable float128
  2017-06-26 23:02     ` Joseph Myers
  2017-06-27  3:29       ` Alan Modra
@ 2017-06-27  7:05       ` Florian Weimer
  2017-06-27 15:00         ` Peter Bergner
  2017-07-04  6:38         ` ppc64le: getauxval call from IFUNC resolver Florian Weimer
  2017-06-27 17:46       ` [PATCH v3 7/7] powerpc64le: Enable float128 Gabriel F. T. Gomes
  2 siblings, 2 replies; 83+ messages in thread
From: Florian Weimer @ 2017-06-27  7:05 UTC (permalink / raw)
  To: Joseph Myers, Tulio Magno Quites Machado Filho
  Cc: Gabriel F. T. Gomes, libc-alpha

On 06/27/2017 01:02 AM, Joseph Myers wrote:
> I'm seeing a testsuite regression for powerpc64le with 
> build-many-glibcs.py with this patch (elf/check-localplt fails), did you 
> not see that in your testing?
> 
> https://sourceware.org/ml/libc-testresults/2017-q2/msg00427.html
> 
> The failure is: "Extra PLT reference: libc.so: __getauxval".  As the 
> __getauxval reference comes from have_ieee_hw_p in libgcc, presumably you 
> need to allow that PLT reference in localplt.data with an appropriate 
> comment, as it won't be readily possible to avoid it.

The __getauxval call happens from IFUNC resolvers and violates current
guidelines regarding what can be done from IFUNC resolvers.  This is
another reason to get rid of the PLT reference.

My IFUNC resolver enhancements are not ready for 2.26, and I plan to
wait for DJ's dl-minimal malloc improvements to land, rather than
rolling my own memory allocator to back the IFUNC resolver queue.

Thanks,
Florian

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

* Re: [PATCH v3 7/7] powerpc64le: Enable float128
  2017-06-23 12:34 ` [PATCH v3 7/7] powerpc64le: Enable float128 Gabriel F. T. Gomes
  2017-06-23 13:18   ` Joseph Myers
  2017-06-26 17:11   ` Tulio Magno Quites Machado Filho
@ 2017-06-27  7:20   ` Andreas Schwab
  2017-06-27  9:24   ` Andreas Schwab
  2017-06-27 13:15   ` Andreas Schwab
  4 siblings, 0 replies; 83+ messages in thread
From: Andreas Schwab @ 2017-06-27  7:20 UTC (permalink / raw)
  To: Gabriel F. T. Gomes; +Cc: libc-alpha

On Jun 23 2017, "Gabriel F. T. Gomes" <gftg@linux.vnet.ibm.com> wrote:

> +* Support is added, on powerpc64le, for interfaces supporting the _Float128
> +  type from ISO/IEC TS 18661-3:2015.  Most of the interfaces are taken from
> +  TS 18661-3.  The type-generic macros in <math.h> support this type, but
> +  those in <tgmath.h> do not.  The GNU C Library now requires GCC 6.2 or
> +  later to build for powerpc64le.  When used with GCC versions before GCC
> +  7, these interfaces may be used with the type under the non-standard name
> +  __float128.

You also need to check that the compiler actually supports float128.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

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

* Re: [PATCH v3 7/7] powerpc64le: Enable float128
  2017-06-23 12:34 ` [PATCH v3 7/7] powerpc64le: Enable float128 Gabriel F. T. Gomes
                     ` (2 preceding siblings ...)
  2017-06-27  7:20   ` Andreas Schwab
@ 2017-06-27  9:24   ` Andreas Schwab
  2017-06-27 13:15   ` Andreas Schwab
  4 siblings, 0 replies; 83+ messages in thread
From: Andreas Schwab @ 2017-06-27  9:24 UTC (permalink / raw)
  To: Gabriel F. T. Gomes; +Cc: libc-alpha

On Jun 23 2017, "Gabriel F. T. Gomes" <gftg@linux.vnet.ibm.com> wrote:

> diff --git a/sysdeps/powerpc/powerpc64le/Makefile b/sysdeps/powerpc/powerpc64le/Makefile
> new file mode 100644
> index 0000000..bd8a82d
> --- /dev/null
> +++ b/sysdeps/powerpc/powerpc64le/Makefile
> @@ -0,0 +1,45 @@
> +# When building float128 we need to ensure -mfloat128 is
> +# passed to all such object files.
> +
> +ifeq ($(subdir),math)
> +# sqrtf128 requires emulation before POWER9.
> +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
> +$(objpfx)test-float128%.o $(objpfx)test-float128%.os: CFLAGS += -mfloat128
> +$(objpfx)test-ifloat128%.o $(objpfx)test-ifloat128%.os: CFLAGS += -mfloat128
> +CFLAGS-libm-test-support-float128.c += -mfloat128
> +endif
> +
> +# Append flags to string <-> _Float128 routines.
> +ifneq ($(filter $(subdir),wcsmbs stdlib),)
> +%f128.o %f128.os %f128_l.o %f128_l.os %f128_nan.o %f128_nan.os %float1282mpn.o %float1282mpn.os %mpn2float128.o %mpn2float128.os: CFLAGS += -mfloat128

You need to iterate over all object suffixes.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

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

* Re: [PATCH v3 7/7] powerpc64le: Enable float128
  2017-06-23 12:34 ` [PATCH v3 7/7] powerpc64le: Enable float128 Gabriel F. T. Gomes
                     ` (3 preceding siblings ...)
  2017-06-27  9:24   ` Andreas Schwab
@ 2017-06-27 13:15   ` Andreas Schwab
  2017-06-28  0:54     ` [PATCH] powerpc64le: Iterate over all object suffixes when appending -mfloat128 Gabriel F. T. Gomes
  4 siblings, 1 reply; 83+ messages in thread
From: Andreas Schwab @ 2017-06-27 13:15 UTC (permalink / raw)
  To: Gabriel F. T. Gomes; +Cc: libc-alpha

On Jun 23 2017, "Gabriel F. T. Gomes" <gftg@linux.vnet.ibm.com> wrote:

> +# Append flags to string <-> _Float128 routines.
> +ifneq ($(filter $(subdir),wcsmbs stdlib),)
> +%f128.o %f128.os %f128_l.o %f128_l.os %f128_nan.o %f128_nan.os %float1282mpn.o %float1282mpn.os %mpn2float128.o %mpn2float128.os: CFLAGS += -mfloat128
> +CFLAGS-bug-strtod.c += -mfloat128
> +CFLAGS-bug-strtod2.c += -mfloat128
> +CFLAGS-tst-strtod-round.c += -mfloat128
> +CFLAGS-tst-wcstod-round.c += -mfloat128
> +CFLAGS-tst-strtod6.c += -mfloat128
> +CFLAGS-tst-strfrom.c += -mfloat128
> +CFLAGS-tst-strfrom-locale.c += -mfloat128
> +CFLAGS-strfrom-skeleton.c += -mfloat128
> +
> +# When building glibc with support for _Float128, the powers of ten tables in
> +# fpioconst.c and in the string conversion functions must be extended.
> +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

Why sysdep-CFLAGS-* and not CFLAGS-*?

Wouldn't it make sense to always pass -mfloat128?

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

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

* Re: [PATCH v3 7/7] powerpc64le: Enable float128
  2017-06-27  7:05       ` Florian Weimer
@ 2017-06-27 15:00         ` Peter Bergner
  2017-06-27 18:42           ` Florian Weimer
  2017-07-04  6:38         ` ppc64le: getauxval call from IFUNC resolver Florian Weimer
  1 sibling, 1 reply; 83+ messages in thread
From: Peter Bergner @ 2017-06-27 15:00 UTC (permalink / raw)
  To: Florian Weimer, Joseph Myers, Tulio Magno Quites Machado Filho
  Cc: Gabriel F. T. Gomes, libc-alpha

On 6/27/17 2:05 AM, Florian Weimer wrote:
> On 06/27/2017 01:02 AM, Joseph Myers wrote:
>> I'm seeing a testsuite regression for powerpc64le with 
>> build-many-glibcs.py with this patch (elf/check-localplt fails), did you 
>> not see that in your testing?
>>
>> https://sourceware.org/ml/libc-testresults/2017-q2/msg00427.html
>>
>> The failure is: "Extra PLT reference: libc.so: __getauxval".  As the 
>> __getauxval reference comes from have_ieee_hw_p in libgcc, presumably you 
>> need to allow that PLT reference in localplt.data with an appropriate 
>> comment, as it won't be readily possible to avoid it.
> 
> The __getauxval call happens from IFUNC resolvers and violates current
> guidelines regarding what can be done from IFUNC resolvers.  This is
> another reason to get rid of the PLT reference.
> 
> My IFUNC resolver enhancements are not ready for 2.26, and I plan to
> wait for DJ's dl-minimal malloc improvements to land, rather than
> rolling my own memory allocator to back the IFUNC resolver queue.

We have a __builtin_cpu_supports() version that can test for float128, so
why can't we use the following?  On older systems (ie, older glibcs),
the builtin will expand to false, which is conservatively correct.

Peter


-/* Use the namespace clean version of getauxval.  However, not all versions of
-   sys/auxv.h declare it, so declare it here.  This code is intended to be
-   temporary until a suitable version of __builtin_cpu_supports is added that
-   allows us to tell quickly if the machine supports IEEE 128-bit hardware.  */
-extern unsigned long __getauxval (unsigned long);
-
-static int
-have_ieee_hw_p (void)
-{
-  static int ieee_hw_p = -1;
-
-  if (ieee_hw_p < 0)
-    {
-      char *p = (char *) __getauxval (AT_PLATFORM);
-
-      ieee_hw_p = 0;
-
-      /* Don't use atoi/strtol/strncmp/etc.  These may require the normal
-	 environment to be setup to set errno to 0, and the ifunc resolvers run
-	 before the whole glibc environment is initialized.  */
-      if (p && p[0] == 'p' && p[1] == 'o' && p[2] == 'w' && p[3] == 'e'
-	  && p[4] == 'r')
-	{
-	  long n = 0;
-	  char ch;
-
-	  p += 5;
-	  while ((ch = *p++) >= '0' && (ch <= '9'))
-	    n = (n * 10) + (ch - '0');
-
-	  if (n >= 9)
-	    ieee_hw_p = 1;
-	}
-    }
-
-  return ieee_hw_p;
-}
-
-#define SW_OR_HW(SW, HW) (have_ieee_hw_p () ? HW : SW)
+#define SW_OR_HW(SW, HW) (__builtin_cpu_supports ("ieee128") ? HW : SW)

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

* Re: [PATCH v3 7/7] powerpc64le: Enable float128
  2017-06-26 23:02     ` Joseph Myers
  2017-06-27  3:29       ` Alan Modra
  2017-06-27  7:05       ` Florian Weimer
@ 2017-06-27 17:46       ` Gabriel F. T. Gomes
  2 siblings, 0 replies; 83+ messages in thread
From: Gabriel F. T. Gomes @ 2017-06-27 17:46 UTC (permalink / raw)
  To: Joseph Myers; +Cc: Tulio Magno Quites Machado Filho, libc-alpha

On Mon, 26 Jun 2017 23:02:04 +0000
Joseph Myers <joseph@codesourcery.com> wrote:

> I'm seeing a testsuite regression for powerpc64le with 
> build-many-glibcs.py with this patch (elf/check-localplt fails), did you 
> not see that in your testing?

Not with GCCs built by myself (GCC 6.2 and 7.1 (release tags) and GCC 8
(248932)), which is what I used in the tests.  None of them produced a
libc.so that contained have_ieee_hw_p.

I'm still trying to understand what's the difference between my compilers
and those from build-many-glibcs.py, but one of our suspects is that the
assembler on my machine does not have support for POWER9.

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

* Re: [PATCH v3 7/7] powerpc64le: Enable float128
  2017-06-27 15:00         ` Peter Bergner
@ 2017-06-27 18:42           ` Florian Weimer
  2017-06-27 18:51             ` Peter Bergner
  0 siblings, 1 reply; 83+ messages in thread
From: Florian Weimer @ 2017-06-27 18:42 UTC (permalink / raw)
  To: Peter Bergner, Joseph Myers, Tulio Magno Quites Machado Filho
  Cc: Gabriel F. T. Gomes, libc-alpha

On 06/27/2017 05:00 PM, Peter Bergner wrote:
> We have a __builtin_cpu_supports() version that can test for float128, so
> why can't we use the following?  On older systems (ie, older glibcs),
> the builtin will expand to false, which is conservatively correct.

> +#define SW_OR_HW(SW, HW) (__builtin_cpu_supports ("ieee128") ? HW : SW)

How is that implemented?  Does it call into the kernel or glibc, too?

Thanks,
Florian

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

* Re: [PATCH v3 7/7] powerpc64le: Enable float128
  2017-06-27 18:42           ` Florian Weimer
@ 2017-06-27 18:51             ` Peter Bergner
  2017-06-27 19:17               ` Florian Weimer
  0 siblings, 1 reply; 83+ messages in thread
From: Peter Bergner @ 2017-06-27 18:51 UTC (permalink / raw)
  To: Florian Weimer
  Cc: Joseph Myers, Tulio Magno Quites Machado Filho,
	Gabriel F. T. Gomes, libc-alpha

On 6/27/17 1:42 PM, Florian Weimer wrote:
> On 06/27/2017 05:00 PM, Peter Bergner wrote:
>> We have a __builtin_cpu_supports() version that can test for float128, so
>> why can't we use the following?  On older systems (ie, older glibcs),
>> the builtin will expand to false, which is conservatively correct.
> 
>> +#define SW_OR_HW(SW, HW) (__builtin_cpu_supports ("ieee128") ? HW : SW)
> 
> How is that implemented?  Does it call into the kernel or glibc, too?

No.  It reads a bit mask stored in the TCB which glibc has initialized
for us long before main() is called:

  https://sourceware.org/ml/libc-alpha/2015-12/msg00041.html

..so all that is generated is a load followed by a masking operation:

bergner@pike:~$ cat float128.c
int
float128 (void)
{
  return __builtin_cpu_supports ("ieee128");
}
bergner@pike:~$ gcc -O2 -S float128.c
bergner@pike:~$ cat float128.s
	[snip]
float128:
	lwz 3,-28776(13)
	rldicl 3,3,42,63
	blr

Peter

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

* Re: [PATCH v3 7/7] powerpc64le: Enable float128
  2017-06-27 18:51             ` Peter Bergner
@ 2017-06-27 19:17               ` Florian Weimer
  2017-06-27 19:33                 ` Carlos Eduardo Seo
  2017-06-27 19:34                 ` Peter Bergner
  0 siblings, 2 replies; 83+ messages in thread
From: Florian Weimer @ 2017-06-27 19:17 UTC (permalink / raw)
  To: Peter Bergner
  Cc: Joseph Myers, Tulio Magno Quites Machado Filho,
	Gabriel F. T. Gomes, libc-alpha

* Peter Bergner:

> On 6/27/17 1:42 PM, Florian Weimer wrote:
>> On 06/27/2017 05:00 PM, Peter Bergner wrote:
>>> We have a __builtin_cpu_supports() version that can test for float128, so
>>> why can't we use the following?  On older systems (ie, older glibcs),
>>> the builtin will expand to false, which is conservatively correct.
>> 
>>> +#define SW_OR_HW(SW, HW) (__builtin_cpu_supports ("ieee128") ? HW : SW)
>> 
>> How is that implemented?  Does it call into the kernel or glibc, too?
>
> No.  It reads a bit mask stored in the TCB which glibc has initialized
> for us long before main() is called:
>
>   https://sourceware.org/ml/libc-alpha/2015-12/msg00041.html
>
> ..so all that is generated is a load followed by a masking operation:
>
> bergner@pike:~$ cat float128.c
> int
> float128 (void)
> {
>   return __builtin_cpu_supports ("ieee128");
> }
> bergner@pike:~$ gcc -O2 -S float128.c
> bergner@pike:~$ cat float128.s
> 	[snip]
> float128:
> 	lwz 3,-28776(13)
> 	rldicl 3,3,42,63
> 	blr

Nice.  I guess the next question is: what would ensure that this code
only runs on a glibc which sets up the TCB in the expected way?  Is
there a symbol reference which prevents that?

__parse_hwcap_and_convert_at_platform isn't that symbol, as far as I
can tell.

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

* Re: [PATCH v3 7/7] powerpc64le: Enable float128
  2017-06-27 19:17               ` Florian Weimer
@ 2017-06-27 19:33                 ` Carlos Eduardo Seo
  2017-06-27 19:34                 ` Peter Bergner
  1 sibling, 0 replies; 83+ messages in thread
From: Carlos Eduardo Seo @ 2017-06-27 19:33 UTC (permalink / raw)
  To: Florian Weimer, Peter Bergner
  Cc: Joseph Myers, Tulio Magno Quites Machado Filho,
	Gabriel F. T. Gomes, libc-alpha


    Nice.  I guess the next question is: what would ensure that this code
    only runs on a glibc which sets up the TCB in the expected way?  Is
    there a symbol reference which prevents that?
    
    __parse_hwcap_and_convert_at_platform isn't that symbol, as far as I
    can tell.
    
  

Actually, it is. It’s versioned at glibc-2.23. I added that in sysdeps/powerpc/Versions when I did the change. This is what we agreed with O’Donell and the others that discussed that patch.


--
Carlos Eduardo Seo
Software Engineer - Linux on Power Toolchain
cseo@linux.vnet.ibm.com
 



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

* Re: [PATCH v3 7/7] powerpc64le: Enable float128
  2017-06-27 19:17               ` Florian Weimer
  2017-06-27 19:33                 ` Carlos Eduardo Seo
@ 2017-06-27 19:34                 ` Peter Bergner
  2017-06-27 21:41                   ` Florian Weimer
  1 sibling, 1 reply; 83+ messages in thread
From: Peter Bergner @ 2017-06-27 19:34 UTC (permalink / raw)
  To: Florian Weimer
  Cc: Joseph Myers, Tulio Magno Quites Machado Filho,
	Gabriel F. T. Gomes, libc-alpha

On 6/27/17 2:17 PM, Florian Weimer wrote:
> * Peter Bergner:
>> bergner@pike:~$ cat float128.c
>> int
>> float128 (void)
>> {
>>   return __builtin_cpu_supports ("ieee128");
>> }
>> bergner@pike:~$ gcc -O2 -S float128.c
>> bergner@pike:~$ cat float128.s
>> 	[snip]
>> float128:
>> 	lwz 3,-28776(13)
>> 	rldicl 3,3,42,63
>> 	blr
> 
> Nice.  I guess the next question is: what would ensure that this code
> only runs on a glibc which sets up the TCB in the expected way?  Is
> there a symbol reference which prevents that?
> 
> __parse_hwcap_and_convert_at_platform isn't that symbol, as far as I
> can tell.

Yes, we emit a symbol only defined by libcs that support this and
yes, __parse_hwcap_and_convert_at_platform is that symbol:

  if (cpu_builtin_p)
    {
      /* We have expanded a CPU builtin, so we need to emit a reference to
         the special symbol that LIBC uses to declare it supports the
         AT_PLATFORM and AT_HWCAP/AT_HWCAP2 in the TCB feature.  */
      switch_to_section (data_section);
      fprintf (asm_out_file, "\t.align %u\n", TARGET_32BIT ? 2 : 3);
      fprintf (asm_out_file, "\t%s %s\n",
               TARGET_32BIT ? ".long" : ".quad", tcb_verification_symbol);
    }

Why do you think that isn't the symbol we're using?

Peter



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

* Re: [PATCH v3 7/7] powerpc64le: Enable float128
  2017-06-27 19:34                 ` Peter Bergner
@ 2017-06-27 21:41                   ` Florian Weimer
  2017-06-28 16:30                     ` Szabolcs Nagy
  0 siblings, 1 reply; 83+ messages in thread
From: Florian Weimer @ 2017-06-27 21:41 UTC (permalink / raw)
  To: Peter Bergner
  Cc: Joseph Myers, Tulio Magno Quites Machado Filho,
	Gabriel F. T. Gomes, libc-alpha

* Peter Bergner:

> On 6/27/17 2:17 PM, Florian Weimer wrote:
>> * Peter Bergner:
>>> bergner@pike:~$ cat float128.c
>>> int
>>> float128 (void)
>>> {
>>>   return __builtin_cpu_supports ("ieee128");
>>> }
>>> bergner@pike:~$ gcc -O2 -S float128.c
>>> bergner@pike:~$ cat float128.s
>>> 	[snip]
>>> float128:
>>> 	lwz 3,-28776(13)
>>> 	rldicl 3,3,42,63
>>> 	blr
>> 
>> Nice.  I guess the next question is: what would ensure that this code
>> only runs on a glibc which sets up the TCB in the expected way?  Is
>> there a symbol reference which prevents that?
>> 
>> __parse_hwcap_and_convert_at_platform isn't that symbol, as far as I
>> can tell.
>
> Yes, we emit a symbol only defined by libcs that support this and
> yes, __parse_hwcap_and_convert_at_platform is that symbol:
>
>   if (cpu_builtin_p)
>     {
>       /* We have expanded a CPU builtin, so we need to emit a reference to
>          the special symbol that LIBC uses to declare it supports the
>          AT_PLATFORM and AT_HWCAP/AT_HWCAP2 in the TCB feature.  */
>       switch_to_section (data_section);
>       fprintf (asm_out_file, "\t.align %u\n", TARGET_32BIT ? 2 : 3);
>       fprintf (asm_out_file, "\t%s %s\n",
>                TARGET_32BIT ? ".long" : ".quad", tcb_verification_symbol);
>     }

I see, so everything is fine.  Nice!

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

* [PATCH] powerpc64le: Iterate over all object suffixes when appending -mfloat128
  2017-06-27 13:15   ` Andreas Schwab
@ 2017-06-28  0:54     ` Gabriel F. T. Gomes
  2017-06-28  7:19       ` Andreas Schwab
                         ` (2 more replies)
  0 siblings, 3 replies; 83+ messages in thread
From: Gabriel F. T. Gomes @ 2017-06-28  0:54 UTC (permalink / raw)
  To: schwab; +Cc: libc-alpha

On Tue, 27 Jun 2017 15:15:25 +0200
Andreas Schwab <schwab@suse.de> wrote:

> You need to iterate over all object suffixes.

This patch addresses this comment.

> Why sysdep-CFLAGS-* and not CFLAGS-*?

Machine-specific CFLAGS could be overriden depending on when the Rules file
gets included in the Makefile.  This has been discussed in a few threads,
such as:
https://sourceware.org/ml/libc-alpha/2012-11/msg00798.html
https://sourceware.org/ml/libc-alpha/2013-01/msg00337.html
and more recently (in the context of this file):
https://sourceware.org/ml/libc-alpha/2017-03/msg00218.html

I'm using sysdep-CFLAGS based on this.

> Wouldn't it make sense to always pass -mfloat128?

We can't use this flag globally, since it would mix -mfloat128 with other
flags that are not supported at the same time.  For instance, mcount.c and
dl-lookup.c are compiled with -mno-vsx, but -mfloat1128 requires vsx.

-- 8< --
On powerpc64le, the compilation of the files related to float128 support
requires the option -mfloat128 to be passed to gcc.  However, not all
possible object suffixes were covered in the Makefile.  This patch uses
$(all-object-suffixes) in all remaining rules.

Tested for powerpc64le.

	* sysdeps/powerpc/powerpc64le/Makefile: Use $(all-object-suffixes)
	to iterate over all possible object suffixes.
---
 sysdeps/powerpc/powerpc64le/Makefile                      | 10 +++++++---
 sysdeps/unix/sysv/linux/powerpc/powerpc64le/localplt.data |  3 +++
 2 files changed, 10 insertions(+), 3 deletions(-)
 create mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc64le/localplt.data

diff --git a/sysdeps/powerpc/powerpc64le/Makefile b/sysdeps/powerpc/powerpc64le/Makefile
index bd8a82d..e940298 100644
--- a/sysdeps/powerpc/powerpc64le/Makefile
+++ b/sysdeps/powerpc/powerpc64le/Makefile
@@ -8,14 +8,18 @@ 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
-$(objpfx)test-float128%.o $(objpfx)test-float128%.os: CFLAGS += -mfloat128
-$(objpfx)test-ifloat128%.o $(objpfx)test-ifloat128%.os: CFLAGS += -mfloat128
+$(foreach suf,$(all-object-suffixes),$(objpfx)test-float128%$(suf)): CFLAGS += -mfloat128
+$(foreach suf,$(all-object-suffixes),$(objpfx)test-ifloat128%$(suf)): CFLAGS += -mfloat128
 CFLAGS-libm-test-support-float128.c += -mfloat128
 endif
 
 # Append flags to string <-> _Float128 routines.
 ifneq ($(filter $(subdir),wcsmbs stdlib),)
-%f128.o %f128.os %f128_l.o %f128_l.os %f128_nan.o %f128_nan.os %float1282mpn.o %float1282mpn.os %mpn2float128.o %mpn2float128.os: CFLAGS += -mfloat128
+$(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
 CFLAGS-bug-strtod.c += -mfloat128
 CFLAGS-bug-strtod2.c += -mfloat128
 CFLAGS-tst-strtod-round.c += -mfloat128
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64le/localplt.data b/sysdeps/unix/sysv/linux/powerpc/powerpc64le/localplt.data
new file mode 100644
index 0000000..17f89ca
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64le/localplt.data
@@ -0,0 +1,3 @@
+# GCC emits a call to __getauxval from have_ieee_hw_p (libgcc)
+# (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81193)
+libc.so: __getauxval
-- 
2.4.11

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

* Re: [PATCH] powerpc64le: Iterate over all object suffixes when appending -mfloat128
  2017-06-28  0:54     ` [PATCH] powerpc64le: Iterate over all object suffixes when appending -mfloat128 Gabriel F. T. Gomes
@ 2017-06-28  7:19       ` Andreas Schwab
  2017-06-28 11:58         ` Gabriel F. T. Gomes
  2017-06-28  7:22       ` Andreas Schwab
  2017-07-10 10:22       ` Joseph Myers
  2 siblings, 1 reply; 83+ messages in thread
From: Andreas Schwab @ 2017-06-28  7:19 UTC (permalink / raw)
  To: Gabriel F. T. Gomes; +Cc: libc-alpha

On Jun 27 2017, "Gabriel F. T. Gomes" <gftg@linux.vnet.ibm.com> wrote:

> 	* sysdeps/powerpc/powerpc64le/Makefile: Use $(all-object-suffixes)
> 	to iterate over all possible object suffixes.

Ok.

> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64le/localplt.data b/sysdeps/unix/sysv/linux/powerpc/powerpc64le/localplt.data
> new file mode 100644
> index 0000000..17f89ca
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64le/localplt.data
> @@ -0,0 +1,3 @@
> +# GCC emits a call to __getauxval from have_ieee_hw_p (libgcc)
> +# (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81193)
> +libc.so: __getauxval

This is unrelated and should not be part of the commit.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

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

* Re: [PATCH] powerpc64le: Iterate over all object suffixes when appending -mfloat128
  2017-06-28  0:54     ` [PATCH] powerpc64le: Iterate over all object suffixes when appending -mfloat128 Gabriel F. T. Gomes
  2017-06-28  7:19       ` Andreas Schwab
@ 2017-06-28  7:22       ` Andreas Schwab
  2017-07-10 10:22       ` Joseph Myers
  2 siblings, 0 replies; 83+ messages in thread
From: Andreas Schwab @ 2017-06-28  7:22 UTC (permalink / raw)
  To: Gabriel F. T. Gomes; +Cc: libc-alpha

On Jun 27 2017, "Gabriel F. T. Gomes" <gftg@linux.vnet.ibm.com> wrote:

>> Why sysdep-CFLAGS-* and not CFLAGS-*?
>
> Machine-specific CFLAGS could be overriden depending on when the Rules file
> gets included in the Makefile.  This has been discussed in a few threads,
> such as:
> https://sourceware.org/ml/libc-alpha/2012-11/msg00798.html
> https://sourceware.org/ml/libc-alpha/2013-01/msg00337.html
> and more recently (in the context of this file):
> https://sourceware.org/ml/libc-alpha/2017-03/msg00218.html
>
> I'm using sysdep-CFLAGS based on this.

Can you add a comment please?

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

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

* Re: [PATCH] powerpc64le: Iterate over all object suffixes when appending -mfloat128
  2017-06-28  7:19       ` Andreas Schwab
@ 2017-06-28 11:58         ` Gabriel F. T. Gomes
  0 siblings, 0 replies; 83+ messages in thread
From: Gabriel F. T. Gomes @ 2017-06-28 11:58 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: libc-alpha

On Wed, 28 Jun 2017 09:19:54 +0200
Andreas Schwab <schwab@suse.de> wrote:

> > diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64le/localplt.data b/sysdeps/unix/sysv/linux/powerpc/powerpc64le/localplt.data
> > new file mode 100644
> > index 0000000..17f89ca
> > --- /dev/null
> > +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64le/localplt.data
> > @@ -0,0 +1,3 @@
> > +# GCC emits a call to __getauxval from have_ieee_hw_p (libgcc)
> > +# (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81193)
> > +libc.so: __getauxval  
> 
> This is unrelated and should not be part of the commit.

Sorry about that.  It got included in the patch when I was amending the
commit message right before for submission to this list.

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

* Re: [PATCH v3 7/7] powerpc64le: Enable float128
  2017-06-27 21:41                   ` Florian Weimer
@ 2017-06-28 16:30                     ` Szabolcs Nagy
  2017-06-28 17:08                       ` Peter Bergner
  0 siblings, 1 reply; 83+ messages in thread
From: Szabolcs Nagy @ 2017-06-28 16:30 UTC (permalink / raw)
  To: Florian Weimer, Peter Bergner
  Cc: nd, Joseph Myers, Tulio Magno Quites Machado Filho,
	Gabriel F. T. Gomes, libc-alpha

On 27/06/17 22:41, Florian Weimer wrote:
> * Peter Bergner:
> 
>> On 6/27/17 2:17 PM, Florian Weimer wrote:
>>> * Peter Bergner:
>>>> bergner@pike:~$ cat float128.c
>>>> int
>>>> float128 (void)
>>>> {
>>>>   return __builtin_cpu_supports ("ieee128");
>>>> }
>>>> bergner@pike:~$ gcc -O2 -S float128.c
>>>> bergner@pike:~$ cat float128.s
>>>> 	[snip]
>>>> float128:
>>>> 	lwz 3,-28776(13)
>>>> 	rldicl 3,3,42,63
>>>> 	blr
>>>
>>> Nice.  I guess the next question is: what would ensure that this code
>>> only runs on a glibc which sets up the TCB in the expected way?  Is
>>> there a symbol reference which prevents that?
>>>
>>> __parse_hwcap_and_convert_at_platform isn't that symbol, as far as I
>>> can tell.
>>
>> Yes, we emit a symbol only defined by libcs that support this and
>> yes, __parse_hwcap_and_convert_at_platform is that symbol:
>>
>>   if (cpu_builtin_p)
>>     {
>>       /* We have expanded a CPU builtin, so we need to emit a reference to
>>          the special symbol that LIBC uses to declare it supports the
>>          AT_PLATFORM and AT_HWCAP/AT_HWCAP2 in the TCB feature.  */
>>       switch_to_section (data_section);
>>       fprintf (asm_out_file, "\t.align %u\n", TARGET_32BIT ? 2 : 3);
>>       fprintf (asm_out_file, "\t%s %s\n",
>>                TARGET_32BIT ? ".long" : ".quad", tcb_verification_symbol);
>>     }
> 
> I see, so everything is fine.  Nice!
> 

well using the new builtin means glibc build will fail with old gcc.

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

* Re: [PATCH v3 7/7] powerpc64le: Enable float128
  2017-06-28 16:30                     ` Szabolcs Nagy
@ 2017-06-28 17:08                       ` Peter Bergner
  2017-06-28 17:15                         ` Szabolcs Nagy
  0 siblings, 1 reply; 83+ messages in thread
From: Peter Bergner @ 2017-06-28 17:08 UTC (permalink / raw)
  To: Szabolcs Nagy
  Cc: Florian Weimer, nd, Joseph Myers,
	Tulio Magno Quites Machado Filho, Gabriel F. T. Gomes,
	libc-alpha

On 6/28/17 11:30 AM, Szabolcs Nagy wrote:
> On 27/06/17 22:41, Florian Weimer wrote:
>> * Peter Bergner:
>>> Yes, we emit a symbol only defined by libcs that support this and
>>> yes, __parse_hwcap_and_convert_at_platform is that symbol:
>>>
>>>   if (cpu_builtin_p)
>>>     {
>>>       /* We have expanded a CPU builtin, so we need to emit a reference to
>>>          the special symbol that LIBC uses to declare it supports the
>>>          AT_PLATFORM and AT_HWCAP/AT_HWCAP2 in the TCB feature.  */
>>>       switch_to_section (data_section);
>>>       fprintf (asm_out_file, "\t.align %u\n", TARGET_32BIT ? 2 : 3);
>>>       fprintf (asm_out_file, "\t%s %s\n",
>>>                TARGET_32BIT ? ".long" : ".quad", tcb_verification_symbol);
>>>     }
>>
>> I see, so everything is fine.  Nice!
>>
> 
> well using the new builtin means glibc build will fail with old gcc.

How so?  The usage of __builtin_cpu_supports() we're talking about is in
libgcc's float128-ifunc.c source file, so it's not part of GLIBC's build.

Peter


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

* Re: [PATCH v3 7/7] powerpc64le: Enable float128
  2017-06-28 17:08                       ` Peter Bergner
@ 2017-06-28 17:15                         ` Szabolcs Nagy
  0 siblings, 0 replies; 83+ messages in thread
From: Szabolcs Nagy @ 2017-06-28 17:15 UTC (permalink / raw)
  To: Peter Bergner
  Cc: nd, Florian Weimer, Joseph Myers,
	Tulio Magno Quites Machado Filho, Gabriel F. T. Gomes,
	libc-alpha

On 28/06/17 18:08, Peter Bergner wrote:
> On 6/28/17 11:30 AM, Szabolcs Nagy wrote:
>> On 27/06/17 22:41, Florian Weimer wrote:
>>> * Peter Bergner:
>>>> Yes, we emit a symbol only defined by libcs that support this and
>>>> yes, __parse_hwcap_and_convert_at_platform is that symbol:
>>>>
>>>>   if (cpu_builtin_p)
>>>>     {
>>>>       /* We have expanded a CPU builtin, so we need to emit a reference to
>>>>          the special symbol that LIBC uses to declare it supports the
>>>>          AT_PLATFORM and AT_HWCAP/AT_HWCAP2 in the TCB feature.  */
>>>>       switch_to_section (data_section);
>>>>       fprintf (asm_out_file, "\t.align %u\n", TARGET_32BIT ? 2 : 3);
>>>>       fprintf (asm_out_file, "\t%s %s\n",
>>>>                TARGET_32BIT ? ".long" : ".quad", tcb_verification_symbol);
>>>>     }
>>>
>>> I see, so everything is fine.  Nice!
>>>
>>
>> well using the new builtin means glibc build will fail with old gcc.
> 
> How so?  The usage of __builtin_cpu_supports() we're talking about is in
> libgcc's float128-ifunc.c source file, so it's not part of GLIBC's build.

ah sorry then don't mind me.

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

* ppc64le: getauxval call from IFUNC resolver
  2017-06-27  7:05       ` Florian Weimer
  2017-06-27 15:00         ` Peter Bergner
@ 2017-07-04  6:38         ` Florian Weimer
  2017-07-05 17:25           ` [RFC] Fix float128 IFUNC relocations on ppc64le [BZ #21707] Tulio Magno Quites Machado Filho
  2017-07-07 22:19           ` ppc64le: getauxval call from IFUNC resolver Peter Bergner
  1 sibling, 2 replies; 83+ messages in thread
From: Florian Weimer @ 2017-07-04  6:38 UTC (permalink / raw)
  To: Joseph Myers, Tulio Magno Quites Machado Filho
  Cc: Gabriel F. T. Gomes, libc-alpha, Peter Bergner

On 06/27/2017 09:05 AM, Florian Weimer wrote:
> On 06/27/2017 01:02 AM, Joseph Myers wrote:
>> I'm seeing a testsuite regression for powerpc64le with 
>> build-many-glibcs.py with this patch (elf/check-localplt fails), did you 
>> not see that in your testing?
>>
>> https://sourceware.org/ml/libc-testresults/2017-q2/msg00427.html
>>
>> The failure is: "Extra PLT reference: libc.so: __getauxval".  As the 
>> __getauxval reference comes from have_ieee_hw_p in libgcc, presumably you 
>> need to allow that PLT reference in localplt.data with an appropriate 
>> comment, as it won't be readily possible to avoid it.
> 
> The __getauxval call happens from IFUNC resolvers and violates current
> guidelines regarding what can be done from IFUNC resolvers.  This is
> another reason to get rid of the PLT reference.
> 
> My IFUNC resolver enhancements are not ready for 2.26, and I plan to
> wait for DJ's dl-minimal malloc improvements to land, rather than
> rolling my own memory allocator to back the IFUNC resolver queue.

The above isn't correct because even if you can call getauxval, it
doesn't have the data to return meaningful results during relocation.
This currently breaks --enable-bind-now builds on pcp64le:

  https://sourceware.org/bugzilla/show_bug.cgi?id=21707

For the time being, we just disable --enable-bind-now, but I'd prefer a
proper fix, perhaps the one suggested here:

  https://sourceware.org/ml/libc-alpha/2017-06/msg01383.html

Thanks,
Florian

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

* [RFC] Fix float128 IFUNC relocations on ppc64le [BZ #21707]
  2017-07-04  6:38         ` ppc64le: getauxval call from IFUNC resolver Florian Weimer
@ 2017-07-05 17:25           ` Tulio Magno Quites Machado Filho
  2017-07-05 19:19             ` Florian Weimer
                               ` (2 more replies)
  2017-07-07 22:19           ` ppc64le: getauxval call from IFUNC resolver Peter Bergner
  1 sibling, 3 replies; 83+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2017-07-05 17:25 UTC (permalink / raw)
  To: libc-alpha; +Cc: fweimer, bergner, joseph, gftg

> On 06/27/2017 09:05 AM, Florian Weimer wrote:
>> On 06/27/2017 01:02 AM, Joseph Myers wrote:
>>> I'm seeing a testsuite regression for powerpc64le with
>>> build-many-glibcs.py with this patch (elf/check-localplt fails), did you
>>> not see that in your testing?
>>>
>>> https://sourceware.org/ml/libc-testresults/2017-q2/msg00427.html
>>>
>>> The failure is: "Extra PLT reference: libc.so: __getauxval".  As the
>>> __getauxval reference comes from have_ieee_hw_p in libgcc, presumably you
>>> need to allow that PLT reference in localplt.data with an appropriate
>>> comment, as it won't be readily possible to avoid it.
>>
>> The __getauxval call happens from IFUNC resolvers and violates current
>> guidelines regarding what can be done from IFUNC resolvers.  This is
>> another reason to get rid of the PLT reference.
>>
>> My IFUNC resolver enhancements are not ready for 2.26, and I plan to
>> wait for DJ's dl-minimal malloc improvements to land, rather than
>> rolling my own memory allocator to back the IFUNC resolver queue.
>
> The above isn't correct because even if you can call getauxval, it
> doesn't have the data to return meaningful results during relocation.
> This currently breaks --enable-bind-now builds on pcp64le:
>
>   https://sourceware.org/bugzilla/show_bug.cgi?id=21707

I agree.

> For the time being, we just disable --enable-bind-now, but I'd prefer a
> proper fix, perhaps the one suggested here:
>
>   https://sourceware.org/ml/libc-alpha/2017-06/msg01383.html

Unfortunately, this patch creates another issue: the thread pointer is not
initialized at the time of IRELA relocations in static executables.

The following changes solve this issue.

-- 8< --

The patch proposed by Peter Bergner [1] to libgc in order to fix
[BZ #21707] adds a dependency on a symbol provided by the loader,
forcing the loader to be linked to tests after libgcc was linked.

The change also requires to access the thread pointer during IRELA
relocations.

Tested on powerpc, powerpc64, powerpc64le, s390x and x86_64.

[1] https://sourceware.org/ml/libc-alpha/2017-06/msg01383.html

2017-07-05  Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>

	[BZ #21707]
	* csu/libc-start.c (LIBC_START_MAIN): Perform IREL{,A}
	relocations after initializing the TCB..
	* sysdeps/powerpc/powerpc64le/Makefile (f128-loader-link): New
	variable.
	[$(subdir) = math] (test-float128% test-ifloat128%): Force
	linking to the loader after linking to libgcc.
	[$(subdir) = wcsmbs stdlib] (bug-strtod bug-strtod2 bug-strtod2)
	(tst-strtod-round tst-wcstod-round tst-strtod6 tst-strrom)
	(tst-strfrom-locale strfrom-skeleton): Likewise.
---
 csu/libc-start.c                     |  9 ++++++---
 sysdeps/powerpc/powerpc64le/Makefile | 10 ++++++++++
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/csu/libc-start.c b/csu/libc-start.c
index c2dd159..e6fa848 100644
--- a/csu/libc-start.c
+++ b/csu/libc-start.c
@@ -188,12 +188,15 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
 
   ARCH_INIT_CPU_FEATURES ();
 
-  /* Perform IREL{,A} relocations.  */
-  apply_irel ();
-
   /* The stack guard goes into the TCB, so initialize it early.  */
   __libc_setup_tls ();
 
+  /* Perform IREL{,A} relocations.
+     Note: the relocations must happen after TLS initialization so that
+     IFUNC resolvers can benefit from thread-local storage, e.g. powerpc's
+     hwcap and platform fields available in the TCB.  */
+  apply_irel ();
+
   /* Set up the stack checker's canary.  */
   uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (_dl_random);
 # ifdef THREAD_SET_STACK_GUARD
diff --git a/sysdeps/powerpc/powerpc64le/Makefile b/sysdeps/powerpc/powerpc64le/Makefile
index bd8a82d..abaa74d 100644
--- a/sysdeps/powerpc/powerpc64le/Makefile
+++ b/sysdeps/powerpc/powerpc64le/Makefile
@@ -1,6 +1,11 @@
 # When building float128 we need to ensure -mfloat128 is
 # passed to all such object files.
 
+# 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 = $(as-needed) $(elf-objpfx)ld.so $(no-as-needed)
+
 ifeq ($(subdir),math)
 # sqrtf128 requires emulation before POWER9.
 CPPFLAGS += -I../soft-fp
@@ -11,6 +16,8 @@ $(foreach suf,$(all-object-suffixes),%f128_r$(suf)): CFLAGS += -mfloat128
 $(objpfx)test-float128%.o $(objpfx)test-float128%.os: CFLAGS += -mfloat128
 $(objpfx)test-ifloat128%.o $(objpfx)test-ifloat128%.os: CFLAGS += -mfloat128
 CFLAGS-libm-test-support-float128.c += -mfloat128
+$(objpfx)test-float128% $(objpfx)test-ifloat128%: \
+  gnulib-tests += $(f128-loader-link)
 endif
 
 # Append flags to string <-> _Float128 routines.
@@ -24,6 +31,9 @@ CFLAGS-tst-strtod6.c += -mfloat128
 CFLAGS-tst-strfrom.c += -mfloat128
 CFLAGS-tst-strfrom-locale.c += -mfloat128
 CFLAGS-strfrom-skeleton.c += -mfloat128
+$(foreach test,bug-strtod bug-strtod2 bug-strtod2 tst-strtod-round \
+tst-wcstod-round tst-strtod6 tst-strrom tst-strfrom-locale \
+strfrom-skeleton,$(objpfx)$(pref)): 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.
-- 
2.9.4

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

* Re: [RFC] Fix float128 IFUNC relocations on ppc64le [BZ #21707]
  2017-07-05 17:25           ` [RFC] Fix float128 IFUNC relocations on ppc64le [BZ #21707] Tulio Magno Quites Machado Filho
@ 2017-07-05 19:19             ` Florian Weimer
  2017-07-05 19:25               ` Carlos O'Donell
  2017-07-05 19:21             ` [RFC] Fix float128 IFUNC relocations on ppc64le " Carlos O'Donell
  2017-07-05 19:40             ` Gabriel F. T. Gomes
  2 siblings, 1 reply; 83+ messages in thread
From: Florian Weimer @ 2017-07-05 19:19 UTC (permalink / raw)
  To: Tulio Magno Quites Machado Filho, libc-alpha; +Cc: bergner, joseph, gftg

On 07/05/2017 07:23 PM, Tulio Magno Quites Machado Filho wrote:

>    ARCH_INIT_CPU_FEATURES ();
>  
> -  /* Perform IREL{,A} relocations.  */
> -  apply_irel ();
> -
>    /* The stack guard goes into the TCB, so initialize it early.  */
>    __libc_setup_tls ();
>  
> +  /* Perform IREL{,A} relocations.
> +     Note: the relocations must happen after TLS initialization so that
> +     IFUNC resolvers can benefit from thread-local storage, e.g. powerpc's
> +     hwcap and platform fields available in the TCB.  */
> +  apply_irel ();
> +

__libc_setup_tls calls memcpy and a lot of other stuff, so I'm not sure
if this change is correct on all architectures.

> +# 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 = $(as-needed) $(elf-objpfx)ld.so $(no-as-needed)

Why doesn't the regular linker invocation take care of this?  Will user
applications run into the same issue?

Thanks,
Florian

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

* Re: [RFC] Fix float128 IFUNC relocations on ppc64le [BZ #21707]
  2017-07-05 17:25           ` [RFC] Fix float128 IFUNC relocations on ppc64le [BZ #21707] Tulio Magno Quites Machado Filho
  2017-07-05 19:19             ` Florian Weimer
@ 2017-07-05 19:21             ` Carlos O'Donell
  2017-07-08 18:46               ` Tulio Magno Quites Machado Filho
  2017-07-05 19:40             ` Gabriel F. T. Gomes
  2 siblings, 1 reply; 83+ messages in thread
From: Carlos O'Donell @ 2017-07-05 19:21 UTC (permalink / raw)
  To: Tulio Magno Quites Machado Filho, libc-alpha
  Cc: fweimer, bergner, joseph, gftg

On 07/05/2017 01:23 PM, Tulio Magno Quites Machado Filho wrote:
>> On 06/27/2017 09:05 AM, Florian Weimer wrote:
>>> On 06/27/2017 01:02 AM, Joseph Myers wrote:
>>>> I'm seeing a testsuite regression for powerpc64le with
>>>> build-many-glibcs.py with this patch (elf/check-localplt fails), did you
>>>> not see that in your testing?
>>>>
>>>> https://sourceware.org/ml/libc-testresults/2017-q2/msg00427.html
>>>>
>>>> The failure is: "Extra PLT reference: libc.so: __getauxval".  As the
>>>> __getauxval reference comes from have_ieee_hw_p in libgcc, presumably you
>>>> need to allow that PLT reference in localplt.data with an appropriate
>>>> comment, as it won't be readily possible to avoid it.
>>>
>>> The __getauxval call happens from IFUNC resolvers and violates current
>>> guidelines regarding what can be done from IFUNC resolvers.  This is
>>> another reason to get rid of the PLT reference.
>>>
>>> My IFUNC resolver enhancements are not ready for 2.26, and I plan to
>>> wait for DJ's dl-minimal malloc improvements to land, rather than
>>> rolling my own memory allocator to back the IFUNC resolver queue.
>>
>> The above isn't correct because even if you can call getauxval, it
>> doesn't have the data to return meaningful results during relocation.
>> This currently breaks --enable-bind-now builds on pcp64le:
>>
>>   https://sourceware.org/bugzilla/show_bug.cgi?id=21707
> 
> I agree.
> 
>> For the time being, we just disable --enable-bind-now, but I'd prefer a
>> proper fix, perhaps the one suggested here:
>>
>>   https://sourceware.org/ml/libc-alpha/2017-06/msg01383.html
> 
> Unfortunately, this patch creates another issue: the thread pointer is not
> initialized at the time of IRELA relocations in static executables.
> 
> The following changes solve this issue.

OK to checkin with a test.

You need a static program with an IFUNC resolver that touches a __thread
variable and fails before your patch, and passes after. This is marginal
proof that TLS is operational after your change. Have the resolver set the
TLS variable to some value and check that value in main.

e.g.
#include <stdio.h>
#include <stdlib.h>

__thread int called;

int foo (void) __attribute__ ((ifunc ("resolve_foo")));

int my_foo (void)
{
  printf ("GNU ifunc resolver called %d times.\n", called);
  return called;
}

static int (*resolve_foo (void)) (void)
{
  called++;
  return my_foo;
}

int my_caller (void)
{
  return foo ();
}

int
main (void)
{
  if (foo () == 1)
    printf ("PASS: IFUNC resolver called once.\n");
  else
    printf ("FAIL: IFUNC resolver not called onece.\n");
    
  if (called == 1)
    printf ("PASS: __thread variable set correctly from IFUNC resolver.\n");
  else
    printf ("FAIL: __thread variable not set correctly from IFUNC resolver.\n");
}

At a high level this looks OK to me. We previously could not access __thread
in a static application during IFUNC resolvers because of the ordering in 
csu/libc-start.c, and now we can. Verify it with a test please.

That also means the TLS setup can't use IFUNCs, but a quick audit of libc.a
shows we don't call any IFUNC using functions in that sequence, only memcpy()
but we don't have an IFUNC for that.

A test like the one above test would fail if we added more IFUNCs in libc.a
and processed them late because any caller of them would crash if called
early.

> -- 8< --
> 
> The patch proposed by Peter Bergner [1] to libgc in order to fix
> [BZ #21707] adds a dependency on a symbol provided by the loader,
> forcing the loader to be linked to tests after libgcc was linked.
> 
> The change also requires to access the thread pointer during IRELA
> relocations.
> 
> Tested on powerpc, powerpc64, powerpc64le, s390x and x86_64.
> 
> [1] https://sourceware.org/ml/libc-alpha/2017-06/msg01383.html
> 
> 2017-07-05  Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>
> 
> 	[BZ #21707]
> 	* csu/libc-start.c (LIBC_START_MAIN): Perform IREL{,A}
> 	relocations after initializing the TCB..
> 	* sysdeps/powerpc/powerpc64le/Makefile (f128-loader-link): New
> 	variable.
> 	[$(subdir) = math] (test-float128% test-ifloat128%): Force
> 	linking to the loader after linking to libgcc.
> 	[$(subdir) = wcsmbs stdlib] (bug-strtod bug-strtod2 bug-strtod2)
> 	(tst-strtod-round tst-wcstod-round tst-strtod6 tst-strrom)
> 	(tst-strfrom-locale strfrom-skeleton): Likewise.
> ---
>  csu/libc-start.c                     |  9 ++++++---
>  sysdeps/powerpc/powerpc64le/Makefile | 10 ++++++++++
>  2 files changed, 16 insertions(+), 3 deletions(-)
> 
> diff --git a/csu/libc-start.c b/csu/libc-start.c
> index c2dd159..e6fa848 100644
> --- a/csu/libc-start.c
> +++ b/csu/libc-start.c
> @@ -188,12 +188,15 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
>  
>    ARCH_INIT_CPU_FEATURES ();
>  
> -  /* Perform IREL{,A} relocations.  */
> -  apply_irel ();
> -
>    /* The stack guard goes into the TCB, so initialize it early.  */
>    __libc_setup_tls ();
>  
> +  /* Perform IREL{,A} relocations.
> +     Note: the relocations must happen after TLS initialization so that
> +     IFUNC resolvers can benefit from thread-local storage, e.g. powerpc's
> +     hwcap and platform fields available in the TCB.  */
> +  apply_irel ();
> +
>    /* Set up the stack checker's canary.  */
>    uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (_dl_random);
>  # ifdef THREAD_SET_STACK_GUARD
> diff --git a/sysdeps/powerpc/powerpc64le/Makefile b/sysdeps/powerpc/powerpc64le/Makefile
> index bd8a82d..abaa74d 100644
> --- a/sysdeps/powerpc/powerpc64le/Makefile
> +++ b/sysdeps/powerpc/powerpc64le/Makefile
> @@ -1,6 +1,11 @@
>  # When building float128 we need to ensure -mfloat128 is
>  # passed to all such object files.
>  
> +# 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 = $(as-needed) $(elf-objpfx)ld.so $(no-as-needed)
> +
>  ifeq ($(subdir),math)
>  # sqrtf128 requires emulation before POWER9.
>  CPPFLAGS += -I../soft-fp
> @@ -11,6 +16,8 @@ $(foreach suf,$(all-object-suffixes),%f128_r$(suf)): CFLAGS += -mfloat128
>  $(objpfx)test-float128%.o $(objpfx)test-float128%.os: CFLAGS += -mfloat128
>  $(objpfx)test-ifloat128%.o $(objpfx)test-ifloat128%.os: CFLAGS += -mfloat128
>  CFLAGS-libm-test-support-float128.c += -mfloat128
> +$(objpfx)test-float128% $(objpfx)test-ifloat128%: \
> +  gnulib-tests += $(f128-loader-link)
>  endif
>  
>  # Append flags to string <-> _Float128 routines.
> @@ -24,6 +31,9 @@ CFLAGS-tst-strtod6.c += -mfloat128
>  CFLAGS-tst-strfrom.c += -mfloat128
>  CFLAGS-tst-strfrom-locale.c += -mfloat128
>  CFLAGS-strfrom-skeleton.c += -mfloat128
> +$(foreach test,bug-strtod bug-strtod2 bug-strtod2 tst-strtod-round \
> +tst-wcstod-round tst-strtod6 tst-strrom tst-strfrom-locale \
> +strfrom-skeleton,$(objpfx)$(pref)): 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.
> 


-- 
Cheers,
Carlos.

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

* Re: [RFC] Fix float128 IFUNC relocations on ppc64le [BZ #21707]
  2017-07-05 19:19             ` Florian Weimer
@ 2017-07-05 19:25               ` Carlos O'Donell
  2017-07-05 19:44                 ` Florian Weimer
  0 siblings, 1 reply; 83+ messages in thread
From: Carlos O'Donell @ 2017-07-05 19:25 UTC (permalink / raw)
  To: Florian Weimer, Tulio Magno Quites Machado Filho, libc-alpha
  Cc: bergner, joseph, gftg

On 07/05/2017 03:19 PM, Florian Weimer wrote:
> On 07/05/2017 07:23 PM, Tulio Magno Quites Machado Filho wrote:
> 
>>    ARCH_INIT_CPU_FEATURES ();
>>  
>> -  /* Perform IREL{,A} relocations.  */
>> -  apply_irel ();
>> -
>>    /* The stack guard goes into the TCB, so initialize it early.  */
>>    __libc_setup_tls ();
>>  
>> +  /* Perform IREL{,A} relocations.
>> +     Note: the relocations must happen after TLS initialization so that
>> +     IFUNC resolvers can benefit from thread-local storage, e.g. powerpc's
>> +     hwcap and platform fields available in the TCB.  */
>> +  apply_irel ();
>> +
> 
> __libc_setup_tls calls memcpy and a lot of other stuff, so I'm not sure
> if this change is correct on all architectures.

I audited this, and it looks like we don't IFUNC memcpy in libc.a, probably
because of this issue, we use memcpy very very early.

A new test like I suggest would make sure we don't regress this.

>> +# 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 = $(as-needed) $(elf-objpfx)ld.so $(no-as-needed)
> 
> Why doesn't the regular linker invocation take care of this?  Will user
> applications run into the same issue?

We don't use the regular linker invocation in glibc builds? We have to emulate
what the actual toolchain would do in this case.

I would expect that users using gcc as the normal driver would get ld.so
included as needed.

Tulio can answer more authoritatively here.

-- 
Cheers,
Carlos.

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

* Re: [RFC] Fix float128 IFUNC relocations on ppc64le [BZ #21707]
  2017-07-05 17:25           ` [RFC] Fix float128 IFUNC relocations on ppc64le [BZ #21707] Tulio Magno Quites Machado Filho
  2017-07-05 19:19             ` Florian Weimer
  2017-07-05 19:21             ` [RFC] Fix float128 IFUNC relocations on ppc64le " Carlos O'Donell
@ 2017-07-05 19:40             ` Gabriel F. T. Gomes
  2017-07-05 20:32               ` Tulio Magno Quites Machado Filho
  2 siblings, 1 reply; 83+ messages in thread
From: Gabriel F. T. Gomes @ 2017-07-05 19:40 UTC (permalink / raw)
  To: Tulio Magno Quites Machado Filho; +Cc: libc-alpha, fweimer, bergner, joseph

On Wed,  5 Jul 2017 14:23:15 -0300
"Tulio Magno Quites Machado Filho" <tuliom@linux.vnet.ibm.com> wrote:
>
> @@ -24,6 +31,9 @@ CFLAGS-tst-strtod6.c += -mfloat128
>  CFLAGS-tst-strfrom.c += -mfloat128
>  CFLAGS-tst-strfrom-locale.c += -mfloat128
>  CFLAGS-strfrom-skeleton.c += -mfloat128
> +$(foreach test,bug-strtod bug-strtod2 bug-strtod2 tst-strtod-round \
> +tst-wcstod-round tst-strtod6 tst-strrom tst-strfrom-locale \
> +strfrom-skeleton,$(objpfx)$(pref)): gnulib-tests += $(f128-loader-link)
                               ~~~~
I understand what you are trying to do, but I did not understand what is
the effect of $(pref).  I would expect it to be $(test).

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

* Re: [RFC] Fix float128 IFUNC relocations on ppc64le [BZ #21707]
  2017-07-05 19:25               ` Carlos O'Donell
@ 2017-07-05 19:44                 ` Florian Weimer
  2017-07-05 20:12                   ` Joseph Myers
  0 siblings, 1 reply; 83+ messages in thread
From: Florian Weimer @ 2017-07-05 19:44 UTC (permalink / raw)
  To: Carlos O'Donell, Tulio Magno Quites Machado Filho, libc-alpha
  Cc: bergner, joseph, gftg

On 07/05/2017 09:25 PM, Carlos O'Donell wrote:
>>> +# 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 = $(as-needed) $(elf-objpfx)ld.so $(no-as-needed)
>> Why doesn't the regular linker invocation take care of this?  Will user
>> applications run into the same issue?
> We don't use the regular linker invocation in glibc builds? We have to emulate
> what the actual toolchain would do in this case.

But then we should do this everywhere, and not just for the few tests
that actually need it, right?  I assume that's also what the official
linker script does.

Thanks,
Florian

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

* Re: [RFC] Fix float128 IFUNC relocations on ppc64le [BZ #21707]
  2017-07-05 19:44                 ` Florian Weimer
@ 2017-07-05 20:12                   ` Joseph Myers
  2017-07-06  6:19                     ` Florian Weimer
  0 siblings, 1 reply; 83+ messages in thread
From: Joseph Myers @ 2017-07-05 20:12 UTC (permalink / raw)
  To: Florian Weimer
  Cc: Carlos O'Donell, Tulio Magno Quites Machado Filho,
	libc-alpha, bergner, gftg

On Wed, 5 Jul 2017, Florian Weimer wrote:

> On 07/05/2017 09:25 PM, Carlos O'Donell wrote:
> >>> +# 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 = $(as-needed) $(elf-objpfx)ld.so $(no-as-needed)
> >> Why doesn't the regular linker invocation take care of this?  Will user
> >> applications run into the same issue?
> > We don't use the regular linker invocation in glibc builds? We have to emulate
> > what the actual toolchain would do in this case.
> 
> But then we should do this everywhere, and not just for the few tests
> that actually need it, right?  I assume that's also what the official
> linker script does.

The installed compiler does -lgcc -lc -lgcc (roughly; -lgcc may actually 
use -lgcc_s or -lgcc_eh, and -lc may vary for e.g. profiling).  -lc is a 
linker script doing e.g. GROUP ( /lib64/libc.so.6 
/usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) ).  
The shared libgcc is also a linker script on some platforms.

The glibc build uses libc.so --as-needed ld.so --no-as-needed -lgcc 
(again, roughly) (but libc.a -lgcc libc.a -lgcc in the static build case).

I suppose the suggestion is that we should both use -lgcc before linking 
with libc, not just after (this being the issue involved in the present 
case), and use -Wl,--start-group -Wl,--end-group around libc.so and ld.so, 
both to be more similar to how things work with the installed compiler?  
Which makes sense, but is also rather risky for this development stage.

-- 
Joseph S. Myers
joseph@codesourcery.com

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

* Re: [RFC] Fix float128 IFUNC relocations on ppc64le [BZ #21707]
  2017-07-05 19:40             ` Gabriel F. T. Gomes
@ 2017-07-05 20:32               ` Tulio Magno Quites Machado Filho
  0 siblings, 0 replies; 83+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2017-07-05 20:32 UTC (permalink / raw)
  To: Gabriel F. T. Gomes; +Cc: libc-alpha, fweimer, bergner, joseph

"Gabriel F. T. Gomes" <gftg@linux.vnet.ibm.com> writes:

> [ text/plain ]
> On Wed,  5 Jul 2017 14:23:15 -0300
> "Tulio Magno Quites Machado Filho" <tuliom@linux.vnet.ibm.com> wrote:
>>
>> @@ -24,6 +31,9 @@ CFLAGS-tst-strtod6.c += -mfloat128
>>  CFLAGS-tst-strfrom.c += -mfloat128
>>  CFLAGS-tst-strfrom-locale.c += -mfloat128
>>  CFLAGS-strfrom-skeleton.c += -mfloat128
>> +$(foreach test,bug-strtod bug-strtod2 bug-strtod2 tst-strtod-round \
>> +tst-wcstod-round tst-strtod6 tst-strrom tst-strfrom-locale \
>> +strfrom-skeleton,$(objpfx)$(pref)): gnulib-tests += $(f128-loader-link)
>                                ~~~~
> I understand what you are trying to do, but I did not understand what is
> the effect of $(pref).  I would expect it to be $(test).

Yes.
Sorry, I messed up the patch while preparing for submission.

-- 
Tulio Magno

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

* Re: [RFC] Fix float128 IFUNC relocations on ppc64le [BZ #21707]
  2017-07-05 20:12                   ` Joseph Myers
@ 2017-07-06  6:19                     ` Florian Weimer
  2017-07-06 14:04                       ` Carlos O'Donell
  0 siblings, 1 reply; 83+ messages in thread
From: Florian Weimer @ 2017-07-06  6:19 UTC (permalink / raw)
  To: Joseph Myers
  Cc: Carlos O'Donell, Tulio Magno Quites Machado Filho,
	libc-alpha, bergner, gftg

On 07/05/2017 10:11 PM, Joseph Myers wrote:
> The installed compiler does -lgcc -lc -lgcc (roughly; -lgcc may actually 
> use -lgcc_s or -lgcc_eh, and -lc may vary for e.g. profiling).  -lc is a 
> linker script doing e.g. GROUP ( /lib64/libc.so.6 
> /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) ).  
> The shared libgcc is also a linker script on some platforms.
> 
> The glibc build uses libc.so --as-needed ld.so --no-as-needed -lgcc 
> (again, roughly) (but libc.a -lgcc libc.a -lgcc in the static build case).
> 
> I suppose the suggestion is that we should both use -lgcc before linking 
> with libc, not just after (this being the issue involved in the present 
> case), and use -Wl,--start-group -Wl,--end-group around libc.so and ld.so, 
> both to be more similar to how things work with the installed compiler?  
> Which makes sense, but is also rather risky for this development stage.

Okay, then let's postpone the more general approach and use whatever
works on POWER for the release.

I assumed that the general fix would still be POWER-specific, but that
does not seem to be the case.

Thanks,
Florian

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

* Re: [RFC] Fix float128 IFUNC relocations on ppc64le [BZ #21707]
  2017-07-06  6:19                     ` Florian Weimer
@ 2017-07-06 14:04                       ` Carlos O'Donell
  2017-07-07 10:08                         ` Florian Weimer
  0 siblings, 1 reply; 83+ messages in thread
From: Carlos O'Donell @ 2017-07-06 14:04 UTC (permalink / raw)
  To: Florian Weimer, Joseph Myers
  Cc: Tulio Magno Quites Machado Filho, libc-alpha, bergner, gftg

On 07/06/2017 02:12 AM, Florian Weimer wrote:
> On 07/05/2017 10:11 PM, Joseph Myers wrote:
>> The installed compiler does -lgcc -lc -lgcc (roughly; -lgcc may actually 
>> use -lgcc_s or -lgcc_eh, and -lc may vary for e.g. profiling).  -lc is a 
>> linker script doing e.g. GROUP ( /lib64/libc.so.6 
>> /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) ).  
>> The shared libgcc is also a linker script on some platforms.
>>
>> The glibc build uses libc.so --as-needed ld.so --no-as-needed -lgcc 
>> (again, roughly) (but libc.a -lgcc libc.a -lgcc in the static build case).
>>
>> I suppose the suggestion is that we should both use -lgcc before linking 
>> with libc, not just after (this being the issue involved in the present 
>> case), and use -Wl,--start-group -Wl,--end-group around libc.so and ld.so, 
>> both to be more similar to how things work with the installed compiler?  
>> Which makes sense, but is also rather risky for this development stage.
> 
> Okay, then let's postpone the more general approach and use whatever
> works on POWER for the release.

Right, for now only POWER needs the link command fixed.

> I assumed that the general fix would still be POWER-specific, but that
> does not seem to be the case.

Right, the fix is in general code, but it fixes a general problem for
all machines. Every machine, including x86_64, used to segfault upon
first use of __thread in an IFUNC resolver function, and the change
fixes that.

-- 
Cheers,
Carlos.

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

* Re: [RFC] Fix float128 IFUNC relocations on ppc64le [BZ #21707]
  2017-07-06 14:04                       ` Carlos O'Donell
@ 2017-07-07 10:08                         ` Florian Weimer
  2017-07-08 18:31                           ` [PATCHv2] " Tulio Magno Quites Machado Filho
  0 siblings, 1 reply; 83+ messages in thread
From: Florian Weimer @ 2017-07-07 10:08 UTC (permalink / raw)
  To: libc-alpha

On 07/06/2017 04:04 PM, Carlos O'Donell wrote:
> On 07/06/2017 02:12 AM, Florian Weimer wrote:
>> On 07/05/2017 10:11 PM, Joseph Myers wrote:
>>> The installed compiler does -lgcc -lc -lgcc (roughly; -lgcc may actually 
>>> use -lgcc_s or -lgcc_eh, and -lc may vary for e.g. profiling).  -lc is a 
>>> linker script doing e.g. GROUP ( /lib64/libc.so.6 
>>> /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) ).  
>>> The shared libgcc is also a linker script on some platforms.
>>>
>>> The glibc build uses libc.so --as-needed ld.so --no-as-needed -lgcc 
>>> (again, roughly) (but libc.a -lgcc libc.a -lgcc in the static build case).
>>>
>>> I suppose the suggestion is that we should both use -lgcc before linking 
>>> with libc, not just after (this being the issue involved in the present 
>>> case), and use -Wl,--start-group -Wl,--end-group around libc.so and ld.so, 
>>> both to be more similar to how things work with the installed compiler?  
>>> Which makes sense, but is also rather risky for this development stage.
>>
>> Okay, then let's postpone the more general approach and use whatever
>> works on POWER for the release.
> 
> Right, for now only POWER needs the link command fixed.
> 
>> I assumed that the general fix would still be POWER-specific, but that
>> does not seem to be the case.
> 
> Right, the fix is in general code, but it fixes a general problem for
> all machines. Every machine, including x86_64, used to segfault upon
> first use of __thread in an IFUNC resolver function, and the change
> fixes that.

Note that I was discussing the Makefile changes, not the apply_urel
reordering (which affects only static binaries anyway).

Florian

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

* Re: ppc64le: getauxval call from IFUNC resolver
  2017-07-04  6:38         ` ppc64le: getauxval call from IFUNC resolver Florian Weimer
  2017-07-05 17:25           ` [RFC] Fix float128 IFUNC relocations on ppc64le [BZ #21707] Tulio Magno Quites Machado Filho
@ 2017-07-07 22:19           ` Peter Bergner
  2017-07-10 19:59             ` Peter Bergner
  1 sibling, 1 reply; 83+ messages in thread
From: Peter Bergner @ 2017-07-07 22:19 UTC (permalink / raw)
  To: Florian Weimer
  Cc: Joseph Myers, Tulio Magno Quites Machado Filho,
	Gabriel F. T. Gomes, libc-alpha

On 7/4/17 1:37 AM, Florian Weimer wrote:
> For the time being, we just disable --enable-bind-now, but I'd prefer a
> proper fix, perhaps the one suggested here:
> 
>   https://sourceware.org/ml/libc-alpha/2017-06/msg01383.html

I just committed this to GCC trunk today.  I still need to bootstrap
and regtest the backports to GCC 7 and GCC 6.

Peter

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

* [PATCHv2] Fix float128 IFUNC relocations on ppc64le [BZ #21707]
  2017-07-07 10:08                         ` Florian Weimer
@ 2017-07-08 18:31                           ` Tulio Magno Quites Machado Filho
  2017-07-08 19:17                             ` Florian Weimer
                                               ` (4 more replies)
  0 siblings, 5 replies; 83+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2017-07-08 18:31 UTC (permalink / raw)
  To: libc-alpha; +Cc: fweimer, carlos, joseph, gftg

Changes since version 1:

 - Added a testcase.  This is now validating both statically and
   dynamically linked executables.
 - Fixed an issue in the $(foreach ..) in sysdeps/powerpc/powerpc64le/Makefile.
 - Added a comment to csu/libc-start.c
 - Added a comment to csu/libc-tls.c

-- 8< --

The patch proposed by Peter Bergner [1] to libgc in order to fix
[BZ #21707] adds a dependency on a symbol provided by the loader,
forcing the loader to be linked to tests after libgcc was linked.

It also requires to read the thread pointer during IRELA relocations.

Tested on powerpc, powerpc64, powerpc64le, s390x and x86_64.

[1] https://sourceware.org/ml/libc-alpha/2017-06/msg01383.html

2017-07-08  Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>

	[BZ #21707]
	* csu/libc-start.c (LIBC_START_MAIN): Perform IREL{,A}
	relocations after initializing the TCB on statically linked
	executables..
	* csu/libc-tls.c (__libc_setup_tls): Add a comment about
	IREL{,A} relocations.
	* elf/Makefile (tests-static-normal): Add tst-tlsifunc-static.
	(tests): Add tst-tlsifunc.
	* elf/tst-tlsifunc.c: New file.
	* elf/tst-tlsifunc-static.c: Likewise.
	* sysdeps/powerpc/powerpc64le/Makefile (f128-loader-link): New
	variable.
	[$(subdir) = math] (test-float128% test-ifloat128%): Force
	linking to the loader after linking to libgcc.
	[$(subdir) = wcsmbs stdlib] (bug-strtod bug-strtod2 bug-strtod2)
	(tst-strtod-round tst-wcstod-round tst-strtod6 tst-strrom)
	(tst-strfrom-locale strfrom-skeleton): Likewise.
---
 csu/libc-start.c                     | 11 +++---
 csu/libc-tls.c                       |  2 ++
 elf/Makefile                         |  5 +--
 elf/tst-tlsifunc-static.c            | 19 +++++++++++
 elf/tst-tlsifunc.c                   | 66 ++++++++++++++++++++++++++++++++++++
 sysdeps/powerpc/powerpc64le/Makefile | 10 ++++++
 6 files changed, 107 insertions(+), 6 deletions(-)
 create mode 100644 elf/tst-tlsifunc-static.c
 create mode 100644 elf/tst-tlsifunc.c

diff --git a/csu/libc-start.c b/csu/libc-start.c
index c2dd159..84b7f99 100644
--- a/csu/libc-start.c
+++ b/csu/libc-start.c
@@ -188,12 +188,15 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
 
   ARCH_INIT_CPU_FEATURES ();
 
-  /* Perform IREL{,A} relocations.  */
-  apply_irel ();
-
   /* The stack guard goes into the TCB, so initialize it early.  */
   __libc_setup_tls ();
 
+  /* Perform IREL{,A} relocations.
+     Note: the relocations must happen after TLS initialization so that
+     IFUNC resolvers can benefit from thread-local storage, e.g. powerpc's
+     hwcap and platform fields available in the TCB.  */
+  apply_irel ();
+
   /* Set up the stack checker's canary.  */
   uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (_dl_random);
 # ifdef THREAD_SET_STACK_GUARD
@@ -224,7 +227,7 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
   __pointer_chk_guard_local = pointer_chk_guard;
 # endif
 
-#endif
+#endif /* !SHARED  */
 
   /* Register the destructor of the dynamic linker if there is any.  */
   if (__glibc_likely (rtld_fini != NULL))
diff --git a/csu/libc-tls.c b/csu/libc-tls.c
index 3c897bf..2947912 100644
--- a/csu/libc-tls.c
+++ b/csu/libc-tls.c
@@ -101,6 +101,8 @@ init_static_tls (size_t memsz, size_t align)
   GL(dl_tls_static_nelem) = GL(dl_tls_max_dtv_idx);
 }
 
+/* Note: IREL{,A} relocations happen after TLS setup.  __libc_setup_tls has
+   to guarantee that it won't use STT_GNU_IFUNC.  */
 void
 __libc_setup_tls (void)
 {
diff --git a/elf/Makefile b/elf/Makefile
index 201b328..b603e89 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -147,12 +147,13 @@ tests-static-normal := tst-leaks1-static tst-array1-static tst-array5-static \
 	       tst-tlsalign-static tst-tlsalign-extern-static \
 	       tst-linkall-static tst-env-setuid tst-env-setuid-tunables
 tests-static-internal := tst-tls1-static tst-tls2-static \
-	       tst-ptrguard1-static tst-stackguard1-static
+	       tst-ptrguard1-static tst-stackguard1-static \
+	       tst-tlsifunc-static
 
 tests := tst-tls9 tst-leaks1 \
 	tst-array1 tst-array2 tst-array3 tst-array4 tst-array5 \
 	tst-auxv
-tests-internal := tst-tls1 tst-tls2 $(tests-static-internal)
+tests-internal := tst-tls1 tst-tls2 tst-tlsifunc $(tests-static-internal)
 tests-static := $(tests-static-normal) $(tests-static-internal)
 
 ifeq (yes,$(build-shared))
diff --git a/elf/tst-tlsifunc-static.c b/elf/tst-tlsifunc-static.c
new file mode 100644
index 0000000..e5313af
--- /dev/null
+++ b/elf/tst-tlsifunc-static.c
@@ -0,0 +1,19 @@
+/* Test if an executable can read from the TLS from an STT_GNU_IFUNC resolver.
+   Copyright (C) 2017 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
+   <http://www.gnu.org/licenses/>.  */
+
+#include "tst-tlsifunc.c"
diff --git a/elf/tst-tlsifunc.c b/elf/tst-tlsifunc.c
new file mode 100644
index 0000000..531d20f
--- /dev/null
+++ b/elf/tst-tlsifunc.c
@@ -0,0 +1,66 @@
+/* Test if an executable can read from the TLS from an STT_GNU_IFUNC resolver.
+   Copyright (C) 2017 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
+   <http://www.gnu.org/licenses/>.  */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <libc-symbols.h>
+#include "tls-macros.h"
+
+__thread int bar;
+static int * bar_ptr = NULL;
+
+int foo (void);
+
+void
+init_foo (void)
+{
+  bar_ptr = TLS_GD (bar);
+}
+
+int
+my_foo (void)
+{
+  printf ("&bar = %p and bar_ptr = %p.\n", &bar, bar_ptr);
+  return bar_ptr != NULL;
+}
+
+__ifunc (foo, foo, my_foo, void, init_foo);
+
+static int
+do_test (void)
+{
+  int ret = 0;
+
+  if (foo ())
+    printf ("PASS: IFUNC resolver called once.\n");
+  else {
+    printf ("FAIL: IFUNC resolver not called once.\n");
+    ret = 1;
+  }
+
+  if (&bar == bar_ptr)
+    printf ("PASS: Address read from IFUNC resolver is correct.\n");
+  else {
+    printf ("FAIL: Address read from IFUNC resolver is incorrect.\n");
+    ret = 1;
+  }
+
+  return ret;
+}
+
+#include <support/test-driver.c>
diff --git a/sysdeps/powerpc/powerpc64le/Makefile b/sysdeps/powerpc/powerpc64le/Makefile
index bd8a82d..90a41b1 100644
--- a/sysdeps/powerpc/powerpc64le/Makefile
+++ b/sysdeps/powerpc/powerpc64le/Makefile
@@ -1,6 +1,11 @@
 # When building float128 we need to ensure -mfloat128 is
 # passed to all such object files.
 
+# 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 = $(as-needed) $(elf-objpfx)ld.so $(no-as-needed)
+
 ifeq ($(subdir),math)
 # sqrtf128 requires emulation before POWER9.
 CPPFLAGS += -I../soft-fp
@@ -11,6 +16,8 @@ $(foreach suf,$(all-object-suffixes),%f128_r$(suf)): CFLAGS += -mfloat128
 $(objpfx)test-float128%.o $(objpfx)test-float128%.os: CFLAGS += -mfloat128
 $(objpfx)test-ifloat128%.o $(objpfx)test-ifloat128%.os: CFLAGS += -mfloat128
 CFLAGS-libm-test-support-float128.c += -mfloat128
+$(objpfx)test-float128% $(objpfx)test-ifloat128%: \
+  gnulib-tests += $(f128-loader-link)
 endif
 
 # Append flags to string <-> _Float128 routines.
@@ -24,6 +31,9 @@ CFLAGS-tst-strtod6.c += -mfloat128
 CFLAGS-tst-strfrom.c += -mfloat128
 CFLAGS-tst-strfrom-locale.c += -mfloat128
 CFLAGS-strfrom-skeleton.c += -mfloat128
+$(foreach test,bug-strtod bug-strtod2 bug-strtod2 tst-strtod-round \
+tst-wcstod-round tst-strtod6 tst-strrom tst-strfrom-locale \
+strfrom-skeleton,$(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.
-- 
2.9.4

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

* Re: [RFC] Fix float128 IFUNC relocations on ppc64le [BZ #21707]
  2017-07-05 19:21             ` [RFC] Fix float128 IFUNC relocations on ppc64le " Carlos O'Donell
@ 2017-07-08 18:46               ` Tulio Magno Quites Machado Filho
  0 siblings, 0 replies; 83+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2017-07-08 18:46 UTC (permalink / raw)
  To: Carlos O'Donell, libc-alpha; +Cc: fweimer, bergner, joseph, gftg

Carlos O'Donell <carlos@redhat.com> writes:

> On 07/05/2017 01:23 PM, Tulio Magno Quites Machado Filho wrote:
>>> On 06/27/2017 09:05 AM, Florian Weimer wrote:
>>>> On 06/27/2017 01:02 AM, Joseph Myers wrote:
>>>>> I'm seeing a testsuite regression for powerpc64le with
>>>>> build-many-glibcs.py with this patch (elf/check-localplt fails), did you
>>>>> not see that in your testing?
>>>>>
>>>>> https://sourceware.org/ml/libc-testresults/2017-q2/msg00427.html
>>>>>
>>>>> The failure is: "Extra PLT reference: libc.so: __getauxval".  As the
>>>>> __getauxval reference comes from have_ieee_hw_p in libgcc, presumably you
>>>>> need to allow that PLT reference in localplt.data with an appropriate
>>>>> comment, as it won't be readily possible to avoid it.
>>>>
>>>> The __getauxval call happens from IFUNC resolvers and violates current
>>>> guidelines regarding what can be done from IFUNC resolvers.  This is
>>>> another reason to get rid of the PLT reference.
>>>>
>>>> My IFUNC resolver enhancements are not ready for 2.26, and I plan to
>>>> wait for DJ's dl-minimal malloc improvements to land, rather than
>>>> rolling my own memory allocator to back the IFUNC resolver queue.
>>>
>>> The above isn't correct because even if you can call getauxval, it
>>> doesn't have the data to return meaningful results during relocation.
>>> This currently breaks --enable-bind-now builds on pcp64le:
>>>
>>>   https://sourceware.org/bugzilla/show_bug.cgi?id=21707
>> 
>> I agree.
>> 
>>> For the time being, we just disable --enable-bind-now, but I'd prefer a
>>> proper fix, perhaps the one suggested here:
>>>
>>>   https://sourceware.org/ml/libc-alpha/2017-06/msg01383.html
>> 
>> Unfortunately, this patch creates another issue: the thread pointer is not
>> initialized at the time of IRELA relocations in static executables.
>> 
>> The following changes solve this issue.
>
> OK to checkin with a test.
>
> You need a static program with an IFUNC resolver that touches a __thread
> variable and fails before your patch, and passes after. This is marginal
> proof that TLS is operational after your change. Have the resolver set the
> TLS variable to some value and check that value in main.

It wasn't my intention to allow writing to the TLS from an IFUNC resolver.
It was intended to enable reading from the TCB.
Writing to the TLS during IRELA relocation is still not allowed because the
initialization of thread-local variables happen after relocating all objects
in a dynamically-linked executable.

So, I adapted your test to read the address of a thread-local variable
and included tests both for statically and dynamically-linked executables
in the version 2 of the patch.

Thanks!

-- 
Tulio Magno

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

* Re: [PATCHv2] Fix float128 IFUNC relocations on ppc64le [BZ #21707]
  2017-07-08 18:31                           ` [PATCHv2] " Tulio Magno Quites Machado Filho
@ 2017-07-08 19:17                             ` Florian Weimer
  2017-07-08 23:18                               ` Tulio Magno Quites Machado Filho
  2017-07-08 19:30                             ` H.J. Lu
                                               ` (3 subsequent siblings)
  4 siblings, 1 reply; 83+ messages in thread
From: Florian Weimer @ 2017-07-08 19:17 UTC (permalink / raw)
  To: Tulio Magno Quites Machado Filho, libc-alpha; +Cc: carlos, joseph, gftg

On 07/08/2017 08:31 PM, Tulio Magno Quites Machado Filho wrote:
> Changes since version 1:
> 
>  - Added a testcase.  This is now validating both statically and
>    dynamically linked executables.
>  - Fixed an issue in the $(foreach ..) in sysdeps/powerpc/powerpc64le/Makefile.
>  - Added a comment to csu/libc-start.c
>  - Added a comment to csu/libc-tls.c
> 
> -- 8< --
> 
> The patch proposed by Peter Bergner [1] to libgc in order to fix

Typo, should be “libgcc”.

> +__thread int bar;
> +static int * bar_ptr = NULL;

No space after “*”?

> +  else {
> +    printf ("FAIL: IFUNC resolver not called once.\n");
> +    ret = 1;
> +  }
> +
> +  if (&bar == bar_ptr)
> +    printf ("PASS: Address read from IFUNC resolver is correct.\n");
> +  else {
> +    printf ("FAIL: Address read from IFUNC resolver is incorrect.\n");
> +    ret = 1;
> +  }

The “{” should be on its own line.

Thanks,
Florian

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

* Re: [PATCHv2] Fix float128 IFUNC relocations on ppc64le [BZ #21707]
  2017-07-08 18:31                           ` [PATCHv2] " Tulio Magno Quites Machado Filho
  2017-07-08 19:17                             ` Florian Weimer
@ 2017-07-08 19:30                             ` H.J. Lu
  2017-07-08 23:12                               ` Tulio Magno Quites Machado Filho
  2017-07-09 16:28                             ` [PATCHv2] Fix float128 IFUNC relocations on ppc64le [BZ #21707] Nix
                                               ` (2 subsequent siblings)
  4 siblings, 1 reply; 83+ messages in thread
From: H.J. Lu @ 2017-07-08 19:30 UTC (permalink / raw)
  To: Tulio Magno Quites Machado Filho
  Cc: GNU C Library, Florian Weimer, Carlos O'Donell,
	Joseph S. Myers, gftg

On Sat, Jul 8, 2017 at 11:31 AM, Tulio Magno Quites Machado Filho
<tuliom@linux.vnet.ibm.com> wrote:
> Changes since version 1:
>
>  - Added a testcase.  This is now validating both statically and
>    dynamically linked executables.
>  - Fixed an issue in the $(foreach ..) in sysdeps/powerpc/powerpc64le/Makefile.
>  - Added a comment to csu/libc-start.c
>  - Added a comment to csu/libc-tls.c
>
> -- 8< --
>
> The patch proposed by Peter Bergner [1] to libgc in order to fix
> [BZ #21707] adds a dependency on a symbol provided by the loader,
> forcing the loader to be linked to tests after libgcc was linked.
>
> It also requires to read the thread pointer during IRELA relocations.
>
> Tested on powerpc, powerpc64, powerpc64le, s390x and x86_64.
>
> [1] https://sourceware.org/ml/libc-alpha/2017-06/msg01383.html
>
> 2017-07-08  Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>
>
>         [BZ #21707]
>         * csu/libc-start.c (LIBC_START_MAIN): Perform IREL{,A}
>         relocations after initializing the TCB on statically linked
>         executables..
>         * csu/libc-tls.c (__libc_setup_tls): Add a comment about
>         IREL{,A} relocations.
>         * elf/Makefile (tests-static-normal): Add tst-tlsifunc-static.
>         (tests): Add tst-tlsifunc.
>         * elf/tst-tlsifunc.c: New file.
>         * elf/tst-tlsifunc-static.c: Likewise.
>         * sysdeps/powerpc/powerpc64le/Makefile (f128-loader-link): New
>         variable.
>         [$(subdir) = math] (test-float128% test-ifloat128%): Force
>         linking to the loader after linking to libgcc.
>         [$(subdir) = wcsmbs stdlib] (bug-strtod bug-strtod2 bug-strtod2)
>         (tst-strtod-round tst-wcstod-round tst-strtod6 tst-strrom)
>         (tst-strfrom-locale strfrom-skeleton): Likewise.
> ---
>  csu/libc-start.c                     | 11 +++---
>  csu/libc-tls.c                       |  2 ++
>  elf/Makefile                         |  5 +--
>  elf/tst-tlsifunc-static.c            | 19 +++++++++++
>  elf/tst-tlsifunc.c                   | 66 ++++++++++++++++++++++++++++++++++++
>  sysdeps/powerpc/powerpc64le/Makefile | 10 ++++++
>  6 files changed, 107 insertions(+), 6 deletions(-)
>  create mode 100644 elf/tst-tlsifunc-static.c
>  create mode 100644 elf/tst-tlsifunc.c
>
> diff --git a/csu/libc-start.c b/csu/libc-start.c
> index c2dd159..84b7f99 100644
> --- a/csu/libc-start.c
> +++ b/csu/libc-start.c
> @@ -188,12 +188,15 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
>
>    ARCH_INIT_CPU_FEATURES ();
>
> -  /* Perform IREL{,A} relocations.  */
> -  apply_irel ();
> -
>    /* The stack guard goes into the TCB, so initialize it early.  */
>    __libc_setup_tls ();
>
> +  /* Perform IREL{,A} relocations.
> +     Note: the relocations must happen after TLS initialization so that
> +     IFUNC resolvers can benefit from thread-local storage, e.g. powerpc's
> +     hwcap and platform fields available in the TCB.  */
> +  apply_irel ();
> +
>    /* Set up the stack checker's canary.  */
>    uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (_dl_random);
>  # ifdef THREAD_SET_STACK_GUARD
> @@ -224,7 +227,7 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
>    __pointer_chk_guard_local = pointer_chk_guard;
>  # endif
>
> -#endif
> +#endif /* !SHARED  */
>

apply_irel should be called as early as possible.  If it doesn't work for
powerpc, we should provide a generic version and powerpc can
provide a special one,  I oppose changing the order in generic file.

H.J.

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

* Re: [PATCHv2] Fix float128 IFUNC relocations on ppc64le [BZ #21707]
  2017-07-08 19:30                             ` H.J. Lu
@ 2017-07-08 23:12                               ` Tulio Magno Quites Machado Filho
  2017-07-08 23:59                                 ` H.J. Lu
  0 siblings, 1 reply; 83+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2017-07-08 23:12 UTC (permalink / raw)
  To: H.J. Lu
  Cc: GNU C Library, Florian Weimer, Carlos O'Donell,
	Joseph S. Myers, gftg

"H.J. Lu" <hjl.tools@gmail.com> writes:

> On Sat, Jul 8, 2017 at 11:31 AM, Tulio Magno Quites Machado Filho
> <tuliom@linux.vnet.ibm.com> wrote:
>> Changes since version 1:
>>
>>  - Added a testcase.  This is now validating both statically and
>>    dynamically linked executables.
>>  - Fixed an issue in the $(foreach ..) in sysdeps/powerpc/powerpc64le/Makefile.
>>  - Added a comment to csu/libc-start.c
>>  - Added a comment to csu/libc-tls.c
>>
>> -- 8< --
>>
>> The patch proposed by Peter Bergner [1] to libgc in order to fix
>> [BZ #21707] adds a dependency on a symbol provided by the loader,
>> forcing the loader to be linked to tests after libgcc was linked.
>>
>> It also requires to read the thread pointer during IRELA relocations.
>>
>> Tested on powerpc, powerpc64, powerpc64le, s390x and x86_64.
>>
>> [1] https://sourceware.org/ml/libc-alpha/2017-06/msg01383.html
>>
>> 2017-07-08  Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>
>>
>>         [BZ #21707]
>>         * csu/libc-start.c (LIBC_START_MAIN): Perform IREL{,A}
>>         relocations after initializing the TCB on statically linked
>>         executables..
>>         * csu/libc-tls.c (__libc_setup_tls): Add a comment about
>>         IREL{,A} relocations.
>>         * elf/Makefile (tests-static-normal): Add tst-tlsifunc-static.
>>         (tests): Add tst-tlsifunc.
>>         * elf/tst-tlsifunc.c: New file.
>>         * elf/tst-tlsifunc-static.c: Likewise.
>>         * sysdeps/powerpc/powerpc64le/Makefile (f128-loader-link): New
>>         variable.
>>         [$(subdir) = math] (test-float128% test-ifloat128%): Force
>>         linking to the loader after linking to libgcc.
>>         [$(subdir) = wcsmbs stdlib] (bug-strtod bug-strtod2 bug-strtod2)
>>         (tst-strtod-round tst-wcstod-round tst-strtod6 tst-strrom)
>>         (tst-strfrom-locale strfrom-skeleton): Likewise.
>> ---
>>  csu/libc-start.c                     | 11 +++---
>>  csu/libc-tls.c                       |  2 ++
>>  elf/Makefile                         |  5 +--
>>  elf/tst-tlsifunc-static.c            | 19 +++++++++++
>>  elf/tst-tlsifunc.c                   | 66 ++++++++++++++++++++++++++++++++++++
>>  sysdeps/powerpc/powerpc64le/Makefile | 10 ++++++
>>  6 files changed, 107 insertions(+), 6 deletions(-)
>>  create mode 100644 elf/tst-tlsifunc-static.c
>>  create mode 100644 elf/tst-tlsifunc.c
>>
>> diff --git a/csu/libc-start.c b/csu/libc-start.c
>> index c2dd159..84b7f99 100644
>> --- a/csu/libc-start.c
>> +++ b/csu/libc-start.c
>> @@ -188,12 +188,15 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
>>
>>    ARCH_INIT_CPU_FEATURES ();
>>
>> -  /* Perform IREL{,A} relocations.  */
>> -  apply_irel ();
>> -
>>    /* The stack guard goes into the TCB, so initialize it early.  */
>>    __libc_setup_tls ();
>>
>> +  /* Perform IREL{,A} relocations.
>> +     Note: the relocations must happen after TLS initialization so that
>> +     IFUNC resolvers can benefit from thread-local storage, e.g. powerpc's
>> +     hwcap and platform fields available in the TCB.  */
>> +  apply_irel ();
>> +
>>    /* Set up the stack checker's canary.  */
>>    uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (_dl_random);
>>  # ifdef THREAD_SET_STACK_GUARD
>> @@ -224,7 +227,7 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
>>    __pointer_chk_guard_local = pointer_chk_guard;
>>  # endif
>>
>> -#endif
>> +#endif /* !SHARED  */
>>
>
> apply_irel should be called as early as possible.

Why?  Could you elaborate, please?

-- 
Tulio Magno

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

* Re: [PATCHv2] Fix float128 IFUNC relocations on ppc64le [BZ #21707]
  2017-07-08 19:17                             ` Florian Weimer
@ 2017-07-08 23:18                               ` Tulio Magno Quites Machado Filho
  0 siblings, 0 replies; 83+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2017-07-08 23:18 UTC (permalink / raw)
  To: Florian Weimer, libc-alpha

Florian Weimer <fweimer@redhat.com> writes:

> On 07/08/2017 08:31 PM, Tulio Magno Quites Machado Filho wrote:
>> Changes since version 1:
>> 
>>  - Added a testcase.  This is now validating both statically and
>>    dynamically linked executables.
>>  - Fixed an issue in the $(foreach ..) in sysdeps/powerpc/powerpc64le/Makefile.
>>  - Added a comment to csu/libc-start.c
>>  - Added a comment to csu/libc-tls.c
>> 
>> -- 8< --
>> 
>> The patch proposed by Peter Bergner [1] to libgc in order to fix
>
> Typo, should be “libgcc”.

Fixed locally.

>> +__thread int bar;
>> +static int * bar_ptr = NULL;
>
> No space after “*”?

Fixed.

>> +  else {
>> +    printf ("FAIL: IFUNC resolver not called once.\n");
>> +    ret = 1;
>> +  }
>> +
>> +  if (&bar == bar_ptr)
>> +    printf ("PASS: Address read from IFUNC resolver is correct.\n");
>> +  else {
>> +    printf ("FAIL: Address read from IFUNC resolver is incorrect.\n");
>> +    ret = 1;
>> +  }
>
> The “{” should be on its own line.

Fixed both cases and re-indented the lines:

  else
    {
      printf ("FAIL: IFUNC resolver not called once.\n");
      ret = 1;
    }

  if (&bar == bar_ptr)
    printf ("PASS: Address read from IFUNC resolver is correct.\n");
  else
    {
      printf ("FAIL: Address read from IFUNC resolver is incorrect.\n");
      ret = 1;
    }

Thanks!

-- 
Tulio Magno

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

* Re: [PATCHv2] Fix float128 IFUNC relocations on ppc64le [BZ #21707]
  2017-07-08 23:12                               ` Tulio Magno Quites Machado Filho
@ 2017-07-08 23:59                                 ` H.J. Lu
  2017-07-09 14:59                                   ` [PATCH, 2.27] x86-64: Use IFUNC memcpy and mempcpy in libc.a H.J. Lu
  0 siblings, 1 reply; 83+ messages in thread
From: H.J. Lu @ 2017-07-08 23:59 UTC (permalink / raw)
  To: Tulio Magno Quites Machado Filho
  Cc: GNU C Library, Florian Weimer, Carlos O'Donell,
	Joseph S. Myers, gftg

On Sat, Jul 8, 2017 at 4:12 PM, Tulio Magno Quites Machado Filho
<tuliom@linux.vnet.ibm.com> wrote:
> "H.J. Lu" <hjl.tools@gmail.com> writes:
>
>> On Sat, Jul 8, 2017 at 11:31 AM, Tulio Magno Quites Machado Filho
>> <tuliom@linux.vnet.ibm.com> wrote:
>>> Changes since version 1:
>>>
>>>  - Added a testcase.  This is now validating both statically and
>>>    dynamically linked executables.
>>>  - Fixed an issue in the $(foreach ..) in sysdeps/powerpc/powerpc64le/Makefile.
>>>  - Added a comment to csu/libc-start.c
>>>  - Added a comment to csu/libc-tls.c
>>>
>>> -- 8< --
>>>
>>> The patch proposed by Peter Bergner [1] to libgc in order to fix
>>> [BZ #21707] adds a dependency on a symbol provided by the loader,
>>> forcing the loader to be linked to tests after libgcc was linked.
>>>
>>> It also requires to read the thread pointer during IRELA relocations.
>>>
>>> Tested on powerpc, powerpc64, powerpc64le, s390x and x86_64.
>>>
>>> [1] https://sourceware.org/ml/libc-alpha/2017-06/msg01383.html
>>>
>>> 2017-07-08  Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>
>>>
>>>         [BZ #21707]
>>>         * csu/libc-start.c (LIBC_START_MAIN): Perform IREL{,A}
>>>         relocations after initializing the TCB on statically linked
>>>         executables..
>>>         * csu/libc-tls.c (__libc_setup_tls): Add a comment about
>>>         IREL{,A} relocations.
>>>         * elf/Makefile (tests-static-normal): Add tst-tlsifunc-static.
>>>         (tests): Add tst-tlsifunc.
>>>         * elf/tst-tlsifunc.c: New file.
>>>         * elf/tst-tlsifunc-static.c: Likewise.
>>>         * sysdeps/powerpc/powerpc64le/Makefile (f128-loader-link): New
>>>         variable.
>>>         [$(subdir) = math] (test-float128% test-ifloat128%): Force
>>>         linking to the loader after linking to libgcc.
>>>         [$(subdir) = wcsmbs stdlib] (bug-strtod bug-strtod2 bug-strtod2)
>>>         (tst-strtod-round tst-wcstod-round tst-strtod6 tst-strrom)
>>>         (tst-strfrom-locale strfrom-skeleton): Likewise.
>>> ---
>>>  csu/libc-start.c                     | 11 +++---
>>>  csu/libc-tls.c                       |  2 ++
>>>  elf/Makefile                         |  5 +--
>>>  elf/tst-tlsifunc-static.c            | 19 +++++++++++
>>>  elf/tst-tlsifunc.c                   | 66 ++++++++++++++++++++++++++++++++++++
>>>  sysdeps/powerpc/powerpc64le/Makefile | 10 ++++++
>>>  6 files changed, 107 insertions(+), 6 deletions(-)
>>>  create mode 100644 elf/tst-tlsifunc-static.c
>>>  create mode 100644 elf/tst-tlsifunc.c
>>>
>>> diff --git a/csu/libc-start.c b/csu/libc-start.c
>>> index c2dd159..84b7f99 100644
>>> --- a/csu/libc-start.c
>>> +++ b/csu/libc-start.c
>>> @@ -188,12 +188,15 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
>>>
>>>    ARCH_INIT_CPU_FEATURES ();
>>>
>>> -  /* Perform IREL{,A} relocations.  */
>>> -  apply_irel ();
>>> -
>>>    /* The stack guard goes into the TCB, so initialize it early.  */
>>>    __libc_setup_tls ();
>>>
>>> +  /* Perform IREL{,A} relocations.
>>> +     Note: the relocations must happen after TLS initialization so that
>>> +     IFUNC resolvers can benefit from thread-local storage, e.g. powerpc's
>>> +     hwcap and platform fields available in the TCB.  */
>>> +  apply_irel ();
>>> +
>>>    /* Set up the stack checker's canary.  */
>>>    uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (_dl_random);
>>>  # ifdef THREAD_SET_STACK_GUARD
>>> @@ -224,7 +227,7 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
>>>    __pointer_chk_guard_local = pointer_chk_guard;
>>>  # endif
>>>
>>> -#endif
>>> +#endif /* !SHARED  */
>>>
>>
>> apply_irel should be called as early as possible.
>
> Why?  Could you elaborate, please?
>

To use IFUNC in static executables, apply_irel should be called before
any functions with IFUNC implementation is called.  At the moment,
a few functions are used before apply_irel is called.  To address it,
we can move apply_irel forward.  Call it later makes it worse.


H.J.

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

* [PATCH, 2.27] x86-64: Use IFUNC memcpy and mempcpy in libc.a
  2017-07-08 23:59                                 ` H.J. Lu
@ 2017-07-09 14:59                                   ` H.J. Lu
  2017-08-02 15:53                                     ` H.J. Lu
  0 siblings, 1 reply; 83+ messages in thread
From: H.J. Lu @ 2017-07-09 14:59 UTC (permalink / raw)
  To: Tulio Magno Quites Machado Filho, GNU C Library, Florian Weimer,
	Carlos O'Donell, Joseph S. Myers, gftg

On Sat, Jul 08, 2017 at 04:59:04PM -0700, H.J. Lu wrote:
> On Sat, Jul 8, 2017 at 4:12 PM, Tulio Magno Quites Machado Filho
> <tuliom@linux.vnet.ibm.com> wrote:
> > "H.J. Lu" <hjl.tools@gmail.com> writes:
> >
> >> On Sat, Jul 8, 2017 at 11:31 AM, Tulio Magno Quites Machado Filho
> >> <tuliom@linux.vnet.ibm.com> wrote:
> >>> Changes since version 1:
> >>>
> >>>  - Added a testcase.  This is now validating both statically and
> >>>    dynamically linked executables.
> >>>  - Fixed an issue in the $(foreach ..) in sysdeps/powerpc/powerpc64le/Makefile.
> >>>  - Added a comment to csu/libc-start.c
> >>>  - Added a comment to csu/libc-tls.c
> >>>
> >>> -- 8< --
> >>>
> >>> The patch proposed by Peter Bergner [1] to libgc in order to fix
> >>> [BZ #21707] adds a dependency on a symbol provided by the loader,
> >>> forcing the loader to be linked to tests after libgcc was linked.
> >>>
> >>> It also requires to read the thread pointer during IRELA relocations.
> >>>
> >>> Tested on powerpc, powerpc64, powerpc64le, s390x and x86_64.
> >>>
> >>> [1] https://sourceware.org/ml/libc-alpha/2017-06/msg01383.html
> >>>
> >>> 2017-07-08  Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>
> >>>
> >>>         [BZ #21707]
> >>>         * csu/libc-start.c (LIBC_START_MAIN): Perform IREL{,A}
> >>>         relocations after initializing the TCB on statically linked
> >>>         executables..
> >>>         * csu/libc-tls.c (__libc_setup_tls): Add a comment about
> >>>         IREL{,A} relocations.
> >>>         * elf/Makefile (tests-static-normal): Add tst-tlsifunc-static.
> >>>         (tests): Add tst-tlsifunc.
> >>>         * elf/tst-tlsifunc.c: New file.
> >>>         * elf/tst-tlsifunc-static.c: Likewise.
> >>>         * sysdeps/powerpc/powerpc64le/Makefile (f128-loader-link): New
> >>>         variable.
> >>>         [$(subdir) = math] (test-float128% test-ifloat128%): Force
> >>>         linking to the loader after linking to libgcc.
> >>>         [$(subdir) = wcsmbs stdlib] (bug-strtod bug-strtod2 bug-strtod2)
> >>>         (tst-strtod-round tst-wcstod-round tst-strtod6 tst-strrom)
> >>>         (tst-strfrom-locale strfrom-skeleton): Likewise.
> >>> ---
> >>>  csu/libc-start.c                     | 11 +++---
> >>>  csu/libc-tls.c                       |  2 ++
> >>>  elf/Makefile                         |  5 +--
> >>>  elf/tst-tlsifunc-static.c            | 19 +++++++++++
> >>>  elf/tst-tlsifunc.c                   | 66 ++++++++++++++++++++++++++++++++++++
> >>>  sysdeps/powerpc/powerpc64le/Makefile | 10 ++++++
> >>>  6 files changed, 107 insertions(+), 6 deletions(-)
> >>>  create mode 100644 elf/tst-tlsifunc-static.c
> >>>  create mode 100644 elf/tst-tlsifunc.c
> >>>
> >>> diff --git a/csu/libc-start.c b/csu/libc-start.c
> >>> index c2dd159..84b7f99 100644
> >>> --- a/csu/libc-start.c
> >>> +++ b/csu/libc-start.c
> >>> @@ -188,12 +188,15 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
> >>>
> >>>    ARCH_INIT_CPU_FEATURES ();
> >>>
> >>> -  /* Perform IREL{,A} relocations.  */
> >>> -  apply_irel ();
> >>> -
> >>>    /* The stack guard goes into the TCB, so initialize it early.  */
> >>>    __libc_setup_tls ();
> >>>
> >>> +  /* Perform IREL{,A} relocations.
> >>> +     Note: the relocations must happen after TLS initialization so that
> >>> +     IFUNC resolvers can benefit from thread-local storage, e.g. powerpc's
> >>> +     hwcap and platform fields available in the TCB.  */
> >>> +  apply_irel ();
> >>> +
> >>>    /* Set up the stack checker's canary.  */
> >>>    uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (_dl_random);
> >>>  # ifdef THREAD_SET_STACK_GUARD
> >>> @@ -224,7 +227,7 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
> >>>    __pointer_chk_guard_local = pointer_chk_guard;
> >>>  # endif
> >>>
> >>> -#endif
> >>> +#endif /* !SHARED  */
> >>>
> >>
> >> apply_irel should be called as early as possible.
> >
> > Why?  Could you elaborate, please?
> >
> 
> To use IFUNC in static executables, apply_irel should be called before
> any functions with IFUNC implementation is called.  At the moment,
> a few functions are used before apply_irel is called.  To address it,
> we can move apply_irel forward.  Call it later makes it worse.
> 

FYI, this is the patch I am submitting for glibc 2.27.

H.J.
---
Since apply_irel is called before memcpy and mempcpy are called, we
an use IFUNC memcpy and mempcpy in libc.a.

	* sysdeps/x86_64/memmove.S (MEMCPY_SYMBOL): Don't check SHARED.
	(MEMPCPY_SYMBOL): Likewise.
	* sysdeps/x86_64/multiarch/memcpy-ssse3-back.S: Also include
	in libc.a.
	* sysdeps/x86_64/multiarch/memcpy-ssse3.S: Likewise.
	* sysdeps/x86_64/multiarch/memmove-avx512-no-vzeroupper.S:
	Likewise.
	* sysdeps/x86_64/multiarch/memcpy.c: Also include in libc.a.
	(__hidden_ver1): Don't use in libc.a.
	* sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S
	(__mempcpy): Don't create a weak alias in libc.a.
	* sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S: Don't
	check SHARED.
	* sysdeps/x86_64/multiarch/mempcpy.c: Also include in libc.a.
	(__hidden_ver1): Don't use in libc.a.
---
 sysdeps/x86_64/memmove.S                           |  4 ++--
 sysdeps/x86_64/multiarch/memcpy-ssse3-back.S       |  5 +----
 sysdeps/x86_64/multiarch/memcpy-ssse3.S            |  5 +----
 sysdeps/x86_64/multiarch/memcpy.c                  |  8 ++++----
 .../multiarch/memmove-avx512-no-vzeroupper.S       |  6 ------
 .../x86_64/multiarch/memmove-sse2-unaligned-erms.S |  4 +---
 .../x86_64/multiarch/memmove-vec-unaligned-erms.S  | 22 +++++-----------------
 sysdeps/x86_64/multiarch/mempcpy.c                 |  8 ++++----
 8 files changed, 18 insertions(+), 44 deletions(-)

diff --git a/sysdeps/x86_64/memmove.S b/sysdeps/x86_64/memmove.S
index 5bbae990..24efe83 100644
--- a/sysdeps/x86_64/memmove.S
+++ b/sysdeps/x86_64/memmove.S
@@ -29,7 +29,7 @@
 #define SECTION(p)		p
 
 #ifdef USE_MULTIARCH
-# if !defined SHARED || !IS_IN (libc)
+# if !IS_IN (libc)
 #  define MEMCPY_SYMBOL(p,s)		memcpy
 # endif
 #else
@@ -39,7 +39,7 @@
 #  define MEMCPY_SYMBOL(p,s)		memcpy
 # endif
 #endif
-#if !defined SHARED || !defined USE_MULTIARCH || !IS_IN (libc)
+#if !defined USE_MULTIARCH || !IS_IN (libc)
 # define MEMPCPY_SYMBOL(p,s)		__mempcpy
 #endif
 #ifndef MEMMOVE_SYMBOL
diff --git a/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S b/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S
index 4e060a2..ce53993 100644
--- a/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S
+++ b/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S
@@ -19,10 +19,7 @@
 
 #include <sysdep.h>
 
-#if IS_IN (libc) \
-    && (defined SHARED \
-        || defined USE_AS_MEMMOVE \
-	|| !defined USE_MULTIARCH)
+#if IS_IN (libc)
 
 #include "asm-syntax.h"
 
diff --git a/sysdeps/x86_64/multiarch/memcpy-ssse3.S b/sysdeps/x86_64/multiarch/memcpy-ssse3.S
index f3ea52a..0ac4c21 100644
--- a/sysdeps/x86_64/multiarch/memcpy-ssse3.S
+++ b/sysdeps/x86_64/multiarch/memcpy-ssse3.S
@@ -19,10 +19,7 @@
 
 #include <sysdep.h>
 
-#if IS_IN (libc) \
-    && (defined SHARED \
-        || defined USE_AS_MEMMOVE \
-	|| !defined USE_MULTIARCH)
+#if IS_IN (libc)
 
 #include "asm-syntax.h"
 
diff --git a/sysdeps/x86_64/multiarch/memcpy.c b/sysdeps/x86_64/multiarch/memcpy.c
index 6a2d353..273bc61 100644
--- a/sysdeps/x86_64/multiarch/memcpy.c
+++ b/sysdeps/x86_64/multiarch/memcpy.c
@@ -17,10 +17,8 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-/* Define multiple versions only for the definition in lib and for
-   DSO.  In static binaries we need memcpy before the initialization
-   happened.  */
-#if defined SHARED && IS_IN (libc)
+/* Define multiple versions only for the definition in libc.  */
+#if IS_IN (libc)
 # define memcpy __redirect_memcpy
 # include <string.h>
 # undef memcpy
@@ -31,8 +29,10 @@
 libc_ifunc_redirected (__redirect_memcpy, __new_memcpy,
 		       IFUNC_SELECTOR ());
 
+# ifdef SHARED
 __hidden_ver1 (__new_memcpy, __GI_memcpy, __redirect_memcpy)
   __attribute__ ((visibility ("hidden")));
+# endif
 
 # include <shlib-compat.h>
 versioned_symbol (libc, __new_memcpy, memcpy, GLIBC_2_14);
diff --git a/sysdeps/x86_64/multiarch/memmove-avx512-no-vzeroupper.S b/sysdeps/x86_64/multiarch/memmove-avx512-no-vzeroupper.S
index f3ef105..7ca365a 100644
--- a/sysdeps/x86_64/multiarch/memmove-avx512-no-vzeroupper.S
+++ b/sysdeps/x86_64/multiarch/memmove-avx512-no-vzeroupper.S
@@ -23,7 +23,6 @@
 # include "asm-syntax.h"
 
 	.section .text.avx512,"ax",@progbits
-# if defined SHARED && !defined USE_AS_MEMPCPY && !defined USE_AS_MEMMOVE
 ENTRY (__mempcpy_chk_avx512_no_vzeroupper)
 	cmpq	%rdx, %rcx
 	jb	HIDDEN_JUMPTARGET (__chk_fail)
@@ -34,14 +33,11 @@ ENTRY (__mempcpy_avx512_no_vzeroupper)
 	addq	%rdx, %rax
 	jmp	L(start)
 END (__mempcpy_avx512_no_vzeroupper)
-# endif
 
-# ifdef SHARED
 ENTRY (__memmove_chk_avx512_no_vzeroupper)
 	cmpq	%rdx, %rcx
 	jb	HIDDEN_JUMPTARGET (__chk_fail)
 END (__memmove_chk_avx512_no_vzeroupper)
-# endif
 
 ENTRY (__memmove_avx512_no_vzeroupper)
 	mov	%rdi, %rax
@@ -413,8 +409,6 @@ L(gobble_256bytes_nt_loop_bkw):
 	jmp	L(check)
 END (__memmove_avx512_no_vzeroupper)
 
-# ifdef SHARED
 strong_alias (__memmove_avx512_no_vzeroupper, __memcpy_avx512_no_vzeroupper)
 strong_alias (__memmove_chk_avx512_no_vzeroupper, __memcpy_chk_avx512_no_vzeroupper)
-# endif
 #endif
diff --git a/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S b/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S
index 743064b..cfb604d 100644
--- a/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S
+++ b/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S
@@ -18,9 +18,7 @@
 
 #if IS_IN (libc)
 # define MEMMOVE_SYMBOL(p,s)	p##_sse2_##s
-#endif
-
-#if !defined SHARED || !IS_IN (libc)
+#else
 weak_alias (__mempcpy, mempcpy)
 #endif
 
diff --git a/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S b/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S
index d694e8b..0fad756 100644
--- a/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S
+++ b/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S
@@ -105,22 +105,20 @@
 #endif
 
 	.section SECTION(.text),"ax",@progbits
-#if defined SHARED && IS_IN (libc)
+#if IS_IN (libc)
 ENTRY (MEMMOVE_CHK_SYMBOL (__mempcpy_chk, unaligned))
 	cmpq	%rdx, %rcx
 	jb	HIDDEN_JUMPTARGET (__chk_fail)
 END (MEMMOVE_CHK_SYMBOL (__mempcpy_chk, unaligned))
 #endif
 
-#if VEC_SIZE == 16 || defined SHARED
 ENTRY (MEMPCPY_SYMBOL (__mempcpy, unaligned))
 	movq	%rdi, %rax
 	addq	%rdx, %rax
 	jmp	L(start)
 END (MEMPCPY_SYMBOL (__mempcpy, unaligned))
-#endif
 
-#if defined SHARED && IS_IN (libc)
+#if IS_IN (libc)
 ENTRY (MEMMOVE_CHK_SYMBOL (__memmove_chk, unaligned))
 	cmpq	%rdx, %rcx
 	jb	HIDDEN_JUMPTARGET (__chk_fail)
@@ -151,7 +149,6 @@ L(nop):
 END (MEMMOVE_SYMBOL (__memmove, unaligned))
 
 # if VEC_SIZE == 16
-#  if defined SHARED
 ENTRY (__mempcpy_chk_erms)
 	cmpq	%rdx, %rcx
 	jb	HIDDEN_JUMPTARGET (__chk_fail)
@@ -163,7 +160,6 @@ ENTRY (__mempcpy_erms)
 	addq	%rdx, %rax
 	jmp	L(start_movsb)
 END (__mempcpy_erms)
-#  endif
 
 ENTRY (__memmove_chk_erms)
 	cmpq	%rdx, %rcx
@@ -193,13 +189,10 @@ L(movsb_backward):
 	cld
 	ret
 END (__memmove_erms)
-#  if defined SHARED
 strong_alias (__memmove_erms, __memcpy_erms)
 strong_alias (__memmove_chk_erms, __memcpy_chk_erms)
-#  endif
 # endif
 
-# ifdef SHARED
 ENTRY (MEMMOVE_CHK_SYMBOL (__mempcpy_chk, unaligned_erms))
 	cmpq	%rdx, %rcx
 	jb	HIDDEN_JUMPTARGET (__chk_fail)
@@ -215,7 +208,6 @@ ENTRY (MEMMOVE_CHK_SYMBOL (__memmove_chk, unaligned_erms))
 	cmpq	%rdx, %rcx
 	jb	HIDDEN_JUMPTARGET (__chk_fail)
 END (MEMMOVE_CHK_SYMBOL (__memmove_chk, unaligned_erms))
-# endif
 
 ENTRY (MEMMOVE_SYMBOL (__memmove, unaligned_erms))
 	movq	%rdi, %rax
@@ -546,19 +538,15 @@ L(loop_large_backward):
 #endif
 END (MEMMOVE_SYMBOL (__memmove, unaligned_erms))
 
-#ifdef SHARED
-# if IS_IN (libc)
-#  ifdef USE_MULTIARCH
+#if IS_IN (libc)
+# ifdef USE_MULTIARCH
 strong_alias (MEMMOVE_SYMBOL (__memmove, unaligned_erms),
 	      MEMMOVE_SYMBOL (__memcpy, unaligned_erms))
 strong_alias (MEMMOVE_SYMBOL (__memmove_chk, unaligned_erms),
 	      MEMMOVE_SYMBOL (__memcpy_chk, unaligned_erms))
-#  endif
+# endif
 strong_alias (MEMMOVE_CHK_SYMBOL (__memmove_chk, unaligned),
 	      MEMMOVE_CHK_SYMBOL (__memcpy_chk, unaligned))
-# endif
 #endif
-#if VEC_SIZE == 16 || defined SHARED
 strong_alias (MEMMOVE_SYMBOL (__memmove, unaligned),
 	      MEMCPY_SYMBOL (__memcpy, unaligned))
-#endif
diff --git a/sysdeps/x86_64/multiarch/mempcpy.c b/sysdeps/x86_64/multiarch/mempcpy.c
index e627b00..49e9896 100644
--- a/sysdeps/x86_64/multiarch/mempcpy.c
+++ b/sysdeps/x86_64/multiarch/mempcpy.c
@@ -17,10 +17,8 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-/* Define multiple versions only for the definition in lib and for
-   DSO.  In static binaries we need mempcpy before the initialization
-   happened.  */
-#if defined SHARED && IS_IN (libc)
+/* Define multiple versions only for the definition in libc.  */
+#if IS_IN (libc)
 # define mempcpy __redirect_mempcpy
 # define __mempcpy __redirect___mempcpy
 # define NO_MEMPCPY_STPCPY_REDIRECT
@@ -35,8 +33,10 @@
 libc_ifunc_redirected (__redirect_mempcpy, __mempcpy, IFUNC_SELECTOR ());
 
 weak_alias (__mempcpy, mempcpy)
+# ifdef SHARED
 __hidden_ver1 (__mempcpy, __GI___mempcpy, __redirect___mempcpy)
   __attribute__ ((visibility ("hidden")));
 __hidden_ver1 (mempcpy, __GI_mempcpy, __redirect_mempcpy)
   __attribute__ ((visibility ("hidden")));
+# endif
 #endif
-- 
2.9.4

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

* Re: [PATCHv2] Fix float128 IFUNC relocations on ppc64le [BZ #21707]
  2017-07-08 18:31                           ` [PATCHv2] " Tulio Magno Quites Machado Filho
  2017-07-08 19:17                             ` Florian Weimer
  2017-07-08 19:30                             ` H.J. Lu
@ 2017-07-09 16:28                             ` Nix
  2017-07-10 15:28                               ` Tulio Magno Quites Machado Filho
  2017-07-10 10:09                             ` Joseph Myers
  2017-07-10 15:04                             ` Carlos O'Donell
  4 siblings, 1 reply; 83+ messages in thread
From: Nix @ 2017-07-09 16:28 UTC (permalink / raw)
  To: Tulio Magno Quites Machado Filho
  Cc: libc-alpha, fweimer, carlos, joseph, gftg

On 8 Jul 2017, Tulio Magno Quites Machado Filho said this:

> diff --git a/csu/libc-start.c b/csu/libc-start.c
> index c2dd159..84b7f99 100644
> --- a/csu/libc-start.c
> +++ b/csu/libc-start.c
> @@ -188,12 +188,15 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
>  
>    ARCH_INIT_CPU_FEATURES ();
>  
> -  /* Perform IREL{,A} relocations.  */
> -  apply_irel ();
> -
>    /* The stack guard goes into the TCB, so initialize it early.  */
>    __libc_setup_tls ();
>  
> +  /* Perform IREL{,A} relocations.
> +     Note: the relocations must happen after TLS initialization so that
> +     IFUNC resolvers can benefit from thread-local storage, e.g. powerpc's
> +     hwcap and platform fields available in the TCB.  */
> +  apply_irel ();
> +
>    /* Set up the stack checker's canary.  */
>    uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (_dl_random);
>  # ifdef THREAD_SET_STACK_GUARD

Note: I originally moved this above __libc_setup_tls() so that IFUNCs
could be stack-protected on statically-linked applications, but
subsequently found that this caused trouble with dynamically-linked
programs, so ended up de-protecting all the IFUNC resolvers anyway.
(See commit 003a27e8195470f470f4d9384ca70d4e9fc8bd1b.)

If this passes make check with --enable-stack-protector=all, I'm happy
with it.

-- 
NULL && (void)

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

* Re: [PATCHv2] Fix float128 IFUNC relocations on ppc64le [BZ #21707]
  2017-07-08 18:31                           ` [PATCHv2] " Tulio Magno Quites Machado Filho
                                               ` (2 preceding siblings ...)
  2017-07-09 16:28                             ` [PATCHv2] Fix float128 IFUNC relocations on ppc64le [BZ #21707] Nix
@ 2017-07-10 10:09                             ` Joseph Myers
  2017-07-10 18:02                               ` Tulio Magno Quites Machado Filho
  2017-07-10 15:04                             ` Carlos O'Donell
  4 siblings, 1 reply; 83+ messages in thread
From: Joseph Myers @ 2017-07-10 10:09 UTC (permalink / raw)
  To: Tulio Magno Quites Machado Filho; +Cc: libc-alpha, fweimer, carlos, gftg

On Sat, 8 Jul 2017, Tulio Magno Quites Machado Filho wrote:

> diff --git a/elf/Makefile b/elf/Makefile
> index 201b328..b603e89 100644
> --- a/elf/Makefile
> +++ b/elf/Makefile
> @@ -147,12 +147,13 @@ tests-static-normal := tst-leaks1-static tst-array1-static tst-array5-static \
>  	       tst-tlsalign-static tst-tlsalign-extern-static \
>  	       tst-linkall-static tst-env-setuid tst-env-setuid-tunables
>  tests-static-internal := tst-tls1-static tst-tls2-static \
> -	       tst-ptrguard1-static tst-stackguard1-static
> +	       tst-ptrguard1-static tst-stackguard1-static \
> +	       tst-tlsifunc-static
>  
>  tests := tst-tls9 tst-leaks1 \
>  	tst-array1 tst-array2 tst-array3 tst-array4 tst-array5 \
>  	tst-auxv
> -tests-internal := tst-tls1 tst-tls2 $(tests-static-internal)
> +tests-internal := tst-tls1 tst-tls2 tst-tlsifunc $(tests-static-internal)

I'd expect these additions to need to be conditional on IFUNC support 
(ifneq (no,$(multi-arch)), as already used in elf/Makefile) to avoid 
problems on architectures lacking such support.

-- 
Joseph S. Myers
joseph@codesourcery.com

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

* Re: [PATCH] powerpc64le: Iterate over all object suffixes when appending -mfloat128
  2017-06-28  0:54     ` [PATCH] powerpc64le: Iterate over all object suffixes when appending -mfloat128 Gabriel F. T. Gomes
  2017-06-28  7:19       ` Andreas Schwab
  2017-06-28  7:22       ` Andreas Schwab
@ 2017-07-10 10:22       ` Joseph Myers
  2017-07-11 14:07         ` Tulio Magno Quites Machado Filho
  2 siblings, 1 reply; 83+ messages in thread
From: Joseph Myers @ 2017-07-10 10:22 UTC (permalink / raw)
  To: Gabriel F. T. Gomes; +Cc: schwab, libc-alpha

On Tue, 27 Jun 2017, Gabriel F. T. Gomes wrote:

> 	* sysdeps/powerpc/powerpc64le/Makefile: Use $(all-object-suffixes)
> 	to iterate over all possible object suffixes.

This appears not to have been committed.  Thus powerpc64le-linux-gnu build 
is broken with build-many-glibcs.py now that uses --enable-profile.

-- 
Joseph S. Myers
joseph@codesourcery.com

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

* Re: [PATCHv2] Fix float128 IFUNC relocations on ppc64le [BZ #21707]
  2017-07-08 18:31                           ` [PATCHv2] " Tulio Magno Quites Machado Filho
                                               ` (3 preceding siblings ...)
  2017-07-10 10:09                             ` Joseph Myers
@ 2017-07-10 15:04                             ` Carlos O'Donell
  2017-07-12 18:59                               ` [PATCHv3] powerpc: Fix float128 IFUNC relocations " Tulio Magno Quites Machado Filho
  4 siblings, 1 reply; 83+ messages in thread
From: Carlos O'Donell @ 2017-07-10 15:04 UTC (permalink / raw)
  To: Tulio Magno Quites Machado Filho, libc-alpha
  Cc: fweimer, joseph, gftg, H.J. Lu

On 07/08/2017 02:31 PM, Tulio Magno Quites Machado Filho wrote:
> Changes since version 1:
> 
>  - Added a testcase.  This is now validating both statically and
>    dynamically linked executables.
>  - Fixed an issue in the $(foreach ..) in sysdeps/powerpc/powerpc64le/Makefile.
>  - Added a comment to csu/libc-start.c
>  - Added a comment to csu/libc-tls.c
My initial audit showed that no early loader usage of memcpy and memmove would
call IFUNC resolvers, and so this change was safe.

However, HJ is opposed to this change specifically for this reason because he
has optimizations to do what we said is not happening e.g. early IFUNC usage.

Therefore I see no way forward but to split the IFUNC initialization into two
pieces, something like:

setup_irel();

__libc_setup_tls ();

apply_irel();

Where ppc64le can do *everything* in setup_irel(); and nothing in apply_irel();
as a *temporary* bandaid for glibc 2.26.

In the future we need to discuss in more detail exactly what IFUNC's are allowed
and not allowed to do, and if we argue that they can use TLS then we will need
to adjust our infrastructure to setup TLS before the IFUNCs are used, and that
may mean doing a bootstrap/reapplication of IFUNC relocations along the same
vein as Florian was working on during the last release cycle.

We should all acknowledge the following:

* It is important that static and dynamic applications behaviour is as close to
  similar as possible. This reduces problems for developers.

* We should strive to reduce per-architecture IFUNC differences since this again
  is a complication for developers.

With these things in mind we know that making this fix for ppc64le is a temporary
solution that we need to backout once we have better IFUNC infrastructure.

-- 
Cheers,
Carlos.

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

* Re: [PATCHv2] Fix float128 IFUNC relocations on ppc64le [BZ #21707]
  2017-07-09 16:28                             ` [PATCHv2] Fix float128 IFUNC relocations on ppc64le [BZ #21707] Nix
@ 2017-07-10 15:28                               ` Tulio Magno Quites Machado Filho
  2017-07-10 15:37                                 ` Nix
  0 siblings, 1 reply; 83+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2017-07-10 15:28 UTC (permalink / raw)
  To: Nix; +Cc: libc-alpha, fweimer, carlos, joseph, gftg

Nix <nix@esperi.org.uk> writes:

> On 8 Jul 2017, Tulio Magno Quites Machado Filho said this:
>
>> diff --git a/csu/libc-start.c b/csu/libc-start.c
>> index c2dd159..84b7f99 100644
>> --- a/csu/libc-start.c
>> +++ b/csu/libc-start.c
>> @@ -188,12 +188,15 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
>>  
>>    ARCH_INIT_CPU_FEATURES ();
>>  
>> -  /* Perform IREL{,A} relocations.  */
>> -  apply_irel ();
>> -
>>    /* The stack guard goes into the TCB, so initialize it early.  */
>>    __libc_setup_tls ();
>>  
>> +  /* Perform IREL{,A} relocations.
>> +     Note: the relocations must happen after TLS initialization so that
>> +     IFUNC resolvers can benefit from thread-local storage, e.g. powerpc's
>> +     hwcap and platform fields available in the TCB.  */
>> +  apply_irel ();
>> +
>>    /* Set up the stack checker's canary.  */
>>    uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (_dl_random);
>>  # ifdef THREAD_SET_STACK_GUARD
>
> Note: I originally moved this above __libc_setup_tls() so that IFUNCs
> could be stack-protected on statically-linked applications, but
> subsequently found that this caused trouble with dynamically-linked
> programs, so ended up de-protecting all the IFUNC resolvers anyway.
> (See commit 003a27e8195470f470f4d9384ca70d4e9fc8bd1b.)
>
> If this passes make check with --enable-stack-protector=all, I'm happy
> with it.

Tested and confirmed no new failures with --enable-stack-protector=all.

By the way, I noticed 2 unrelated failures:
https://sourceware.org/bugzilla/show_bug.cgi?id=21744
https://sourceware.org/bugzilla/show_bug.cgi?id=21745

-- 
Tulio Magno

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

* Re: [PATCHv2] Fix float128 IFUNC relocations on ppc64le [BZ #21707]
  2017-07-10 15:28                               ` Tulio Magno Quites Machado Filho
@ 2017-07-10 15:37                                 ` Nix
  2017-07-12 13:45                                   ` Nix
  0 siblings, 1 reply; 83+ messages in thread
From: Nix @ 2017-07-10 15:37 UTC (permalink / raw)
  To: Tulio Magno Quites Machado Filho
  Cc: libc-alpha, fweimer, carlos, joseph, gftg, adhemerval.zanella

On 10 Jul 2017, Tulio Magno Quites Machado Filho stated:
> By the way, I noticed 2 unrelated failures:
> https://sourceware.org/bugzilla/show_bug.cgi?id=21744

I'll have a look at this one soon, if nobody else gets to it. I wonder
if it's spotting an actual overflow? (You'd expect more output in that
case. So it's probably something else that needs stack-protection
disabling.)

> https://sourceware.org/bugzilla/show_bug.cgi?id=21745

__stack_chk_fail should be a hidden symbol in libc.so. Commit
524a8ef2ad76af8ac049293d993a1856b0d888fb is apparently not working for
you: I wonder why not? (Adhermerval Cc:ed because he knows more about
what's going on here than I do. :) )

-- 
NULL && (void)

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

* Re: [PATCHv2] Fix float128 IFUNC relocations on ppc64le [BZ #21707]
  2017-07-10 10:09                             ` Joseph Myers
@ 2017-07-10 18:02                               ` Tulio Magno Quites Machado Filho
  0 siblings, 0 replies; 83+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2017-07-10 18:02 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-alpha

Joseph Myers <joseph@codesourcery.com> writes:

> On Sat, 8 Jul 2017, Tulio Magno Quites Machado Filho wrote:
>
>> diff --git a/elf/Makefile b/elf/Makefile
>> index 201b328..b603e89 100644
>> --- a/elf/Makefile
>> +++ b/elf/Makefile
>> @@ -147,12 +147,13 @@ tests-static-normal := tst-leaks1-static tst-array1-static tst-array5-static \
>>  	       tst-tlsalign-static tst-tlsalign-extern-static \
>>  	       tst-linkall-static tst-env-setuid tst-env-setuid-tunables
>>  tests-static-internal := tst-tls1-static tst-tls2-static \
>> -	       tst-ptrguard1-static tst-stackguard1-static
>> +	       tst-ptrguard1-static tst-stackguard1-static \
>> +	       tst-tlsifunc-static
>>  
>>  tests := tst-tls9 tst-leaks1 \
>>  	tst-array1 tst-array2 tst-array3 tst-array4 tst-array5 \
>>  	tst-auxv
>> -tests-internal := tst-tls1 tst-tls2 $(tests-static-internal)
>> +tests-internal := tst-tls1 tst-tls2 tst-tlsifunc $(tests-static-internal)
>
> I'd expect these additions to need to be conditional on IFUNC support 
> (ifneq (no,$(multi-arch)), as already used in elf/Makefile) to avoid 
> problems on architectures lacking such support.

Fixed.  Thanks!

-- 
Tulio Magno

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

* Re: ppc64le: getauxval call from IFUNC resolver
  2017-07-07 22:19           ` ppc64le: getauxval call from IFUNC resolver Peter Bergner
@ 2017-07-10 19:59             ` Peter Bergner
  2017-07-20 14:48               ` Peter Bergner
  0 siblings, 1 reply; 83+ messages in thread
From: Peter Bergner @ 2017-07-10 19:59 UTC (permalink / raw)
  To: Florian Weimer
  Cc: Joseph Myers, Tulio Magno Quites Machado Filho,
	Gabriel F. T. Gomes, libc-alpha, Bill Schmidt

On 7/7/17 5:19 PM, Peter Bergner wrote:
> On 7/4/17 1:37 AM, Florian Weimer wrote:
>> For the time being, we just disable --enable-bind-now, but I'd prefer a
>> proper fix, perhaps the one suggested here:
>>
>>   https://sourceware.org/ml/libc-alpha/2017-06/msg01383.html
> 
> I just committed this to GCC trunk today.  I still need to bootstrap
> and regtest the backports to GCC 7 and GCC 6.

The trunk patch applied to GCC 7 and GCC 6 cleanly/no fuzz and it
bootstrapped and regtested with no regressions on powerpc64le-linux
as well as on powerpc64-linux and running the testsuite in both 32-bit
and 64-bit modes.

The backports were approved today, but I am leaving on vacation today,
returning on the 19th, so I will not commit the backports until I
return.  If there is a large need to have the backports committed before
I return, please work with Tulio to find someone on our GCC team to
commit the patch and watch for fallout.

Peter



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

* Re: [PATCH] powerpc64le: Iterate over all object suffixes when appending -mfloat128
  2017-07-10 10:22       ` Joseph Myers
@ 2017-07-11 14:07         ` Tulio Magno Quites Machado Filho
  2017-07-11 17:21           ` Gabriel F. T. Gomes
  0 siblings, 1 reply; 83+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2017-07-11 14:07 UTC (permalink / raw)
  To: Gabriel F. T. Gomes; +Cc: schwab, libc-alpha, Joseph Myers

Joseph Myers <joseph@codesourcery.com> writes:

> On Tue, 27 Jun 2017, Gabriel F. T. Gomes wrote:
>
>> 	* sysdeps/powerpc/powerpc64le/Makefile: Use $(all-object-suffixes)
>> 	to iterate over all possible object suffixes.
>
> This appears not to have been committed.  Thus powerpc64le-linux-gnu build 
> is broken with build-many-glibcs.py now that uses --enable-profile.

LGTM without the __getauxval part that Andreas already pointed out.

-- 
Tulio Magno

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

* Re: [PATCH] powerpc64le: Iterate over all object suffixes when appending -mfloat128
  2017-07-11 14:07         ` Tulio Magno Quites Machado Filho
@ 2017-07-11 17:21           ` Gabriel F. T. Gomes
  0 siblings, 0 replies; 83+ messages in thread
From: Gabriel F. T. Gomes @ 2017-07-11 17:21 UTC (permalink / raw)
  To: Tulio Magno Quites Machado Filho; +Cc: schwab, libc-alpha, Joseph Myers

On Tue, 11 Jul 2017 11:07:32 -0300
"Tulio Magno Quites Machado Filho" <tuliom@linux.vnet.ibm.com> wrote:
> 
> LGTM without the __getauxval part that Andreas already pointed out.
 
Now committed with this change and with a comment about the use of
sysdep-CFLAGS (also suggested by Andreas).  Thank you.

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

* Re: [PATCHv2] Fix float128 IFUNC relocations on ppc64le [BZ #21707]
  2017-07-10 15:37                                 ` Nix
@ 2017-07-12 13:45                                   ` Nix
  0 siblings, 0 replies; 83+ messages in thread
From: Nix @ 2017-07-12 13:45 UTC (permalink / raw)
  To: Tulio Magno Quites Machado Filho
  Cc: libc-alpha, fweimer, carlos, joseph, gftg, adhemerval.zanella

On 10 Jul 2017, nix@esperi.org.uk verbalised:

> On 10 Jul 2017, Tulio Magno Quites Machado Filho stated:
>> By the way, I noticed 2 unrelated failures:
>> https://sourceware.org/bugzilla/show_bug.cgi?id=21744
>
> I'll have a look at this one soon, if nobody else gets to it. I wonder
> if it's spotting an actual overflow? (You'd expect more output in that
> case. So it's probably something else that needs stack-protection
> disabling.)

... so as I reported in the bug, this does not happen for me with
today's master on x86_64, even with tunables explicitly enabled. A
backtrace would be nice (among other things, it might help me reproduce
it, as well as fix it).

-- 
NULL && (void)

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

* [PATCHv3] powerpc: Fix float128 IFUNC relocations [BZ #21707]
  2017-07-10 15:04                             ` Carlos O'Donell
@ 2017-07-12 18:59                               ` Tulio Magno Quites Machado Filho
  2017-07-12 19:42                                 ` H.J. Lu
  2017-07-12 20:58                                 ` Carlos O'Donell
  0 siblings, 2 replies; 83+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2017-07-12 18:59 UTC (permalink / raw)
  To: libc-alpha; +Cc: hjl.tools, fweimer, carlos, joseph, gftg

Changes since version 2:

 - Fixed a typo in the commit message.
 - Fixed coding style in the test.
 - Adapted csu/libc-start.c to let IREL relocation happen before or
   after TLS initialization, depending on the target architecture.
 - Removed comment from csu/libc-tls.c added in version 1.
 - Limited the execution of the tests to multi-arch builds.
 - Moved the tests to sysdeps/powerpc.

Changes since version 1:

 - Added a testcase.  This is now validating both statically and
   dynamically linked executables.
 - Fixed an issue in the $(foreach ..) in sysdeps/powerpc/powerpc64le/Makefile.
 - Added a comment to csu/libc-start.c
 - Added a comment to csu/libc-tls.c

-- 8< --

The patch proposed by Peter Bergner [1] to libgcc in order to fix
[BZ #21707] adds a dependency on a symbol provided by the loader,
forcing the loader to be linked to tests after libgcc was linked.

It also requires to read the thread pointer during IRELA relocations.

Tested on powerpc, powerpc64, powerpc64le, s390x and x86_64.

[1] https://sourceware.org/ml/libc-alpha/2017-06/msg01383.html

2017-07-12  Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>

	[BZ #21707]
	* csu/libc-start.c (ARCH_APPLY_IREL, ARCH_SETUP_IREL): New macros.
	(LIBC_START_MAIN): Perform IREL{,A} relocations before or after
	initializing the TCB on statically linked executables.  That's a
	per-architecture definition.
	* sysdeps/powerpc/Makefile:
	[$(subdir) = elf && $(multi-arch) != no] (tests-static-internal): Add tst-tlsifunc-static.
	[$(subdir) = elf && $(multi-arch) != no && $(build-shared) == yes]
	(tests-internal): Add tst-tlsifunc.
	* sysdeps/powerpc/tst-tlsifunc.c: New file.
	* sysdeps/powerpc/tst-tlsifunc-static.c: Likewise.
	* sysdeps/powerpc/powerpc64le/Makefile (f128-loader-link): New
	variable.
	[$(subdir) = math] (test-float128% test-ifloat128%): Force
	linking to the loader after linking to libgcc.
	[$(subdir) = wcsmbs || $(subdir) = stdlib] (bug-strtod bug-strtod2)
	(bug-strtod2 tst-strtod-round tst-wcstod-round tst-strtod6 tst-strrom)
	(tst-strfrom-locale strfrom-skeleton): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/libc-start.c [!SHARED]: Define
	ARCH_APPLY_IREL().
---
 csu/libc-start.c                             | 22 ++++++++-
 sysdeps/powerpc/Makefile                     | 10 +++-
 sysdeps/powerpc/powerpc64le/Makefile         | 10 ++++
 sysdeps/powerpc/tst-tlsifunc-static.c        | 19 ++++++++
 sysdeps/powerpc/tst-tlsifunc.c               | 68 ++++++++++++++++++++++++++++
 sysdeps/unix/sysv/linux/powerpc/libc-start.c |  2 +
 6 files changed, 128 insertions(+), 3 deletions(-)
 create mode 100644 sysdeps/powerpc/tst-tlsifunc-static.c
 create mode 100644 sysdeps/powerpc/tst-tlsifunc.c

diff --git a/csu/libc-start.c b/csu/libc-start.c
index c2dd159..a2d1391 100644
--- a/csu/libc-start.c
+++ b/csu/libc-start.c
@@ -108,6 +108,19 @@ apply_irel (void)
 # define ARCH_INIT_CPU_FEATURES()
 #endif
 
+#if defined ARCH_APPLY_IREL && defined ARCH_SETUP_IREL
+# error "Defining both ARCH_APPLY_IREL and ARCH_SETUP_IREL is prohibited."
+#endif
+
+#ifdef ARCH_APPLY_IREL
+# define ARCH_SETUP_IREL()
+#elif defined ARCH_SETUP_IREL
+# define ARCH_APPLY_IREL()
+#else
+# define ARCH_SETUP_IREL() apply_irel ()
+# define ARCH_APPLY_IREL()
+#endif
+
 STATIC int LIBC_START_MAIN (int (*main) (int, char **, char **
 					 MAIN_AUXVEC_DECL),
 			    int argc,
@@ -189,11 +202,16 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
   ARCH_INIT_CPU_FEATURES ();
 
   /* Perform IREL{,A} relocations.  */
-  apply_irel ();
+  ARCH_SETUP_IREL ();
 
   /* The stack guard goes into the TCB, so initialize it early.  */
   __libc_setup_tls ();
 
+  /* In some architectures, IREL{,A} relocations happen after TLS setup in
+     order to let IFUNC resolvers benefit from TCB information, e.g. powerpc's
+     hwcap and platform fields available in the TCB.  */
+  ARCH_APPLY_IREL ();
+
   /* Set up the stack checker's canary.  */
   uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (_dl_random);
 # ifdef THREAD_SET_STACK_GUARD
@@ -224,7 +242,7 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
   __pointer_chk_guard_local = pointer_chk_guard;
 # endif
 
-#endif
+#endif /* !SHARED  */
 
   /* Register the destructor of the dynamic linker if there is any.  */
   if (__glibc_likely (rtld_fini != NULL))
diff --git a/sysdeps/powerpc/Makefile b/sysdeps/powerpc/Makefile
index e03a202..0d9206b 100644
--- a/sysdeps/powerpc/Makefile
+++ b/sysdeps/powerpc/Makefile
@@ -11,7 +11,15 @@ sysdep-rtld-routines += dl-machine hwcapinfo
 # Don't optimize GD tls sequence to LE.
 LDFLAGS-tst-tlsopt-powerpc += -Wl,--no-tls-optimize
 tests += tst-tlsopt-powerpc
-endif
+
+ifneq (no,$(multi-arch))
+tests-static += tst-tlsifunc-static
+tests-internal += tst-tlsifunc-static
+ifeq (yes,$(build-shared))
+tests-internal += tst-tlsifunc
+endif # build-shared
+endif # multi-arch
+endif # subdir = elf
 
 ifeq ($(subdir),setjmp)
 ifeq (yes,$(build-shared))
diff --git a/sysdeps/powerpc/powerpc64le/Makefile b/sysdeps/powerpc/powerpc64le/Makefile
index bd8a82d..90a41b1 100644
--- a/sysdeps/powerpc/powerpc64le/Makefile
+++ b/sysdeps/powerpc/powerpc64le/Makefile
@@ -1,6 +1,11 @@
 # When building float128 we need to ensure -mfloat128 is
 # passed to all such object files.
 
+# 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 = $(as-needed) $(elf-objpfx)ld.so $(no-as-needed)
+
 ifeq ($(subdir),math)
 # sqrtf128 requires emulation before POWER9.
 CPPFLAGS += -I../soft-fp
@@ -11,6 +16,8 @@ $(foreach suf,$(all-object-suffixes),%f128_r$(suf)): CFLAGS += -mfloat128
 $(objpfx)test-float128%.o $(objpfx)test-float128%.os: CFLAGS += -mfloat128
 $(objpfx)test-ifloat128%.o $(objpfx)test-ifloat128%.os: CFLAGS += -mfloat128
 CFLAGS-libm-test-support-float128.c += -mfloat128
+$(objpfx)test-float128% $(objpfx)test-ifloat128%: \
+  gnulib-tests += $(f128-loader-link)
 endif
 
 # Append flags to string <-> _Float128 routines.
@@ -24,6 +31,9 @@ CFLAGS-tst-strtod6.c += -mfloat128
 CFLAGS-tst-strfrom.c += -mfloat128
 CFLAGS-tst-strfrom-locale.c += -mfloat128
 CFLAGS-strfrom-skeleton.c += -mfloat128
+$(foreach test,bug-strtod bug-strtod2 bug-strtod2 tst-strtod-round \
+tst-wcstod-round tst-strtod6 tst-strrom tst-strfrom-locale \
+strfrom-skeleton,$(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.
diff --git a/sysdeps/powerpc/tst-tlsifunc-static.c b/sysdeps/powerpc/tst-tlsifunc-static.c
new file mode 100644
index 0000000..e5313af
--- /dev/null
+++ b/sysdeps/powerpc/tst-tlsifunc-static.c
@@ -0,0 +1,19 @@
+/* Test if an executable can read from the TLS from an STT_GNU_IFUNC resolver.
+   Copyright (C) 2017 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
+   <http://www.gnu.org/licenses/>.  */
+
+#include "tst-tlsifunc.c"
diff --git a/sysdeps/powerpc/tst-tlsifunc.c b/sysdeps/powerpc/tst-tlsifunc.c
new file mode 100644
index 0000000..6d6af8a
--- /dev/null
+++ b/sysdeps/powerpc/tst-tlsifunc.c
@@ -0,0 +1,68 @@
+/* Test if an executable can read from the TLS from an STT_GNU_IFUNC resolver.
+   Copyright (C) 2017 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
+   <http://www.gnu.org/licenses/>.  */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <libc-symbols.h>
+#include <tls-macros.h>
+
+__thread int bar;
+static int *bar_ptr = NULL;
+
+int foo (void);
+
+void
+init_foo (void)
+{
+  bar_ptr = TLS_GD (bar);
+}
+
+int
+my_foo (void)
+{
+  printf ("&bar = %p and bar_ptr = %p.\n", &bar, bar_ptr);
+  return bar_ptr != NULL;
+}
+
+__ifunc (foo, foo, my_foo, void, init_foo);
+
+static int
+do_test (void)
+{
+  int ret = 0;
+
+  if (foo ())
+    printf ("PASS: IFUNC resolver called once.\n");
+  else
+    {
+      printf ("FAIL: IFUNC resolver not called once.\n");
+      ret = 1;
+    }
+
+  if (&bar == bar_ptr)
+    printf ("PASS: Address read from IFUNC resolver is correct.\n");
+  else
+    {
+      printf ("FAIL: Address read from IFUNC resolver is incorrect.\n");
+      ret = 1;
+    }
+
+  return ret;
+}
+
+#include <support/test-driver.c>
diff --git a/sysdeps/unix/sysv/linux/powerpc/libc-start.c b/sysdeps/unix/sysv/linux/powerpc/libc-start.c
index ad036c1..dc2df3c 100644
--- a/sysdeps/unix/sysv/linux/powerpc/libc-start.c
+++ b/sysdeps/unix/sysv/linux/powerpc/libc-start.c
@@ -22,6 +22,8 @@
 
 #ifndef SHARED
 #include <hwcapinfo.h>
+static void apply_irel (void);
+# define ARCH_APPLY_IREL() apply_irel ()
 #endif
 
 int __cache_line_size attribute_hidden;
-- 
2.9.4

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

* Re: [PATCHv3] powerpc: Fix float128 IFUNC relocations [BZ #21707]
  2017-07-12 18:59                               ` [PATCHv3] powerpc: Fix float128 IFUNC relocations " Tulio Magno Quites Machado Filho
@ 2017-07-12 19:42                                 ` H.J. Lu
  2017-07-12 20:58                                 ` Carlos O'Donell
  1 sibling, 0 replies; 83+ messages in thread
From: H.J. Lu @ 2017-07-12 19:42 UTC (permalink / raw)
  To: Tulio Magno Quites Machado Filho
  Cc: GNU C Library, Florian Weimer, Carlos O'Donell,
	Joseph S. Myers, gftg

On Wed, Jul 12, 2017 at 11:59 AM, Tulio Magno Quites Machado Filho
<tuliom@linux.vnet.ibm.com> wrote:
> Changes since version 2:
>
>  - Fixed a typo in the commit message.
>  - Fixed coding style in the test.
>  - Adapted csu/libc-start.c to let IREL relocation happen before or
>    after TLS initialization, depending on the target architecture.
>  - Removed comment from csu/libc-tls.c added in version 1.
>  - Limited the execution of the tests to multi-arch builds.
>  - Moved the tests to sysdeps/powerpc.
>
> Changes since version 1:
>
>  - Added a testcase.  This is now validating both statically and
>    dynamically linked executables.
>  - Fixed an issue in the $(foreach ..) in sysdeps/powerpc/powerpc64le/Makefile.
>  - Added a comment to csu/libc-start.c
>  - Added a comment to csu/libc-tls.c
>
> -- 8< --
>
> The patch proposed by Peter Bergner [1] to libgcc in order to fix
> [BZ #21707] adds a dependency on a symbol provided by the loader,
> forcing the loader to be linked to tests after libgcc was linked.
>
> It also requires to read the thread pointer during IRELA relocations.
>
> Tested on powerpc, powerpc64, powerpc64le, s390x and x86_64.
>
> [1] https://sourceware.org/ml/libc-alpha/2017-06/msg01383.html
>
> 2017-07-12  Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>
>
>         [BZ #21707]
>         * csu/libc-start.c (ARCH_APPLY_IREL, ARCH_SETUP_IREL): New macros.
>         (LIBC_START_MAIN): Perform IREL{,A} relocations before or after
>         initializing the TCB on statically linked executables.  That's a
>         per-architecture definition.
>         * sysdeps/powerpc/Makefile:
>         [$(subdir) = elf && $(multi-arch) != no] (tests-static-internal): Add tst-tlsifunc-static.
>         [$(subdir) = elf && $(multi-arch) != no && $(build-shared) == yes]
>         (tests-internal): Add tst-tlsifunc.
>         * sysdeps/powerpc/tst-tlsifunc.c: New file.
>         * sysdeps/powerpc/tst-tlsifunc-static.c: Likewise.
>         * sysdeps/powerpc/powerpc64le/Makefile (f128-loader-link): New
>         variable.
>         [$(subdir) = math] (test-float128% test-ifloat128%): Force
>         linking to the loader after linking to libgcc.
>         [$(subdir) = wcsmbs || $(subdir) = stdlib] (bug-strtod bug-strtod2)
>         (bug-strtod2 tst-strtod-round tst-wcstod-round tst-strtod6 tst-strrom)
>         (tst-strfrom-locale strfrom-skeleton): Likewise.
>         * sysdeps/unix/sysv/linux/powerpc/libc-start.c [!SHARED]: Define
>         ARCH_APPLY_IREL().
>

It works in x86-64.

Thanks.

-- 
H.J.

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

* Re: [PATCHv3] powerpc: Fix float128 IFUNC relocations [BZ #21707]
  2017-07-12 18:59                               ` [PATCHv3] powerpc: Fix float128 IFUNC relocations " Tulio Magno Quites Machado Filho
  2017-07-12 19:42                                 ` H.J. Lu
@ 2017-07-12 20:58                                 ` Carlos O'Donell
  2017-07-13 14:29                                   ` Tulio Magno Quites Machado Filho
  1 sibling, 1 reply; 83+ messages in thread
From: Carlos O'Donell @ 2017-07-12 20:58 UTC (permalink / raw)
  To: Tulio Magno Quites Machado Filho, libc-alpha
  Cc: hjl.tools, fweimer, joseph, gftg

On 07/12/2017 02:59 PM, Tulio Magno Quites Machado Filho wrote:
> Changes since version 2:
> 
>  - Fixed a typo in the commit message.
>  - Fixed coding style in the test.
>  - Adapted csu/libc-start.c to let IREL relocation happen before or
>    after TLS initialization, depending on the target architecture.
>  - Removed comment from csu/libc-tls.c added in version 1.
>  - Limited the execution of the tests to multi-arch builds.
>  - Moved the tests to sysdeps/powerpc.

Thanks for making this work for other arches that want IFUNC for use
during TLS setup.

I would like to point out that I think Intel's requirements are going
to be unique here to glibc, I don't want to allow IFUNCs in general
to run before TLS is setup, but because glibc can do so, is going to
be special. My design idea is that IFUNC resolvers need to allow TLS
usage.

> Changes since version 1:
> 
>  - Added a testcase.  This is now validating both statically and
>    dynamically linked executables.
>  - Fixed an issue in the $(foreach ..) in sysdeps/powerpc/powerpc64le/Makefile.
>  - Added a comment to csu/libc-start.c
>  - Added a comment to csu/libc-tls.c
> 
> -- 8< --
> 
> The patch proposed by Peter Bergner [1] to libgcc in order to fix
> [BZ #21707] adds a dependency on a symbol provided by the loader,
> forcing the loader to be linked to tests after libgcc was linked.
> 
> It also requires to read the thread pointer during IRELA relocations.
> 
> Tested on powerpc, powerpc64, powerpc64le, s390x and x86_64.
> 
> [1] https://sourceware.org/ml/libc-alpha/2017-06/msg01383.html
> 
> 2017-07-12  Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>
> 
> 	[BZ #21707]
> 	* csu/libc-start.c (ARCH_APPLY_IREL, ARCH_SETUP_IREL): New macros.
> 	(LIBC_START_MAIN): Perform IREL{,A} relocations before or after
> 	initializing the TCB on statically linked executables.  That's a
> 	per-architecture definition.
> 	* sysdeps/powerpc/Makefile:
> 	[$(subdir) = elf && $(multi-arch) != no] (tests-static-internal): Add tst-tlsifunc-static.
> 	[$(subdir) = elf && $(multi-arch) != no && $(build-shared) == yes]
> 	(tests-internal): Add tst-tlsifunc.
> 	* sysdeps/powerpc/tst-tlsifunc.c: New file.
> 	* sysdeps/powerpc/tst-tlsifunc-static.c: Likewise.
> 	* sysdeps/powerpc/powerpc64le/Makefile (f128-loader-link): New
> 	variable.
> 	[$(subdir) = math] (test-float128% test-ifloat128%): Force
> 	linking to the loader after linking to libgcc.
> 	[$(subdir) = wcsmbs || $(subdir) = stdlib] (bug-strtod bug-strtod2)
> 	(bug-strtod2 tst-strtod-round tst-wcstod-round tst-strtod6 tst-strrom)
> 	(tst-strfrom-locale strfrom-skeleton): Likewise.
> 	* sysdeps/unix/sysv/linux/powerpc/libc-start.c [!SHARED]: Define
> 	ARCH_APPLY_IREL().
> ---
>  csu/libc-start.c                             | 22 ++++++++-
>  sysdeps/powerpc/Makefile                     | 10 +++-
>  sysdeps/powerpc/powerpc64le/Makefile         | 10 ++++
>  sysdeps/powerpc/tst-tlsifunc-static.c        | 19 ++++++++
>  sysdeps/powerpc/tst-tlsifunc.c               | 68 ++++++++++++++++++++++++++++
>  sysdeps/unix/sysv/linux/powerpc/libc-start.c |  2 +
>  6 files changed, 128 insertions(+), 3 deletions(-)
>  create mode 100644 sysdeps/powerpc/tst-tlsifunc-static.c
>  create mode 100644 sysdeps/powerpc/tst-tlsifunc.c
> 
> diff --git a/csu/libc-start.c b/csu/libc-start.c
> index c2dd159..a2d1391 100644
> --- a/csu/libc-start.c
> +++ b/csu/libc-start.c
> @@ -108,6 +108,19 @@ apply_irel (void)
>  # define ARCH_INIT_CPU_FEATURES()
>  #endif
>  
> +#if defined ARCH_APPLY_IREL && defined ARCH_SETUP_IREL> +# error "Defining both ARCH_APPLY_IREL and ARCH_SETUP_IREL is prohibited."
> +#endif
> +
> +#ifdef ARCH_APPLY_IREL
> +# define ARCH_SETUP_IREL()
> +#elif defined ARCH_SETUP_IREL
> +# define ARCH_APPLY_IREL()
> +#else
> +# define ARCH_SETUP_IREL() apply_irel ()
> +# define ARCH_APPLY_IREL()
> +#endif

This is a typo-prone macro API and we want to move away from such default
defining constructs so that our -Wundef warnings apply.

We need:

* generic header:
  #define ARCH_SETUP_IREL() apply_irel ()
  #define ARCH_APPLY_IREL() ({})

* ppc64:
  #define ARCH_SETUP_IREL() ({})
  #define ARCH_APPLY_IREL() apply_irel ()

* libc-start.c includes generic header, which is overidden by ppc64 header.
  Uses ARCH_SETUP_IREL() and ARCH_APPLY_IREL() without chekcing they are
  defined. Then -Wundef provides protection against errors in port setup
  like 'ARCH_SETPU_IRELA() apply_irel ()' which is wrong.

Or something semantically equivalent using source and header files.

> +
>  STATIC int LIBC_START_MAIN (int (*main) (int, char **, char **
>  					 MAIN_AUXVEC_DECL),
>  			    int argc,
> @@ -189,11 +202,16 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
>    ARCH_INIT_CPU_FEATURES ();
>  
>    /* Perform IREL{,A} relocations.  */
> -  apply_irel ();
> +  ARCH_SETUP_IREL ();
>  
>    /* The stack guard goes into the TCB, so initialize it early.  */
>    __libc_setup_tls ();
>  
> +  /* In some architectures, IREL{,A} relocations happen after TLS setup in
> +     order to let IFUNC resolvers benefit from TCB information, e.g. powerpc's
> +     hwcap and platform fields available in the TCB.  */
> +  ARCH_APPLY_IREL ();
> +
>    /* Set up the stack checker's canary.  */
>    uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (_dl_random);
>  # ifdef THREAD_SET_STACK_GUARD
> @@ -224,7 +242,7 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
>    __pointer_chk_guard_local = pointer_chk_guard;
>  # endif
>  
> -#endif
> +#endif /* !SHARED  */
>  
>    /* Register the destructor of the dynamic linker if there is any.  */
>    if (__glibc_likely (rtld_fini != NULL))
> diff --git a/sysdeps/powerpc/Makefile b/sysdeps/powerpc/Makefile
> index e03a202..0d9206b 100644
> --- a/sysdeps/powerpc/Makefile
> +++ b/sysdeps/powerpc/Makefile
> @@ -11,7 +11,15 @@ sysdep-rtld-routines += dl-machine hwcapinfo
>  # Don't optimize GD tls sequence to LE.
>  LDFLAGS-tst-tlsopt-powerpc += -Wl,--no-tls-optimize
>  tests += tst-tlsopt-powerpc
> -endif
> +
> +ifneq (no,$(multi-arch))
> +tests-static += tst-tlsifunc-static
> +tests-internal += tst-tlsifunc-static
> +ifeq (yes,$(build-shared))
> +tests-internal += tst-tlsifunc
> +endif # build-shared
> +endif # multi-arch
> +endif # subdir = elf

OK.

>  
>  ifeq ($(subdir),setjmp)
>  ifeq (yes,$(build-shared))
> diff --git a/sysdeps/powerpc/powerpc64le/Makefile b/sysdeps/powerpc/powerpc64le/Makefile
> index bd8a82d..90a41b1 100644
> --- a/sysdeps/powerpc/powerpc64le/Makefile
> +++ b/sysdeps/powerpc/powerpc64le/Makefile
> @@ -1,6 +1,11 @@
>  # When building float128 we need to ensure -mfloat128 is
>  # passed to all such object files.
>  
> +# 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 = $(as-needed) $(elf-objpfx)ld.so $(no-as-needed)
> +

OK.

>  ifeq ($(subdir),math)
>  # sqrtf128 requires emulation before POWER9.
>  CPPFLAGS += -I../soft-fp
> @@ -11,6 +16,8 @@ $(foreach suf,$(all-object-suffixes),%f128_r$(suf)): CFLAGS += -mfloat128
>  $(objpfx)test-float128%.o $(objpfx)test-float128%.os: CFLAGS += -mfloat128
>  $(objpfx)test-ifloat128%.o $(objpfx)test-ifloat128%.os: CFLAGS += -mfloat128
>  CFLAGS-libm-test-support-float128.c += -mfloat128
> +$(objpfx)test-float128% $(objpfx)test-ifloat128%: \
> +  gnulib-tests += $(f128-loader-link)

OK.

>  endif
>  
>  # Append flags to string <-> _Float128 routines.
> @@ -24,6 +31,9 @@ CFLAGS-tst-strtod6.c += -mfloat128
>  CFLAGS-tst-strfrom.c += -mfloat128
>  CFLAGS-tst-strfrom-locale.c += -mfloat128
>  CFLAGS-strfrom-skeleton.c += -mfloat128
> +$(foreach test,bug-strtod bug-strtod2 bug-strtod2 tst-strtod-round \
> +tst-wcstod-round tst-strtod6 tst-strrom tst-strfrom-locale \
> +strfrom-skeleton,$(objpfx)$(test)): gnulib-tests += $(f128-loader-link)

OK.

>  
>  # When building glibc with support for _Float128, the powers of ten tables in
>  # fpioconst.c and in the string conversion functions must be extended.
> diff --git a/sysdeps/powerpc/tst-tlsifunc-static.c b/sysdeps/powerpc/tst-tlsifunc-static.c
> new file mode 100644
> index 0000000..e5313af
> --- /dev/null
> +++ b/sysdeps/powerpc/tst-tlsifunc-static.c
> @@ -0,0 +1,19 @@
> +/* Test if an executable can read from the TLS from an STT_GNU_IFUNC resolver.

Suggest:

Test if an STT_GNU_IFUNC resolver can read from a TLS variable.

> +   Copyright (C) 2017 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
> +   <http://www.gnu.org/licenses/>.  */
> +
> +#include "tst-tlsifunc.c"
> diff --git a/sysdeps/powerpc/tst-tlsifunc.c b/sysdeps/powerpc/tst-tlsifunc.c
> new file mode 100644
> index 0000000..6d6af8a
> --- /dev/null
> +++ b/sysdeps/powerpc/tst-tlsifunc.c
> @@ -0,0 +1,68 @@
> +/* Test if an executable can read from the TLS from an STT_GNU_IFUNC resolver.
> +   Copyright (C) 2017 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
> +   <http://www.gnu.org/licenses/>.  */
> +
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <libc-symbols.h>
> +#include <tls-macros.h>
> +
> +__thread int bar;
> +static int *bar_ptr = NULL;
> +
> +int foo (void);
> +
> +void
> +init_foo (void)
> +{
> +  bar_ptr = TLS_GD (bar);

Why don't you also test writing to the TLS variable?

> +}
> +
> +int
> +my_foo (void)
> +{
> +  printf ("&bar = %p and bar_ptr = %p.\n", &bar, bar_ptr);
> +  return bar_ptr != NULL;
> +}
> +
> +__ifunc (foo, foo, my_foo, void, init_foo);
> +
> +static int
> +do_test (void)
> +{
> +  int ret = 0;
> +
> +  if (foo ())
> +    printf ("PASS: IFUNC resolver called once.\n");
> +  else
> +    {
> +      printf ("FAIL: IFUNC resolver not called once.\n");
> +      ret = 1;
> +    }
> +
> +  if (&bar == bar_ptr)
> +    printf ("PASS: Address read from IFUNC resolver is correct.\n");
> +  else
> +    {
> +      printf ("FAIL: Address read from IFUNC resolver is incorrect.\n");
> +      ret = 1;
> +    }
> +
> +  return ret;
> +}
> +
> +#include <support/test-driver.c>
> diff --git a/sysdeps/unix/sysv/linux/powerpc/libc-start.c b/sysdeps/unix/sysv/linux/powerpc/libc-start.c
> index ad036c1..dc2df3c 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/libc-start.c
> +++ b/sysdeps/unix/sysv/linux/powerpc/libc-start.c
> @@ -22,6 +22,8 @@
>  
>  #ifndef SHARED
>  #include <hwcapinfo.h>
> +static void apply_irel (void);
> +# define ARCH_APPLY_IREL() apply_irel ()
>  #endif
>  
>  int __cache_line_size attribute_hidden;
> 


-- 
Cheers,
Carlos.

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

* Re: [PATCHv3] powerpc: Fix float128 IFUNC relocations [BZ #21707]
  2017-07-12 20:58                                 ` Carlos O'Donell
@ 2017-07-13 14:29                                   ` Tulio Magno Quites Machado Filho
  2017-07-13 14:33                                     ` Carlos O'Donell
  0 siblings, 1 reply; 83+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2017-07-13 14:29 UTC (permalink / raw)
  To: Carlos O'Donell, libc-alpha; +Cc: hjl.tools, fweimer, joseph, gftg

Carlos O'Donell <carlos@redhat.com> writes:

> On 07/12/2017 02:59 PM, Tulio Magno Quites Machado Filho wrote:
>> diff --git a/csu/libc-start.c b/csu/libc-start.c
>> index c2dd159..a2d1391 100644
>> --- a/csu/libc-start.c
>> +++ b/csu/libc-start.c
>> @@ -108,6 +108,19 @@ apply_irel (void)
>>  # define ARCH_INIT_CPU_FEATURES()
>>  #endif
>>  
>> +#if defined ARCH_APPLY_IREL && defined ARCH_SETUP_IREL> +# error "Defining both ARCH_APPLY_IREL and ARCH_SETUP_IREL is prohibited."
>> +#endif
>> +
>> +#ifdef ARCH_APPLY_IREL
>> +# define ARCH_SETUP_IREL()
>> +#elif defined ARCH_SETUP_IREL
>> +# define ARCH_APPLY_IREL()
>> +#else
>> +# define ARCH_SETUP_IREL() apply_irel ()
>> +# define ARCH_APPLY_IREL()
>> +#endif
>
> This is a typo-prone macro API and we want to move away from such default
> defining constructs so that our -Wundef warnings apply.
>
> We need:
>
> * generic header:
>   #define ARCH_SETUP_IREL() apply_irel ()
>   #define ARCH_APPLY_IREL() ({})
>
> * ppc64:
>   #define ARCH_SETUP_IREL() ({})
>   #define ARCH_APPLY_IREL() apply_irel ()
>
> * libc-start.c includes generic header, which is overidden by ppc64 header.
>   Uses ARCH_SETUP_IREL() and ARCH_APPLY_IREL() without chekcing they are
>   defined. Then -Wundef provides protection against errors in port setup
>   like 'ARCH_SETPU_IRELA() apply_irel ()' which is wrong.
>
> Or something semantically equivalent using source and header files.

OK.  I'm fixing it.

>>  # When building glibc with support for _Float128, the powers of ten tables in
>>  # fpioconst.c and in the string conversion functions must be extended.
>> diff --git a/sysdeps/powerpc/tst-tlsifunc-static.c b/sysdeps/powerpc/tst-tlsifunc-static.c
>> new file mode 100644
>> index 0000000..e5313af
>> --- /dev/null
>> +++ b/sysdeps/powerpc/tst-tlsifunc-static.c
>> @@ -0,0 +1,19 @@
>> +/* Test if an executable can read from the TLS from an STT_GNU_IFUNC resolver.
> 
> Suggest:
> 
> Test if an STT_GNU_IFUNC resolver can read from a TLS variable.

I validated my first version of the patch with a test that read from the TCB.
As this test is ppc-specific now, I can incorporate that test.

I explain why not TLS variables in the next block...

>> diff --git a/sysdeps/powerpc/tst-tlsifunc.c b/sysdeps/powerpc/tst-tlsifunc.c
>> new file mode 100644
>> index 0000000..6d6af8a
>> --- /dev/null
>> +++ b/sysdeps/powerpc/tst-tlsifunc.c
>> @@ -0,0 +1,68 @@
>> ...
>> +#include <stdio.h>
>> +#include <stdlib.h>
>> +#include <libc-symbols.h>
>> +#include <tls-macros.h>
>> +
>> +__thread int bar;
>> +static int *bar_ptr = NULL;
>> +
>> +int foo (void);
>> +
>> +void
>> +init_foo (void)
>> +{
>> +  bar_ptr = TLS_GD (bar);
>
> Why don't you also test writing to the TLS variable?

Because dynamically-linked applications initialization executes the following
steps:

 1. Initialize TLS (including the TCB)
 2. Load and relocate DSOs (including IREL)
 3. Initialize thread-local variables, i.e. calling memset

Whatever you write in step 2 will be overwritten in step 3.
Writing (or reading) to TLS variables at step 2 require even more changes,
which I don't think are appropriate at this moment and are more than ppc*
need to build with the latest libgcc.

-- 
Tulio Magno

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

* Re: [PATCHv3] powerpc: Fix float128 IFUNC relocations [BZ #21707]
  2017-07-13 14:29                                   ` Tulio Magno Quites Machado Filho
@ 2017-07-13 14:33                                     ` Carlos O'Donell
  2017-07-17 14:06                                       ` [PATCHv4] " Tulio Magno Quites Machado Filho
  0 siblings, 1 reply; 83+ messages in thread
From: Carlos O'Donell @ 2017-07-13 14:33 UTC (permalink / raw)
  To: Tulio Magno Quites Machado Filho, libc-alpha
  Cc: hjl.tools, fweimer, joseph, gftg

On 07/13/2017 10:29 AM, Tulio Magno Quites Machado Filho wrote:
>> Why don't you also test writing to the TLS variable?
> 
> Because dynamically-linked applications initialization executes the following
> steps:
> 
>  1. Initialize TLS (including the TCB)
>  2. Load and relocate DSOs (including IREL)
>  3. Initialize thread-local variables, i.e. calling memset
> 
> Whatever you write in step 2 will be overwritten in step 3.
> Writing (or reading) to TLS variables at step 2 require even more changes,
> which I don't think are appropriate at this moment and are more than ppc*
> need to build with the latest libgcc.

That makes sense. Please say that in a comment, and we can expand the test
later when we fix IFUNC behaviours.

-- 
Cheers,
Carlos.

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

* [PATCHv4] powerpc: Fix float128 IFUNC relocations [BZ #21707]
  2017-07-13 14:33                                     ` Carlos O'Donell
@ 2017-07-17 14:06                                       ` Tulio Magno Quites Machado Filho
  2017-07-17 15:46                                         ` Carlos O'Donell
  0 siblings, 1 reply; 83+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2017-07-17 14:06 UTC (permalink / raw)
  To: libc-alpha; +Cc: carlos, hjl.tools, fweimer, gftg

Changes since version 3:

 - Moved definition of ARCH_APPLY_IREL and ARCH_SETUP_IREL to
   libc-start.h.
 - Added a comment to elf/rtld.c explaining when thread-local variables
   are available.
 - Improved the test to read a TCB variable.

Changes since version 2:

 - Fixed a typo in the commit message.
 - Fixed coding style in the test.
 - Adapted csu/libc-start.c to let IREL relocation happen before or
   after TLS initialization, depending on the target architecture.
 - Removed comment from csu/libc-tls.c added in version 1.
 - Limited the execution of the tests to multi-arch builds.
 - Moved the tests to sysdeps/powerpc.

Changes since version 1:

 - Added a testcase.  This is now validating both statically and
   dynamically linked executables.
 - Fixed an issue in the $(foreach ..) in sysdeps/powerpc/powerpc64le/Makefile.
 - Added a comment to csu/libc-start.c
 - Added a comment to csu/libc-tls.c

-- 8< --

The patch proposed by Peter Bergner [1] to libgcc in order to fix
[BZ #21707] adds a dependency on a symbol provided by the loader,
forcing the loader to be linked to tests after libgcc was linked.

It also requires to read the thread pointer during IRELA relocations.

Tested on powerpc, powerpc64, powerpc64le, s390x and x86_64.

[1] https://sourceware.org/ml/libc-alpha/2017-06/msg01383.html

2017-07-17  Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>

	[BZ #21707]
	* csu/libc-start.c (LIBC_START_MAIN): Perform IREL{,A}
	relocations before or after initializing the TCB on statically
	linked executables.  That's a per-architecture definition.
	* elf/rtld.c (dl_main): Add a comment about thread-local
	variables initialization.
	* sysdeps/generic/libc-start.h: New file.  Define
	ARCH_APPLY_IREL and ARCH_SETUP_IREL.
	* sysdeps/powerpc/Makefile:
	[$(subdir) = elf && $(multi-arch) != no] (tests-static-internal): Add tst-tlsifunc-static.
	[$(subdir) = elf && $(multi-arch) != no && $(build-shared) == yes]
	(tests-internal): Add tst-tlsifunc.
	* sysdeps/powerpc/tst-tlsifunc.c: New file.
	* sysdeps/powerpc/tst-tlsifunc-static.c: Likewise.
	* sysdeps/powerpc/powerpc64le/Makefile (f128-loader-link): New
	variable.
	[$(subdir) = math] (test-float128% test-ifloat128%): Force
	linking to the loader after linking to libgcc.
	[$(subdir) = wcsmbs || $(subdir) = stdlib] (bug-strtod bug-strtod2)
	(bug-strtod2 tst-strtod-round tst-wcstod-round tst-strtod6 tst-strrom)
	(tst-strfrom-locale strfrom-skeleton): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/libc-start.h: New file.  Define
	ARCH_APPLY_IREL and ARCH_SETUP_IREL.
---
 csu/libc-start.c                             |  11 ++-
 elf/rtld.c                                   |   4 +-
 sysdeps/generic/libc-start.h                 |  26 ++++++
 sysdeps/powerpc/Makefile                     |  10 ++-
 sysdeps/powerpc/powerpc64le/Makefile         |  10 +++
 sysdeps/powerpc/tst-tlsifunc-static.c        |  19 ++++
 sysdeps/powerpc/tst-tlsifunc.c               | 129 +++++++++++++++++++++++++++
 sysdeps/unix/sysv/linux/powerpc/libc-start.h |  28 ++++++
 8 files changed, 233 insertions(+), 4 deletions(-)
 create mode 100644 sysdeps/generic/libc-start.h
 create mode 100644 sysdeps/powerpc/tst-tlsifunc-static.c
 create mode 100644 sysdeps/powerpc/tst-tlsifunc.c
 create mode 100644 sysdeps/unix/sysv/linux/powerpc/libc-start.h

diff --git a/csu/libc-start.c b/csu/libc-start.c
index c2dd159..6720617 100644
--- a/csu/libc-start.c
+++ b/csu/libc-start.c
@@ -108,6 +108,8 @@ apply_irel (void)
 # define ARCH_INIT_CPU_FEATURES()
 #endif
 
+#include <libc-start.h>
+
 STATIC int LIBC_START_MAIN (int (*main) (int, char **, char **
 					 MAIN_AUXVEC_DECL),
 			    int argc,
@@ -189,11 +191,16 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
   ARCH_INIT_CPU_FEATURES ();
 
   /* Perform IREL{,A} relocations.  */
-  apply_irel ();
+  ARCH_SETUP_IREL ();
 
   /* The stack guard goes into the TCB, so initialize it early.  */
   __libc_setup_tls ();
 
+  /* In some architectures, IREL{,A} relocations happen after TLS setup in
+     order to let IFUNC resolvers benefit from TCB information, e.g. powerpc's
+     hwcap and platform fields available in the TCB.  */
+  ARCH_APPLY_IREL ();
+
   /* Set up the stack checker's canary.  */
   uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (_dl_random);
 # ifdef THREAD_SET_STACK_GUARD
@@ -224,7 +231,7 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
   __pointer_chk_guard_local = pointer_chk_guard;
 # endif
 
-#endif
+#endif /* !SHARED  */
 
   /* Register the destructor of the dynamic linker if there is any.  */
   if (__glibc_likely (rtld_fini != NULL))
diff --git a/elf/rtld.c b/elf/rtld.c
index 65647fb..1772f89 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -2208,7 +2208,9 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
 
   /* Now that we have completed relocation, the initializer data
      for the TLS blocks has its final values and we can copy them
-     into the main thread's TLS area, which we allocated above.  */
+     into the main thread's TLS area, which we allocated above.
+     Note: thread-local variables must only be accessed after completing
+     the next step.  */
   _dl_allocate_tls_init (tcbp);
 
   /* And finally install it for the main thread.  */
diff --git a/sysdeps/generic/libc-start.h b/sysdeps/generic/libc-start.h
new file mode 100644
index 0000000..dfb1c75
--- /dev/null
+++ b/sysdeps/generic/libc-start.h
@@ -0,0 +1,26 @@
+/* Copyright (C) 2017 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
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _LIBC_START_H
+#define _LIBC_START_H
+
+#ifndef SHARED
+#define ARCH_SETUP_IREL() apply_irel ()
+#define ARCH_APPLY_IREL()
+#endif /* ! SHARED  */
+
+#endif /* _LIBC_START_H  */
diff --git a/sysdeps/powerpc/Makefile b/sysdeps/powerpc/Makefile
index e03a202..0d9206b 100644
--- a/sysdeps/powerpc/Makefile
+++ b/sysdeps/powerpc/Makefile
@@ -11,7 +11,15 @@ sysdep-rtld-routines += dl-machine hwcapinfo
 # Don't optimize GD tls sequence to LE.
 LDFLAGS-tst-tlsopt-powerpc += -Wl,--no-tls-optimize
 tests += tst-tlsopt-powerpc
-endif
+
+ifneq (no,$(multi-arch))
+tests-static += tst-tlsifunc-static
+tests-internal += tst-tlsifunc-static
+ifeq (yes,$(build-shared))
+tests-internal += tst-tlsifunc
+endif # build-shared
+endif # multi-arch
+endif # subdir = elf
 
 ifeq ($(subdir),setjmp)
 ifeq (yes,$(build-shared))
diff --git a/sysdeps/powerpc/powerpc64le/Makefile b/sysdeps/powerpc/powerpc64le/Makefile
index 2c34f38..77617b6 100644
--- a/sysdeps/powerpc/powerpc64le/Makefile
+++ b/sysdeps/powerpc/powerpc64le/Makefile
@@ -1,6 +1,11 @@
 # When building float128 we need to ensure -mfloat128 is
 # passed to all such object files.
 
+# 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 = $(as-needed) $(elf-objpfx)ld.so $(no-as-needed)
+
 ifeq ($(subdir),math)
 # sqrtf128 requires emulation before POWER9.
 CPPFLAGS += -I../soft-fp
@@ -11,6 +16,8 @@ $(foreach suf,$(all-object-suffixes),%f128_r$(suf)): CFLAGS += -mfloat128
 $(foreach suf,$(all-object-suffixes),$(objpfx)test-float128%$(suf)): CFLAGS += -mfloat128
 $(foreach suf,$(all-object-suffixes),$(objpfx)test-ifloat128%$(suf)): CFLAGS += -mfloat128
 CFLAGS-libm-test-support-float128.c += -mfloat128
+$(objpfx)test-float128% $(objpfx)test-ifloat128%: \
+  gnulib-tests += $(f128-loader-link)
 endif
 
 # Append flags to string <-> _Float128 routines.
@@ -28,6 +35,9 @@ CFLAGS-tst-strtod6.c += -mfloat128
 CFLAGS-tst-strfrom.c += -mfloat128
 CFLAGS-tst-strfrom-locale.c += -mfloat128
 CFLAGS-strfrom-skeleton.c += -mfloat128
+$(foreach test,bug-strtod bug-strtod2 bug-strtod2 tst-strtod-round \
+tst-wcstod-round tst-strtod6 tst-strrom tst-strfrom-locale \
+strfrom-skeleton,$(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
diff --git a/sysdeps/powerpc/tst-tlsifunc-static.c b/sysdeps/powerpc/tst-tlsifunc-static.c
new file mode 100644
index 0000000..e5313af
--- /dev/null
+++ b/sysdeps/powerpc/tst-tlsifunc-static.c
@@ -0,0 +1,19 @@
+/* Test if an executable can read from the TLS from an STT_GNU_IFUNC resolver.
+   Copyright (C) 2017 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
+   <http://www.gnu.org/licenses/>.  */
+
+#include "tst-tlsifunc.c"
diff --git a/sysdeps/powerpc/tst-tlsifunc.c b/sysdeps/powerpc/tst-tlsifunc.c
new file mode 100644
index 0000000..0a8bdbf
--- /dev/null
+++ b/sysdeps/powerpc/tst-tlsifunc.c
@@ -0,0 +1,129 @@
+/* Test if an executable can read from the TLS from an STT_GNU_IFUNC resolver.
+   Copyright (C) 2017 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
+   <http://www.gnu.org/licenses/>.  */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <inttypes.h>
+#include <libc-symbols.h>
+#include <tls-macros.h>
+
+__thread int bar;
+static int *bar_ptr = NULL;
+
+static uint32_t resolver_platform = 0;
+
+int foo (void);
+
+int tcb_test (void);
+
+/* Offsets copied from tcb-offsets.h.  */
+#ifdef __powerpc64__
+# define __TPREG     "r13"
+# define __ATPLATOFF -28764
+#else
+# define __TPREG     "r2"
+# define __ATPLATOFF -28724
+#endif
+
+uint32_t
+get_platform (void)
+{
+  register unsigned long tp __asm__ (__TPREG);
+  uint32_t tmp;
+
+  __asm__  ("lwz %0,%1(%2)\n"
+	    : "=r" (tmp)
+	    : "i" (__ATPLATOFF), "b" (tp));
+
+  return tmp;
+}
+
+void
+init_foo (void)
+{
+  bar_ptr = TLS_GD (bar);
+}
+
+int
+my_foo (void)
+{
+  printf ("&bar = %p and bar_ptr = %p.\n", &bar, bar_ptr);
+  return bar_ptr != NULL;
+}
+
+__ifunc (foo, foo, my_foo, void, init_foo);
+
+void
+init_tcb_test (void)
+{
+  resolver_platform = get_platform ();
+}
+
+int
+my_tcb_test (void)
+{
+  printf ("resolver_platform = 0x%"PRIx32
+	  " and current platform = 0x%"PRIx32".\n",
+	  resolver_platform, get_platform ());
+  return resolver_platform != 0;
+}
+
+__ifunc (tcb_test, tcb_test, my_tcb_test, void, init_tcb_test);
+
+static int
+do_test (void)
+{
+  int ret = 0;
+
+  if (foo ())
+    printf ("PASS: foo IFUNC resolver called once.\n");
+  else
+    {
+      printf ("FAIL: foo IFUNC resolver not called once.\n");
+      ret = 1;
+    }
+
+  if (&bar == bar_ptr)
+    printf ("PASS: bar address read from IFUNC resolver is correct.\n");
+  else
+    {
+      printf ("FAIL: bar address read from IFUNC resolver is incorrect.\n");
+      ret = 1;
+    }
+
+  if (tcb_test ())
+    printf ("PASS: tcb_test IFUNC resolver called once.\n");
+  else
+    {
+      printf ("FAIL: tcb_test IFUNC resolver not called once.\n");
+      ret = 1;
+    }
+
+  if (resolver_platform == get_platform ())
+    printf ("PASS: platform read from IFUNC resolver is correct.\n");
+  else
+    {
+      printf ("FAIL: platform read from IFUNC resolver is incorrect.\n");
+      ret = 1;
+    }
+
+  return ret;
+}
+
+#include <support/test-driver.c>
diff --git a/sysdeps/unix/sysv/linux/powerpc/libc-start.h b/sysdeps/unix/sysv/linux/powerpc/libc-start.h
new file mode 100644
index 0000000..c8af068
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/libc-start.h
@@ -0,0 +1,28 @@
+/* Copyright (C) 2017 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
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _LIBC_START_H
+#define _LIBC_START_H
+
+#ifndef SHARED
+/* IREL{,A} must happen after TCB initialization in order to allow IFUNC
+   resolvers to read TCB fields, e.g. hwcap and at_platform.  */
+#define ARCH_SETUP_IREL()
+#define ARCH_APPLY_IREL() apply_irel ()
+#endif /* ! SHARED  */
+
+#endif /* _LIBC_START_H  */
-- 
2.9.4

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

* Re: [PATCHv4] powerpc: Fix float128 IFUNC relocations [BZ #21707]
  2017-07-17 14:06                                       ` [PATCHv4] " Tulio Magno Quites Machado Filho
@ 2017-07-17 15:46                                         ` Carlos O'Donell
  2017-07-17 16:27                                           ` Tulio Magno Quites Machado Filho
  0 siblings, 1 reply; 83+ messages in thread
From: Carlos O'Donell @ 2017-07-17 15:46 UTC (permalink / raw)
  To: Tulio Magno Quites Machado Filho, libc-alpha; +Cc: hjl.tools, fweimer, gftg

On 07/17/2017 10:05 AM, Tulio Magno Quites Machado Filho wrote:
> Changes since version 3:
> 
>  - Moved definition of ARCH_APPLY_IREL and ARCH_SETUP_IREL to
>    libc-start.h.
>  - Added a comment to elf/rtld.c explaining when thread-local variables
>    are available.
>  - Improved the test to read a TCB variable.

This very is good. No ifdef's in the generic libc main startup code, which
is the way it should be. Tests are good too.

OK to checkin with additional comments added.

Thanks for working through this.

In Fedora Rawhide / Fedora 27 I went with your v1 patch to get our mass
rebuild working. However, before we release F27 I'll update to this version
and drop the intermediate v1 patch.
 
> Changes since version 2:
> 
>  - Fixed a typo in the commit message.
>  - Fixed coding style in the test.
>  - Adapted csu/libc-start.c to let IREL relocation happen before or
>    after TLS initialization, depending on the target architecture.
>  - Removed comment from csu/libc-tls.c added in version 1.
>  - Limited the execution of the tests to multi-arch builds.
>  - Moved the tests to sysdeps/powerpc.
> 
> Changes since version 1:
> 
>  - Added a testcase.  This is now validating both statically and
>    dynamically linked executables.
>  - Fixed an issue in the $(foreach ..) in sysdeps/powerpc/powerpc64le/Makefile.
>  - Added a comment to csu/libc-start.c
>  - Added a comment to csu/libc-tls.c
> 
> -- 8< --
> 
> The patch proposed by Peter Bergner [1] to libgcc in order to fix
> [BZ #21707] adds a dependency on a symbol provided by the loader,
> forcing the loader to be linked to tests after libgcc was linked.
> 
> It also requires to read the thread pointer during IRELA relocations.
> 
> Tested on powerpc, powerpc64, powerpc64le, s390x and x86_64.
> 
> [1] https://sourceware.org/ml/libc-alpha/2017-06/msg01383.html
> 
> 2017-07-17  Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>
> 
> 	[BZ #21707]
> 	* csu/libc-start.c (LIBC_START_MAIN): Perform IREL{,A}
> 	relocations before or after initializing the TCB on statically
> 	linked executables.  That's a per-architecture definition.
> 	* elf/rtld.c (dl_main): Add a comment about thread-local
> 	variables initialization.
> 	* sysdeps/generic/libc-start.h: New file.  Define
> 	ARCH_APPLY_IREL and ARCH_SETUP_IREL.
> 	* sysdeps/powerpc/Makefile:
> 	[$(subdir) = elf && $(multi-arch) != no] (tests-static-internal): Add tst-tlsifunc-static.
> 	[$(subdir) = elf && $(multi-arch) != no && $(build-shared) == yes]
> 	(tests-internal): Add tst-tlsifunc.
> 	* sysdeps/powerpc/tst-tlsifunc.c: New file.
> 	* sysdeps/powerpc/tst-tlsifunc-static.c: Likewise.
> 	* sysdeps/powerpc/powerpc64le/Makefile (f128-loader-link): New
> 	variable.
> 	[$(subdir) = math] (test-float128% test-ifloat128%): Force
> 	linking to the loader after linking to libgcc.
> 	[$(subdir) = wcsmbs || $(subdir) = stdlib] (bug-strtod bug-strtod2)
> 	(bug-strtod2 tst-strtod-round tst-wcstod-round tst-strtod6 tst-strrom)
> 	(tst-strfrom-locale strfrom-skeleton): Likewise.
> 	* sysdeps/unix/sysv/linux/powerpc/libc-start.h: New file.  Define
> 	ARCH_APPLY_IREL and ARCH_SETUP_IREL.
> ---
>  csu/libc-start.c                             |  11 ++-
>  elf/rtld.c                                   |   4 +-
>  sysdeps/generic/libc-start.h                 |  26 ++++++
>  sysdeps/powerpc/Makefile                     |  10 ++-
>  sysdeps/powerpc/powerpc64le/Makefile         |  10 +++
>  sysdeps/powerpc/tst-tlsifunc-static.c        |  19 ++++
>  sysdeps/powerpc/tst-tlsifunc.c               | 129 +++++++++++++++++++++++++++
>  sysdeps/unix/sysv/linux/powerpc/libc-start.h |  28 ++++++
>  8 files changed, 233 insertions(+), 4 deletions(-)
>  create mode 100644 sysdeps/generic/libc-start.h
>  create mode 100644 sysdeps/powerpc/tst-tlsifunc-static.c
>  create mode 100644 sysdeps/powerpc/tst-tlsifunc.c
>  create mode 100644 sysdeps/unix/sysv/linux/powerpc/libc-start.h
> 
> diff --git a/csu/libc-start.c b/csu/libc-start.c
> index c2dd159..6720617 100644
> --- a/csu/libc-start.c
> +++ b/csu/libc-start.c
> @@ -108,6 +108,8 @@ apply_irel (void)
>  # define ARCH_INIT_CPU_FEATURES()
>  #endif
>  
> +#include <libc-start.h>

OK.

> +
>  STATIC int LIBC_START_MAIN (int (*main) (int, char **, char **
>  					 MAIN_AUXVEC_DECL),
>  			    int argc,
> @@ -189,11 +191,16 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
>    ARCH_INIT_CPU_FEATURES ();
>  
>    /* Perform IREL{,A} relocations.  */
> -  apply_irel ();
> +  ARCH_SETUP_IREL ();

OK.

>  
>    /* The stack guard goes into the TCB, so initialize it early.  */
>    __libc_setup_tls ();
>  
> +  /* In some architectures, IREL{,A} relocations happen after TLS setup in
> +     order to let IFUNC resolvers benefit from TCB information, e.g. powerpc's
> +     hwcap and platform fields available in the TCB.  */
> +  ARCH_APPLY_IREL ();

OK. Nice comment.

> +
>    /* Set up the stack checker's canary.  */
>    uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (_dl_random);
>  # ifdef THREAD_SET_STACK_GUARD
> @@ -224,7 +231,7 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
>    __pointer_chk_guard_local = pointer_chk_guard;
>  # endif
>  
> -#endif
> +#endif /* !SHARED  */

OK.

>  
>    /* Register the destructor of the dynamic linker if there is any.  */
>    if (__glibc_likely (rtld_fini != NULL))
> diff --git a/elf/rtld.c b/elf/rtld.c
> index 65647fb..1772f89 100644
> --- a/elf/rtld.c
> +++ b/elf/rtld.c
> @@ -2208,7 +2208,9 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
>  
>    /* Now that we have completed relocation, the initializer data
>       for the TLS blocks has its final values and we can copy them
> -     into the main thread's TLS area, which we allocated above.  */
> +     into the main thread's TLS area, which we allocated above.
> +     Note: thread-local variables must only be accessed after completing
> +     the next step.  */

OK.

>    _dl_allocate_tls_init (tcbp);
>  
>    /* And finally install it for the main thread.  */
> diff --git a/sysdeps/generic/libc-start.h b/sysdeps/generic/libc-start.h
> new file mode 100644
> index 0000000..dfb1c75
> --- /dev/null
> +++ b/sysdeps/generic/libc-start.h
> @@ -0,0 +1,26 @@

Needs a one line header comment explaining what this file is.

"Generic definitions for libc main startup."

> +/* Copyright (C) 2017 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
> +   <http://www.gnu.org/licenses/>.  */
> +
> +#ifndef _LIBC_START_H
> +#define _LIBC_START_H
> +
> +#ifndef SHARED

Should have a comment:

/* By default we perform STT_GNU_IFUNC resolution *before* TLS
   initialization, and this means you cannot, without machine
   knowledge, access TLS from a IFUNC resolver.  */

> +#define ARCH_SETUP_IREL() apply_irel ()
> +#define ARCH_APPLY_IREL()
> +#endif /* ! SHARED  */
> +
> +#endif /* _LIBC_START_H  */
> diff --git a/sysdeps/powerpc/Makefile b/sysdeps/powerpc/Makefile
> index e03a202..0d9206b 100644
> --- a/sysdeps/powerpc/Makefile
> +++ b/sysdeps/powerpc/Makefile
> @@ -11,7 +11,15 @@ sysdep-rtld-routines += dl-machine hwcapinfo
>  # Don't optimize GD tls sequence to LE.
>  LDFLAGS-tst-tlsopt-powerpc += -Wl,--no-tls-optimize
>  tests += tst-tlsopt-powerpc
> -endif
> +
> +ifneq (no,$(multi-arch))
> +tests-static += tst-tlsifunc-static
> +tests-internal += tst-tlsifunc-static
> +ifeq (yes,$(build-shared))
> +tests-internal += tst-tlsifunc
> +endif # build-shared
> +endif # multi-arch
> +endif # subdir = elf

OK.

>  
>  ifeq ($(subdir),setjmp)
>  ifeq (yes,$(build-shared))
> diff --git a/sysdeps/powerpc/powerpc64le/Makefile b/sysdeps/powerpc/powerpc64le/Makefile
> index 2c34f38..77617b6 100644
> --- a/sysdeps/powerpc/powerpc64le/Makefile
> +++ b/sysdeps/powerpc/powerpc64le/Makefile
> @@ -1,6 +1,11 @@
>  # When building float128 we need to ensure -mfloat128 is
>  # passed to all such object files.
>  
> +# 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 = $(as-needed) $(elf-objpfx)ld.so $(no-as-needed)
> +
>  ifeq ($(subdir),math)
>  # sqrtf128 requires emulation before POWER9.
>  CPPFLAGS += -I../soft-fp
> @@ -11,6 +16,8 @@ $(foreach suf,$(all-object-suffixes),%f128_r$(suf)): CFLAGS += -mfloat128
>  $(foreach suf,$(all-object-suffixes),$(objpfx)test-float128%$(suf)): CFLAGS += -mfloat128
>  $(foreach suf,$(all-object-suffixes),$(objpfx)test-ifloat128%$(suf)): CFLAGS += -mfloat128
>  CFLAGS-libm-test-support-float128.c += -mfloat128
> +$(objpfx)test-float128% $(objpfx)test-ifloat128%: \
> +  gnulib-tests += $(f128-loader-link)
>  endif
>  
>  # Append flags to string <-> _Float128 routines.
> @@ -28,6 +35,9 @@ CFLAGS-tst-strtod6.c += -mfloat128
>  CFLAGS-tst-strfrom.c += -mfloat128
>  CFLAGS-tst-strfrom-locale.c += -mfloat128
>  CFLAGS-strfrom-skeleton.c += -mfloat128
> +$(foreach test,bug-strtod bug-strtod2 bug-strtod2 tst-strtod-round \
> +tst-wcstod-round tst-strtod6 tst-strrom tst-strfrom-locale \
> +strfrom-skeleton,$(objpfx)$(test)): gnulib-tests += $(f128-loader-link)

OK.

>  
>  # 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
> diff --git a/sysdeps/powerpc/tst-tlsifunc-static.c b/sysdeps/powerpc/tst-tlsifunc-static.c
> new file mode 100644
> index 0000000..e5313af
> --- /dev/null
> +++ b/sysdeps/powerpc/tst-tlsifunc-static.c
> @@ -0,0 +1,19 @@
> +/* Test if an executable can read from the TLS from an STT_GNU_IFUNC resolver.
> +   Copyright (C) 2017 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
> +   <http://www.gnu.org/licenses/>.  */
> +
> +#include "tst-tlsifunc.c"

OK.

> diff --git a/sysdeps/powerpc/tst-tlsifunc.c b/sysdeps/powerpc/tst-tlsifunc.c
> new file mode 100644
> index 0000000..0a8bdbf
> --- /dev/null
> +++ b/sysdeps/powerpc/tst-tlsifunc.c
> @@ -0,0 +1,129 @@
> +/* Test if an executable can read from the TLS from an STT_GNU_IFUNC resolver.
> +   Copyright (C) 2017 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
> +   <http://www.gnu.org/licenses/>.  */
> +
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <stdint.h>
> +#include <inttypes.h>
> +#include <libc-symbols.h>
> +#include <tls-macros.h>
> +
> +__thread int bar;
> +static int *bar_ptr = NULL;
> +
> +static uint32_t resolver_platform = 0;
> +
> +int foo (void);
> +
> +int tcb_test (void);
> +
> +/* Offsets copied from tcb-offsets.h.  */
> +#ifdef __powerpc64__
> +# define __TPREG     "r13"
> +# define __ATPLATOFF -28764
> +#else
> +# define __TPREG     "r2"
> +# define __ATPLATOFF -28724
> +#endif
> +
> +uint32_t
> +get_platform (void)
> +{
> +  register unsigned long tp __asm__ (__TPREG);
> +  uint32_t tmp;
> +
> +  __asm__  ("lwz %0,%1(%2)\n"
> +	    : "=r" (tmp)
> +	    : "i" (__ATPLATOFF), "b" (tp));
> +
> +  return tmp;
> +}
> +
> +void
> +init_foo (void)
> +{
> +  bar_ptr = TLS_GD (bar);

OK.

> +}
> +
> +int
> +my_foo (void)
> +{
> +  printf ("&bar = %p and bar_ptr = %p.\n", &bar, bar_ptr);
> +  return bar_ptr != NULL;
> +}
> +
> +__ifunc (foo, foo, my_foo, void, init_foo);
> +
> +void
> +init_tcb_test (void)
> +{
> +  resolver_platform = get_platform ();
> +}
> +
> +int
> +my_tcb_test (void)
> +{
> +  printf ("resolver_platform = 0x%"PRIx32
> +	  " and current platform = 0x%"PRIx32".\n",
> +	  resolver_platform, get_platform ());
> +  return resolver_platform != 0;

OK. Ensuring this is setup early enough.

> +}
> +
> +__ifunc (tcb_test, tcb_test, my_tcb_test, void, init_tcb_test);
> +
> +static int
> +do_test (void)
> +{
> +  int ret = 0;
> +
> +  if (foo ())
> +    printf ("PASS: foo IFUNC resolver called once.\n");
> +  else
> +    {
> +      printf ("FAIL: foo IFUNC resolver not called once.\n");
> +      ret = 1;
> +    }
> +
> +  if (&bar == bar_ptr)
> +    printf ("PASS: bar address read from IFUNC resolver is correct.\n");
> +  else
> +    {
> +      printf ("FAIL: bar address read from IFUNC resolver is incorrect.\n");
> +      ret = 1;
> +    }
> +
> +  if (tcb_test ())
> +    printf ("PASS: tcb_test IFUNC resolver called once.\n");
> +  else
> +    {
> +      printf ("FAIL: tcb_test IFUNC resolver not called once.\n");
> +      ret = 1;
> +    }
> +
> +  if (resolver_platform == get_platform ())

OK. Results match calling again at a later time in the startup (after main).

> +    printf ("PASS: platform read from IFUNC resolver is correct.\n");
> +  else
> +    {
> +      printf ("FAIL: platform read from IFUNC resolver is incorrect.\n");
> +      ret = 1;
> +    }
> +
> +  return ret;
> +}
> +
> +#include <support/test-driver.c>
> diff --git a/sysdeps/unix/sysv/linux/powerpc/libc-start.h b/sysdeps/unix/sysv/linux/powerpc/libc-start.h
> new file mode 100644
> index 0000000..c8af068
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/powerpc/libc-start.h
> @@ -0,0 +1,28 @@

Needs a one line description.

> +/* Copyright (C) 2017 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
> +   <http://www.gnu.org/licenses/>.  */
> +
> +#ifndef _LIBC_START_H
> +#define _LIBC_START_H
> +
> +#ifndef SHARED
> +/* IREL{,A} must happen after TCB initialization in order to allow IFUNC
> +   resolvers to read TCB fields, e.g. hwcap and at_platform.  */

OK. Good comment.

> +#define ARCH_SETUP_IREL()
> +#define ARCH_APPLY_IREL() apply_irel ()
> +#endif /* ! SHARED  */
> +
> +#endif /* _LIBC_START_H  */
> 

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

* Re: [PATCHv4] powerpc: Fix float128 IFUNC relocations [BZ #21707]
  2017-07-17 15:46                                         ` Carlos O'Donell
@ 2017-07-17 16:27                                           ` Tulio Magno Quites Machado Filho
  0 siblings, 0 replies; 83+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2017-07-17 16:27 UTC (permalink / raw)
  To: Carlos O'Donell, libc-alpha; +Cc: hjl.tools, fweimer, gftg

Carlos O'Donell <carlos@redhat.com> writes:

> On 07/17/2017 10:05 AM, Tulio Magno Quites Machado Filho wrote:
>> Changes since version 3:
>> 
>>  - Moved definition of ARCH_APPLY_IREL and ARCH_SETUP_IREL to
>>    libc-start.h.
>>  - Added a comment to elf/rtld.c explaining when thread-local variables
>>    are available.
>>  - Improved the test to read a TCB variable.
>
> This very is good. No ifdef's in the generic libc main startup code, which
> is the way it should be. Tests are good too.
>
> OK to checkin with additional comments added.
>
> Thanks for working through this.
>
> In Fedora Rawhide / Fedora 27 I went with your v1 patch to get our mass
> rebuild working. However, before we release F27 I'll update to this version
> and drop the intermediate v1 patch.

Ack!

>> diff --git a/sysdeps/generic/libc-start.h b/sysdeps/generic/libc-start.h
>> new file mode 100644
>> index 0000000..dfb1c75
>> --- /dev/null
>> +++ b/sysdeps/generic/libc-start.h
>> @@ -0,0 +1,26 @@
>
> Needs a one line header comment explaining what this file is.
>
> "Generic definitions for libc main startup."

Done.

>> +/* Copyright (C) 2017 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
>> +   <http://www.gnu.org/licenses/>.  */
>> +
>> +#ifndef _LIBC_START_H
>> +#define _LIBC_START_H
>> +
>> +#ifndef SHARED
>
> Should have a comment:
>
> /* By default we perform STT_GNU_IFUNC resolution *before* TLS
>    initialization, and this means you cannot, without machine
>    knowledge, access TLS from a IFUNC resolver.  */

Done.

I'm going to push this patch with the changes requested.

Thanks!

-- 
Tulio Magno

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

* Re: ppc64le: getauxval call from IFUNC resolver
  2017-07-10 19:59             ` Peter Bergner
@ 2017-07-20 14:48               ` Peter Bergner
  0 siblings, 0 replies; 83+ messages in thread
From: Peter Bergner @ 2017-07-20 14:48 UTC (permalink / raw)
  To: Florian Weimer
  Cc: Joseph Myers, Tulio Magno Quites Machado Filho,
	Gabriel F. T. Gomes, libc-alpha, Bill Schmidt, Andreas Schwab

On 7/10/17 2:59 PM, Peter Bergner wrote:
> On 7/7/17 5:19 PM, Peter Bergner wrote:
>> On 7/4/17 1:37 AM, Florian Weimer wrote:
>>> For the time being, we just disable --enable-bind-now, but I'd prefer a
>>> proper fix, perhaps the one suggested here:
>>>
>>>   https://sourceware.org/ml/libc-alpha/2017-06/msg01383.html
>>
>> I just committed this to GCC trunk today.  I still need to bootstrap
>> and regtest the backports to GCC 7 and GCC 6.
> 
> The trunk patch applied to GCC 7 and GCC 6 cleanly/no fuzz and it
> bootstrapped and regtested with no regressions on powerpc64le-linux
> as well as on powerpc64-linux and running the testsuite in both 32-bit
> and 64-bit modes.
> 
> The backports were approved today, but I am leaving on vacation today,
> returning on the 19th, so I will not commit the backports until I
> return.  If there is a large need to have the backports committed before
> I return, please work with Tulio to find someone on our GCC team to
> commit the patch and watch for fallout.

Backports to GCC 7 and GCC 6 release branches have now been committed.

Peter



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

* Re: [PATCH, 2.27] x86-64: Use IFUNC memcpy and mempcpy in libc.a
  2017-07-09 14:59                                   ` [PATCH, 2.27] x86-64: Use IFUNC memcpy and mempcpy in libc.a H.J. Lu
@ 2017-08-02 15:53                                     ` H.J. Lu
  2017-08-02 18:27                                       ` Florian Weimer
  0 siblings, 1 reply; 83+ messages in thread
From: H.J. Lu @ 2017-08-02 15:53 UTC (permalink / raw)
  To: Tulio Magno Quites Machado Filho, GNU C Library, Florian Weimer,
	Carlos O'Donell, Joseph S. Myers, gftg

On Sun, Jul 9, 2017 at 7:59 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
 test-ifloat128%): Force
>
> FYI, this is the patch I am submitting for glibc 2.27.

Any comments or objections?

H.J.
> H.J.
> ---
> Since apply_irel is called before memcpy and mempcpy are called, we
> an use IFUNC memcpy and mempcpy in libc.a.
>
>         * sysdeps/x86_64/memmove.S (MEMCPY_SYMBOL): Don't check SHARED.
>         (MEMPCPY_SYMBOL): Likewise.
>         * sysdeps/x86_64/multiarch/memcpy-ssse3-back.S: Also include
>         in libc.a.
>         * sysdeps/x86_64/multiarch/memcpy-ssse3.S: Likewise.
>         * sysdeps/x86_64/multiarch/memmove-avx512-no-vzeroupper.S:
>         Likewise.
>         * sysdeps/x86_64/multiarch/memcpy.c: Also include in libc.a.
>         (__hidden_ver1): Don't use in libc.a.
>         * sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S
>         (__mempcpy): Don't create a weak alias in libc.a.
>         * sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S: Don't
>         check SHARED.
>         * sysdeps/x86_64/multiarch/mempcpy.c: Also include in libc.a.
>         (__hidden_ver1): Don't use in libc.a.
> ---
>  sysdeps/x86_64/memmove.S                           |  4 ++--
>  sysdeps/x86_64/multiarch/memcpy-ssse3-back.S       |  5 +----
>  sysdeps/x86_64/multiarch/memcpy-ssse3.S            |  5 +----
>  sysdeps/x86_64/multiarch/memcpy.c                  |  8 ++++----
>  .../multiarch/memmove-avx512-no-vzeroupper.S       |  6 ------
>  .../x86_64/multiarch/memmove-sse2-unaligned-erms.S |  4 +---
>  .../x86_64/multiarch/memmove-vec-unaligned-erms.S  | 22 +++++-----------------
>  sysdeps/x86_64/multiarch/mempcpy.c                 |  8 ++++----
>  8 files changed, 18 insertions(+), 44 deletions(-)
>
> diff --git a/sysdeps/x86_64/memmove.S b/sysdeps/x86_64/memmove.S
> index 5bbae990..24efe83 100644
> --- a/sysdeps/x86_64/memmove.S
> +++ b/sysdeps/x86_64/memmove.S
> @@ -29,7 +29,7 @@
>  #define SECTION(p)             p
>
>  #ifdef USE_MULTIARCH
> -# if !defined SHARED || !IS_IN (libc)
> +# if !IS_IN (libc)
>  #  define MEMCPY_SYMBOL(p,s)           memcpy
>  # endif
>  #else
> @@ -39,7 +39,7 @@
>  #  define MEMCPY_SYMBOL(p,s)           memcpy
>  # endif
>  #endif
> -#if !defined SHARED || !defined USE_MULTIARCH || !IS_IN (libc)
> +#if !defined USE_MULTIARCH || !IS_IN (libc)
>  # define MEMPCPY_SYMBOL(p,s)           __mempcpy
>  #endif
>  #ifndef MEMMOVE_SYMBOL
> diff --git a/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S b/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S
> index 4e060a2..ce53993 100644
> --- a/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S
> +++ b/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S
> @@ -19,10 +19,7 @@
>
>  #include <sysdep.h>
>
> -#if IS_IN (libc) \
> -    && (defined SHARED \
> -        || defined USE_AS_MEMMOVE \
> -       || !defined USE_MULTIARCH)
> +#if IS_IN (libc)
>
>  #include "asm-syntax.h"
>
> diff --git a/sysdeps/x86_64/multiarch/memcpy-ssse3.S b/sysdeps/x86_64/multiarch/memcpy-ssse3.S
> index f3ea52a..0ac4c21 100644
> --- a/sysdeps/x86_64/multiarch/memcpy-ssse3.S
> +++ b/sysdeps/x86_64/multiarch/memcpy-ssse3.S
> @@ -19,10 +19,7 @@
>
>  #include <sysdep.h>
>
> -#if IS_IN (libc) \
> -    && (defined SHARED \
> -        || defined USE_AS_MEMMOVE \
> -       || !defined USE_MULTIARCH)
> +#if IS_IN (libc)
>
>  #include "asm-syntax.h"
>
> diff --git a/sysdeps/x86_64/multiarch/memcpy.c b/sysdeps/x86_64/multiarch/memcpy.c
> index 6a2d353..273bc61 100644
> --- a/sysdeps/x86_64/multiarch/memcpy.c
> +++ b/sysdeps/x86_64/multiarch/memcpy.c
> @@ -17,10 +17,8 @@
>     License along with the GNU C Library; if not, see
>     <http://www.gnu.org/licenses/>.  */
>
> -/* Define multiple versions only for the definition in lib and for
> -   DSO.  In static binaries we need memcpy before the initialization
> -   happened.  */
> -#if defined SHARED && IS_IN (libc)
> +/* Define multiple versions only for the definition in libc.  */
> +#if IS_IN (libc)
>  # define memcpy __redirect_memcpy
>  # include <string.h>
>  # undef memcpy
> @@ -31,8 +29,10 @@
>  libc_ifunc_redirected (__redirect_memcpy, __new_memcpy,
>                        IFUNC_SELECTOR ());
>
> +# ifdef SHARED
>  __hidden_ver1 (__new_memcpy, __GI_memcpy, __redirect_memcpy)
>    __attribute__ ((visibility ("hidden")));
> +# endif
>
>  # include <shlib-compat.h>
>  versioned_symbol (libc, __new_memcpy, memcpy, GLIBC_2_14);
> diff --git a/sysdeps/x86_64/multiarch/memmove-avx512-no-vzeroupper.S b/sysdeps/x86_64/multiarch/memmove-avx512-no-vzeroupper.S
> index f3ef105..7ca365a 100644
> --- a/sysdeps/x86_64/multiarch/memmove-avx512-no-vzeroupper.S
> +++ b/sysdeps/x86_64/multiarch/memmove-avx512-no-vzeroupper.S
> @@ -23,7 +23,6 @@
>  # include "asm-syntax.h"
>
>         .section .text.avx512,"ax",@progbits
> -# if defined SHARED && !defined USE_AS_MEMPCPY && !defined USE_AS_MEMMOVE
>  ENTRY (__mempcpy_chk_avx512_no_vzeroupper)
>         cmpq    %rdx, %rcx
>         jb      HIDDEN_JUMPTARGET (__chk_fail)
> @@ -34,14 +33,11 @@ ENTRY (__mempcpy_avx512_no_vzeroupper)
>         addq    %rdx, %rax
>         jmp     L(start)
>  END (__mempcpy_avx512_no_vzeroupper)
> -# endif
>
> -# ifdef SHARED
>  ENTRY (__memmove_chk_avx512_no_vzeroupper)
>         cmpq    %rdx, %rcx
>         jb      HIDDEN_JUMPTARGET (__chk_fail)
>  END (__memmove_chk_avx512_no_vzeroupper)
> -# endif
>
>  ENTRY (__memmove_avx512_no_vzeroupper)
>         mov     %rdi, %rax
> @@ -413,8 +409,6 @@ L(gobble_256bytes_nt_loop_bkw):
>         jmp     L(check)
>  END (__memmove_avx512_no_vzeroupper)
>
> -# ifdef SHARED
>  strong_alias (__memmove_avx512_no_vzeroupper, __memcpy_avx512_no_vzeroupper)
>  strong_alias (__memmove_chk_avx512_no_vzeroupper, __memcpy_chk_avx512_no_vzeroupper)
> -# endif
>  #endif
> diff --git a/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S b/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S
> index 743064b..cfb604d 100644
> --- a/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S
> +++ b/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S
> @@ -18,9 +18,7 @@
>
>  #if IS_IN (libc)
>  # define MEMMOVE_SYMBOL(p,s)   p##_sse2_##s
> -#endif
> -
> -#if !defined SHARED || !IS_IN (libc)
> +#else
>  weak_alias (__mempcpy, mempcpy)
>  #endif
>
> diff --git a/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S b/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S
> index d694e8b..0fad756 100644
> --- a/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S
> +++ b/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S
> @@ -105,22 +105,20 @@
>  #endif
>
>         .section SECTION(.text),"ax",@progbits
> -#if defined SHARED && IS_IN (libc)
> +#if IS_IN (libc)
>  ENTRY (MEMMOVE_CHK_SYMBOL (__mempcpy_chk, unaligned))
>         cmpq    %rdx, %rcx
>         jb      HIDDEN_JUMPTARGET (__chk_fail)
>  END (MEMMOVE_CHK_SYMBOL (__mempcpy_chk, unaligned))
>  #endif
>
> -#if VEC_SIZE == 16 || defined SHARED
>  ENTRY (MEMPCPY_SYMBOL (__mempcpy, unaligned))
>         movq    %rdi, %rax
>         addq    %rdx, %rax
>         jmp     L(start)
>  END (MEMPCPY_SYMBOL (__mempcpy, unaligned))
> -#endif
>
> -#if defined SHARED && IS_IN (libc)
> +#if IS_IN (libc)
>  ENTRY (MEMMOVE_CHK_SYMBOL (__memmove_chk, unaligned))
>         cmpq    %rdx, %rcx
>         jb      HIDDEN_JUMPTARGET (__chk_fail)
> @@ -151,7 +149,6 @@ L(nop):
>  END (MEMMOVE_SYMBOL (__memmove, unaligned))
>
>  # if VEC_SIZE == 16
> -#  if defined SHARED
>  ENTRY (__mempcpy_chk_erms)
>         cmpq    %rdx, %rcx
>         jb      HIDDEN_JUMPTARGET (__chk_fail)
> @@ -163,7 +160,6 @@ ENTRY (__mempcpy_erms)
>         addq    %rdx, %rax
>         jmp     L(start_movsb)
>  END (__mempcpy_erms)
> -#  endif
>
>  ENTRY (__memmove_chk_erms)
>         cmpq    %rdx, %rcx
> @@ -193,13 +189,10 @@ L(movsb_backward):
>         cld
>         ret
>  END (__memmove_erms)
> -#  if defined SHARED
>  strong_alias (__memmove_erms, __memcpy_erms)
>  strong_alias (__memmove_chk_erms, __memcpy_chk_erms)
> -#  endif
>  # endif
>
> -# ifdef SHARED
>  ENTRY (MEMMOVE_CHK_SYMBOL (__mempcpy_chk, unaligned_erms))
>         cmpq    %rdx, %rcx
>         jb      HIDDEN_JUMPTARGET (__chk_fail)
> @@ -215,7 +208,6 @@ ENTRY (MEMMOVE_CHK_SYMBOL (__memmove_chk, unaligned_erms))
>         cmpq    %rdx, %rcx
>         jb      HIDDEN_JUMPTARGET (__chk_fail)
>  END (MEMMOVE_CHK_SYMBOL (__memmove_chk, unaligned_erms))
> -# endif
>
>  ENTRY (MEMMOVE_SYMBOL (__memmove, unaligned_erms))
>         movq    %rdi, %rax
> @@ -546,19 +538,15 @@ L(loop_large_backward):
>  #endif
>  END (MEMMOVE_SYMBOL (__memmove, unaligned_erms))
>
> -#ifdef SHARED
> -# if IS_IN (libc)
> -#  ifdef USE_MULTIARCH
> +#if IS_IN (libc)
> +# ifdef USE_MULTIARCH
>  strong_alias (MEMMOVE_SYMBOL (__memmove, unaligned_erms),
>               MEMMOVE_SYMBOL (__memcpy, unaligned_erms))
>  strong_alias (MEMMOVE_SYMBOL (__memmove_chk, unaligned_erms),
>               MEMMOVE_SYMBOL (__memcpy_chk, unaligned_erms))
> -#  endif
> +# endif
>  strong_alias (MEMMOVE_CHK_SYMBOL (__memmove_chk, unaligned),
>               MEMMOVE_CHK_SYMBOL (__memcpy_chk, unaligned))
> -# endif
>  #endif
> -#if VEC_SIZE == 16 || defined SHARED
>  strong_alias (MEMMOVE_SYMBOL (__memmove, unaligned),
>               MEMCPY_SYMBOL (__memcpy, unaligned))
> -#endif
> diff --git a/sysdeps/x86_64/multiarch/mempcpy.c b/sysdeps/x86_64/multiarch/mempcpy.c
> index e627b00..49e9896 100644
> --- a/sysdeps/x86_64/multiarch/mempcpy.c
> +++ b/sysdeps/x86_64/multiarch/mempcpy.c
> @@ -17,10 +17,8 @@
>     License along with the GNU C Library; if not, see
>     <http://www.gnu.org/licenses/>.  */
>
> -/* Define multiple versions only for the definition in lib and for
> -   DSO.  In static binaries we need mempcpy before the initialization
> -   happened.  */
> -#if defined SHARED && IS_IN (libc)
> +/* Define multiple versions only for the definition in libc.  */
> +#if IS_IN (libc)
>  # define mempcpy __redirect_mempcpy
>  # define __mempcpy __redirect___mempcpy
>  # define NO_MEMPCPY_STPCPY_REDIRECT
> @@ -35,8 +33,10 @@
>  libc_ifunc_redirected (__redirect_mempcpy, __mempcpy, IFUNC_SELECTOR ());
>
>  weak_alias (__mempcpy, mempcpy)
> +# ifdef SHARED
>  __hidden_ver1 (__mempcpy, __GI___mempcpy, __redirect___mempcpy)
>    __attribute__ ((visibility ("hidden")));
>  __hidden_ver1 (mempcpy, __GI_mempcpy, __redirect_mempcpy)
>    __attribute__ ((visibility ("hidden")));
> +# endif
>  #endif
> --
> 2.9.4
>



-- 
H.J.

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

* Re: [PATCH, 2.27] x86-64: Use IFUNC memcpy and mempcpy in libc.a
  2017-08-02 15:53                                     ` H.J. Lu
@ 2017-08-02 18:27                                       ` Florian Weimer
  2017-08-02 18:36                                         ` H.J. Lu
  0 siblings, 1 reply; 83+ messages in thread
From: Florian Weimer @ 2017-08-02 18:27 UTC (permalink / raw)
  To: H.J. Lu, Tulio Magno Quites Machado Filho, GNU C Library,
	Carlos O'Donell, Joseph S. Myers, gftg

On 08/02/2017 05:53 PM, H.J. Lu wrote:
> On Sun, Jul 9, 2017 at 7:59 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>  test-ifloat128%): Force
>>
>> FYI, this is the patch I am submitting for glibc 2.27.
> 
> Any comments or objections?

I have not reviewed if there are any static library initialization
issues caused by IFUNC use for string functions, but I agree in
principle that something like this should be possible.

Thanks,
Florian

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

* Re: [PATCH, 2.27] x86-64: Use IFUNC memcpy and mempcpy in libc.a
  2017-08-02 18:27                                       ` Florian Weimer
@ 2017-08-02 18:36                                         ` H.J. Lu
  2017-08-02 18:51                                           ` Florian Weimer
  0 siblings, 1 reply; 83+ messages in thread
From: H.J. Lu @ 2017-08-02 18:36 UTC (permalink / raw)
  To: Florian Weimer
  Cc: Tulio Magno Quites Machado Filho, GNU C Library,
	Carlos O'Donell, Joseph S. Myers, gftg

On Wed, Aug 2, 2017 at 11:27 AM, Florian Weimer <fweimer@redhat.com> wrote:
> On 08/02/2017 05:53 PM, H.J. Lu wrote:
>> On Sun, Jul 9, 2017 at 7:59 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>  test-ifloat128%): Force
>>>
>>> FYI, this is the patch I am submitting for glibc 2.27.
>>
>> Any comments or objections?
>
> I have not reviewed if there are any static library initialization
> issues caused by IFUNC use for string functions, but I agree in
> principle that something like this should be possible.
>

The entry point of static executable is

STATIC int
LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
int argc, char **argv,
#ifdef LIBC_START_MAIN_AUXVEC_ARG
ElfW(auxv_t) *auxvec,
#endif
__typeof (main) init,
void (*fini) (void),
void (*rtld_fini) (void), void *stack_end)
{
  /* Result of the 'main' function.  */
  int result;

  __libc_multiple_libcs = &_dl_starting_up && !_dl_starting_up;

#ifndef SHARED
  char **ev = &argv[argc + 1];

  __environ = ev;

  /* Store the lowest stack address.  This is done in ld.so if this is
     the code for the DSO.  */
  __libc_stack_end = stack_end;

# ifdef HAVE_AUX_VECTOR
  /* First process the auxiliary vector since we need to find the
     program header to locate an eventually present PT_TLS entry.  */
#  ifndef LIBC_START_MAIN_AUXVEC_ARG
  ElfW(auxv_t) *auxvec;
  {
    char **evp = ev;
    while (*evp++ != NULL)
      ;
    auxvec = (ElfW(auxv_t) *) evp;
  }
#  endif
  _dl_aux_init (auxvec);
  if (GL(dl_phdr) == NULL)
# endif
    {
      /* Starting from binutils-2.23, the linker will define the
         magic symbol __ehdr_start to point to our own ELF header
         if it is visible in a segment that also includes the phdrs.
         So we can set up _dl_phdr and _dl_phnum even without any
         information from auxv.  */

      extern const ElfW(Ehdr) __ehdr_start
__attribute__ ((weak, visibility ("hidden")));
      if (&__ehdr_start != NULL)
        {
          assert (__ehdr_start.e_phentsize == sizeof *GL(dl_phdr));
          GL(dl_phdr) = (const void *) &__ehdr_start + __ehdr_start.e_phoff;
          GL(dl_phnum) = __ehdr_start.e_phnum;
        }
    }

  /* Initialize very early so that tunables can use it.  */
  __libc_init_secure ();

  __tunables_init (__environ);

  ARCH_INIT_CPU_FEATURES ();

  /* Perform IREL{,A} relocations.  */
  ARCH_SETUP_IREL ();

If there is no memcpy/mempcpy call before ARCH_SETUP_IREL (),
we can use IFUNC memcpy and mempcpy in static executable.
Since the code path up to ARCH_SETUP_IREL () is the same for
all static executables, the static executable tests within glibc are
sufficient to verify that it is safe to do so.


-- 
H.J.

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

* Re: [PATCH, 2.27] x86-64: Use IFUNC memcpy and mempcpy in libc.a
  2017-08-02 18:36                                         ` H.J. Lu
@ 2017-08-02 18:51                                           ` Florian Weimer
  2017-08-04 13:18                                             ` H.J. Lu
  0 siblings, 1 reply; 83+ messages in thread
From: Florian Weimer @ 2017-08-02 18:51 UTC (permalink / raw)
  To: H.J. Lu
  Cc: Tulio Magno Quites Machado Filho, GNU C Library,
	Carlos O'Donell, Joseph S. Myers, gftg

On 08/02/2017 08:36 PM, H.J. Lu wrote:
> If there is no memcpy/mempcpy call before ARCH_SETUP_IREL (),
> we can use IFUNC memcpy and mempcpy in static executable.
> Since the code path up to ARCH_SETUP_IREL () is the same for
> all static executables, the static executable tests within glibc are
> sufficient to verify that it is safe to do so.

Ah, this is a good point.  Thanks.

Florian

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

* Re: [PATCH, 2.27] x86-64: Use IFUNC memcpy and mempcpy in libc.a
  2017-08-02 18:51                                           ` Florian Weimer
@ 2017-08-04 13:18                                             ` H.J. Lu
  0 siblings, 0 replies; 83+ messages in thread
From: H.J. Lu @ 2017-08-04 13:18 UTC (permalink / raw)
  To: Florian Weimer
  Cc: Tulio Magno Quites Machado Filho, GNU C Library,
	Carlos O'Donell, Joseph S. Myers, gftg

On Wed, Aug 2, 2017 at 11:51 AM, Florian Weimer <fweimer@redhat.com> wrote:
> On 08/02/2017 08:36 PM, H.J. Lu wrote:
>> If there is no memcpy/mempcpy call before ARCH_SETUP_IREL (),
>> we can use IFUNC memcpy and mempcpy in static executable.
>> Since the code path up to ARCH_SETUP_IREL () is the same for
>> all static executables, the static executable tests within glibc are
>> sufficient to verify that it is safe to do so.
>
> Ah, this is a good point.  Thanks.
>

I am checking it in today.


-- 
H.J.

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

end of thread, other threads:[~2017-08-04 13:18 UTC | newest]

Thread overview: 83+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-23 12:33 [PATCH v3 0/7] Enable float128 on powerpc64le Gabriel F. T. Gomes
2017-06-23 12:33 ` [PATCH v3 3/7] Add libio-mtsafe flags to the build of strfromf128 Gabriel F. T. Gomes
2017-06-23 12:59   ` Joseph Myers
2017-06-23 12:33 ` [PATCH v3 1/7] Include libc-header-start.h in include/float.h Gabriel F. T. Gomes
2017-06-23 12:34 ` [PATCH v3 5/7] Document _FloatN and _FloatNx versions of math functions Gabriel F. T. Gomes
2017-06-23 13:11   ` Joseph Myers
2017-06-23 12:34 ` [PATCH v3 7/7] powerpc64le: Enable float128 Gabriel F. T. Gomes
2017-06-23 13:18   ` Joseph Myers
2017-06-26 17:11   ` Tulio Magno Quites Machado Filho
2017-06-26 23:02     ` Joseph Myers
2017-06-27  3:29       ` Alan Modra
2017-06-27  7:05       ` Florian Weimer
2017-06-27 15:00         ` Peter Bergner
2017-06-27 18:42           ` Florian Weimer
2017-06-27 18:51             ` Peter Bergner
2017-06-27 19:17               ` Florian Weimer
2017-06-27 19:33                 ` Carlos Eduardo Seo
2017-06-27 19:34                 ` Peter Bergner
2017-06-27 21:41                   ` Florian Weimer
2017-06-28 16:30                     ` Szabolcs Nagy
2017-06-28 17:08                       ` Peter Bergner
2017-06-28 17:15                         ` Szabolcs Nagy
2017-07-04  6:38         ` ppc64le: getauxval call from IFUNC resolver Florian Weimer
2017-07-05 17:25           ` [RFC] Fix float128 IFUNC relocations on ppc64le [BZ #21707] Tulio Magno Quites Machado Filho
2017-07-05 19:19             ` Florian Weimer
2017-07-05 19:25               ` Carlos O'Donell
2017-07-05 19:44                 ` Florian Weimer
2017-07-05 20:12                   ` Joseph Myers
2017-07-06  6:19                     ` Florian Weimer
2017-07-06 14:04                       ` Carlos O'Donell
2017-07-07 10:08                         ` Florian Weimer
2017-07-08 18:31                           ` [PATCHv2] " Tulio Magno Quites Machado Filho
2017-07-08 19:17                             ` Florian Weimer
2017-07-08 23:18                               ` Tulio Magno Quites Machado Filho
2017-07-08 19:30                             ` H.J. Lu
2017-07-08 23:12                               ` Tulio Magno Quites Machado Filho
2017-07-08 23:59                                 ` H.J. Lu
2017-07-09 14:59                                   ` [PATCH, 2.27] x86-64: Use IFUNC memcpy and mempcpy in libc.a H.J. Lu
2017-08-02 15:53                                     ` H.J. Lu
2017-08-02 18:27                                       ` Florian Weimer
2017-08-02 18:36                                         ` H.J. Lu
2017-08-02 18:51                                           ` Florian Weimer
2017-08-04 13:18                                             ` H.J. Lu
2017-07-09 16:28                             ` [PATCHv2] Fix float128 IFUNC relocations on ppc64le [BZ #21707] Nix
2017-07-10 15:28                               ` Tulio Magno Quites Machado Filho
2017-07-10 15:37                                 ` Nix
2017-07-12 13:45                                   ` Nix
2017-07-10 10:09                             ` Joseph Myers
2017-07-10 18:02                               ` Tulio Magno Quites Machado Filho
2017-07-10 15:04                             ` Carlos O'Donell
2017-07-12 18:59                               ` [PATCHv3] powerpc: Fix float128 IFUNC relocations " Tulio Magno Quites Machado Filho
2017-07-12 19:42                                 ` H.J. Lu
2017-07-12 20:58                                 ` Carlos O'Donell
2017-07-13 14:29                                   ` Tulio Magno Quites Machado Filho
2017-07-13 14:33                                     ` Carlos O'Donell
2017-07-17 14:06                                       ` [PATCHv4] " Tulio Magno Quites Machado Filho
2017-07-17 15:46                                         ` Carlos O'Donell
2017-07-17 16:27                                           ` Tulio Magno Quites Machado Filho
2017-07-05 19:21             ` [RFC] Fix float128 IFUNC relocations on ppc64le " Carlos O'Donell
2017-07-08 18:46               ` Tulio Magno Quites Machado Filho
2017-07-05 19:40             ` Gabriel F. T. Gomes
2017-07-05 20:32               ` Tulio Magno Quites Machado Filho
2017-07-07 22:19           ` ppc64le: getauxval call from IFUNC resolver Peter Bergner
2017-07-10 19:59             ` Peter Bergner
2017-07-20 14:48               ` Peter Bergner
2017-06-27 17:46       ` [PATCH v3 7/7] powerpc64le: Enable float128 Gabriel F. T. Gomes
2017-06-27  7:20   ` Andreas Schwab
2017-06-27  9:24   ` Andreas Schwab
2017-06-27 13:15   ` Andreas Schwab
2017-06-28  0:54     ` [PATCH] powerpc64le: Iterate over all object suffixes when appending -mfloat128 Gabriel F. T. Gomes
2017-06-28  7:19       ` Andreas Schwab
2017-06-28 11:58         ` Gabriel F. T. Gomes
2017-06-28  7:22       ` Andreas Schwab
2017-07-10 10:22       ` Joseph Myers
2017-07-11 14:07         ` Tulio Magno Quites Machado Filho
2017-07-11 17:21           ` Gabriel F. T. Gomes
2017-06-23 12:34 ` [PATCH v3 6/7] powerpc64le: Check for compiler features for float128 Gabriel F. T. Gomes
2017-06-23 16:37   ` Joseph Myers
2017-06-23 20:47     ` Steven Munroe
2017-06-23 12:34 ` [PATCH v3 4/7] Update string to float128 functions to use bits/types/locale_t.h Gabriel F. T. Gomes
2017-06-23 12:57   ` Gabriel F. T. Gomes
2017-06-23 12:34 ` [PATCH v3 2/7] Prepare the manual to display math errors for float128 functions Gabriel F. T. Gomes
2017-06-23 12:59 ` [PATCH v3 0/7] Enable float128 on powerpc64le Joseph Myers

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