diff options
37 files changed, 74 insertions, 64 deletions
diff --git a/argp/argp.h b/argp/argp.h index 358d9b43cd..a5b861a4d3 100644 --- a/argp/argp.h +++ b/argp/argp.h @@ -555,7 +555,7 @@ __NTH (__option_is_end (const struct argp_option *__opt)) #endif /* Use extern inlines. */ #include <bits/floatn.h> -#if defined __LDBL_COMPAT || __LONG_DOUBLE_USES_FLOAT128 == 1 +#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 # include <bits/argp-ldbl.h> #endif diff --git a/bits/long-double.h b/bits/long-double.h index 6e16447e65..bdde78f49a 100644 --- a/bits/long-double.h +++ b/bits/long-double.h @@ -37,4 +37,17 @@ #ifndef __NO_LONG_DOUBLE_MATH # define __NO_LONG_DOUBLE_MATH 1 #endif -#define __LONG_DOUBLE_USES_FLOAT128 0 + +/* The macro __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI is used to determine the + choice of the underlying ABI of long double. It will always assume + a constant value for each translation unit. + + If the value is non-zero, any API which is parameterized by the long + double type (i.e the scanf/printf family of functions or the explicitly + parameterized math.h functions) will be redirected to a compatible + implementation using _Float128 ABI via symbols suffixed with ieee128. + + The mechanism this macro uses to acquire may be a function + of architecture, or target specific options used to invoke the + compiler. */ +#define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 0 diff --git a/elf/tst-addr1.c b/elf/tst-addr1.c index 27dc0f00f4..93ce669cbd 100644 --- a/elf/tst-addr1.c +++ b/elf/tst-addr1.c @@ -15,7 +15,7 @@ do_test (void) if (i.dli_sname == NULL) return 1; -#if __LONG_DOUBLE_USES_FLOAT128 == 1 +#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 /* On architectures which redirect long double to _Float128 (e.g powerpc64le), printf will resolve to __printfieee128 due to header redirects. There diff --git a/include/math.h b/include/math.h index 1b3199b3f6..3979c47400 100644 --- a/include/math.h +++ b/include/math.h @@ -19,7 +19,7 @@ hidden_proto (__isinff) hidden_proto (__isnanf) # if !defined __NO_LONG_DOUBLE_MATH \ - && __LONG_DOUBLE_USES_FLOAT128 == 0 + && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0 hidden_proto (__finitel) hidden_proto (__isinfl) hidden_proto (__isnanl) @@ -42,7 +42,7 @@ libm_hidden_proto (__expf) libm_hidden_proto (__roundeven) # if !defined __NO_LONG_DOUBLE_MATH \ - && __LONG_DOUBLE_USES_FLOAT128 == 0 + && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0 libm_hidden_proto (__fpclassifyl) libm_hidden_proto (__issignalingl) libm_hidden_proto (__expl) @@ -143,7 +143,7 @@ fabsf128 (_Float128 x) MATH_REDIRECT_LDBL (FUNC, PREFIX, ARGS) \ MATH_REDIRECT_F128 (FUNC, PREFIX, ARGS) # if defined __NO_LONG_DOUBLE_MATH \ - || __LONG_DOUBLE_USES_FLOAT128 == 1 + || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 # define MATH_REDIRECT_LDBL(FUNC, PREFIX, ARGS) # else # define MATH_REDIRECT_LDBL(FUNC, PREFIX, ARGS) \ diff --git a/include/monetary.h b/include/monetary.h index bddc660ce2..5390411d8f 100644 --- a/include/monetary.h +++ b/include/monetary.h @@ -1,6 +1,6 @@ /* Workaround PR90731 with GCC 9 when using ldbl redirects in C++. */ #include <bits/floatn.h> -#if defined __cplusplus && __LONG_DOUBLE_USES_FLOAT128 == 1 +#if defined __cplusplus && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 # if __GNUC_PREREQ (9, 0) && !__GNUC_PREREQ (9, 3) # pragma GCC system_header # endif diff --git a/include/printf.h b/include/printf.h index bdcfd29f63..0ed6e87387 100644 --- a/include/printf.h +++ b/include/printf.h @@ -2,7 +2,7 @@ /* Workaround PR90731 with GCC 9 when using ldbl redirects in C++. */ #include <bits/floatn.h> -#if defined __cplusplus && __LONG_DOUBLE_USES_FLOAT128 == 1 +#if defined __cplusplus && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 # if __GNUC_PREREQ (9, 0) && !__GNUC_PREREQ (9, 3) # pragma GCC system_header # endif diff --git a/include/stdio.h b/include/stdio.h index 1c09daf13a..9df98b2833 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -5,7 +5,7 @@ /* Workaround PR90731 with GCC 9 when using ldbl redirects in C++. */ # include <bits/floatn.h> -# if defined __cplusplus && __LONG_DOUBLE_USES_FLOAT128 == 1 +# if defined __cplusplus && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 # if __GNUC_PREREQ (9, 0) && !__GNUC_PREREQ (9, 3) # pragma GCC system_header # endif @@ -22,10 +22,10 @@ /* Some libc_hidden_ldbl_proto's do not map to a unique symbol when redirecting ldouble to _Float128 variants. We can therefore safely directly alias them to their internal name. */ -# if __LONG_DOUBLE_USES_FLOAT128 == 1 && IS_IN (libc) +# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && IS_IN (libc) # define stdio_hidden_ldbl_proto(p, f) \ extern __typeof (p ## f) p ## f __asm (__ASMNAME ("___ieee128_" #f)); -# elif __LONG_DOUBLE_USES_FLOAT128 == 1 +# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 # define stdio_hidden_ldbl_proto(p,f) __LDBL_REDIR1_DECL (p ## f, p ## f ## ieee128) # else # define stdio_hidden_ldbl_proto(p,f) libc_hidden_proto (p ## f) @@ -101,7 +101,7 @@ libc_hidden_proto (__isoc99_vfscanf) # define sscanf __isoc99_sscanf # endif -# if __LONG_DOUBLE_USES_FLOAT128 == 1 && IS_IN (libc) +# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && IS_IN (libc) /* These are implemented as redirects to other public API. Therefore, the usual redirection fails to avoid PLT. */ extern __typeof (__isoc99_sscanf) ___ieee128_isoc99_sscanf __THROW; diff --git a/include/stdlib.h b/include/stdlib.h index 187a41e754..ffcefd7b85 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -6,7 +6,7 @@ /* Workaround PR90731 with GCC 9 when using ldbl redirects in C++. */ #include <bits/floatn.h> -#if defined __cplusplus && __LONG_DOUBLE_USES_FLOAT128 == 1 +#if defined __cplusplus && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 # if __GNUC_PREREQ (9, 0) && !__GNUC_PREREQ (9, 3) # pragma GCC system_header # endif @@ -216,7 +216,7 @@ libc_hidden_proto (____strtoull_l_internal) #include <bits/floatn.h> libc_hidden_proto (strtof) libc_hidden_proto (strtod) -#if __LONG_DOUBLE_USES_FLOAT128 == 0 +#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0 libc_hidden_proto (strtold) #endif libc_hidden_proto (strtol) diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h index 9f44ac5a0a..6a76160ed4 100644 --- a/include/sys/cdefs.h +++ b/include/sys/cdefs.h @@ -16,7 +16,7 @@ rtld_hidden_proto (__chk_fail) /* If we are using redirects internally to support long double, we need to tweak some macros to ensure the PLT bypass tricks continue to work in libc. */ -#if __LONG_DOUBLE_USES_FLOAT128 == 1 && IS_IN (libc) && defined SHARED +#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && IS_IN (libc) && defined SHARED # undef __LDBL_REDIR_DECL # define __LDBL_REDIR_DECL(func) \ diff --git a/include/wchar.h b/include/wchar.h index bb49d844be..4267985625 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -2,7 +2,7 @@ /* Workaround PR90731 with GCC 9 when using ldbl redirects in C++. */ # include <bits/floatn.h> -# if defined __cplusplus && __LONG_DOUBLE_USES_FLOAT128 == 1 +# if defined __cplusplus && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 # if __GNUC_PREREQ (9, 0) && !__GNUC_PREREQ (9, 3) # pragma GCC system_header # endif diff --git a/libio/bits/stdio-ldbl.h b/libio/bits/stdio-ldbl.h index 3bb9f7dd2c..28c44666e3 100644 --- a/libio/bits/stdio-ldbl.h +++ b/libio/bits/stdio-ldbl.h @@ -31,7 +31,7 @@ __LDBL_REDIR_DECL (vsprintf) __LDBL_REDIR1_DECL (fscanf, __nldbl___isoc99_fscanf) __LDBL_REDIR1_DECL (scanf, __nldbl___isoc99_scanf) __LDBL_REDIR1_DECL (sscanf, __nldbl___isoc99_sscanf) -# elif __LONG_DOUBLE_USES_FLOAT128 == 1 +# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 __LDBL_REDIR1_DECL (fscanf, __isoc99_fscanfieee128) __LDBL_REDIR1_DECL (scanf, __isoc99_scanfieee128) __LDBL_REDIR1_DECL (sscanf, __isoc99_sscanfieee128) @@ -55,7 +55,7 @@ __LDBL_REDIR_DECL (vsnprintf) __LDBL_REDIR1_DECL (vfscanf, __nldbl___isoc99_vfscanf) __LDBL_REDIR1_DECL (vscanf, __nldbl___isoc99_vscanf) __LDBL_REDIR1_DECL (vsscanf, __nldbl___isoc99_vsscanf) -# elif __LONG_DOUBLE_USES_FLOAT128 == 1 +# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 __LDBL_REDIR1_DECL (vfscanf, __isoc99_vfscanfieee128) __LDBL_REDIR1_DECL (vscanf, __isoc99_vscanfieee128) __LDBL_REDIR1_DECL (vsscanf, __isoc99_vsscanfieee128) diff --git a/libio/stdio.h b/libio/stdio.h index 18e29752c4..21ef36ae70 100644 --- a/libio/stdio.h +++ b/libio/stdio.h @@ -401,11 +401,11 @@ extern int sscanf (const char *__restrict __s, /* For historical reasons, the C99-compliant versions of the scanf functions are at alternative names. When __LDBL_COMPAT or - __LONG_DOUBLE_USES_FLOAT128 are in effect, this is handled in + __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI are in effect, this is handled in bits/stdio-ldbl.h. */ #include <bits/floatn.h> #if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \ - && __LONG_DOUBLE_USES_FLOAT128 == 0 + && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0 # ifdef __REDIRECT extern int __REDIRECT (fscanf, (FILE *__restrict __stream, const char *__restrict __format, ...), @@ -451,7 +451,7 @@ extern int vsscanf (const char *__restrict __s, /* Same redirection as above for the v*scanf family. */ # if !__GLIBC_USE (DEPRECATED_SCANF) # if defined __REDIRECT && !defined __LDBL_COMPAT \ - && __LONG_DOUBLE_USES_FLOAT128 == 0 + && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0 extern int __REDIRECT (vfscanf, (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg), @@ -872,7 +872,7 @@ extern int __overflow (FILE *, int); #endif #include <bits/floatn.h> -#if defined __LDBL_COMPAT || __LONG_DOUBLE_USES_FLOAT128 == 1 +#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 # include <bits/stdio-ldbl.h> #endif diff --git a/math/complex.h b/math/complex.h index b6d175e800..7c06add10c 100644 --- a/math/complex.h +++ b/math/complex.h @@ -126,7 +126,7 @@ __BEGIN_DECLS # undef __MATHDECL_1 # define __MATHDECL_1(type, function, args) \ extern type __REDIRECT_NTH(__MATH_PRECNAME(function), args, function) -# elif __LONG_DOUBLE_USES_FLOAT128 == 1 +# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 # undef __MATHDECL_1 # undef __MATHDECL # define __REDIR_TO(function) \ @@ -142,7 +142,7 @@ __BEGIN_DECLS # define __MATH_PRECNAME(name) name##l # include <bits/cmathcalls.h> # if defined __LDBL_COMPAT \ - || __LONG_DOUBLE_USES_FLOAT128 == 1 + || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 # undef __REDIR_TO # undef __MATHDECL_1 # undef __MATHDECL diff --git a/math/math.h b/math/math.h index 777d108347..e48860e391 100644 --- a/math/math.h +++ b/math/math.h @@ -343,7 +343,7 @@ extern long double __REDIRECT_NTH (nexttowardl, # define __MATHDECL_1(type, function,suffix, args) \ __MATHREDIR(type, function, suffix, args, __CONCAT(function,suffix)) -# elif __LONG_DOUBLE_USES_FLOAT128 == 1 +# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 # ifdef __REDIRECT_NTH # ifdef __USE_ISOC99 extern float __REDIRECT_NTH (nexttowardf, (float __x, long double __y), @@ -390,7 +390,7 @@ extern double __REDIRECT_NTH (nexttoward, (double __x, long double __y), # undef __MATH_DECLARING_FLOATN # if defined __LDBL_COMPAT \ - || __LONG_DOUBLE_USES_FLOAT128 == 1 + || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 # undef __REDIRTO # undef __REDIRTO_ALT # undef __MATHDECL_1 @@ -562,7 +562,7 @@ extern double __REDIRECT_NTH (nexttoward, (double __x, long double __y), # undef __MATHCALL_NARROW # define __MATHCALL_NARROW(func, redir, nargs) \ __MATHCALL_NARROW_REDIR (func, redir, nargs) -# elif __LONG_DOUBLE_USES_FLOAT128 == 1 +# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 # define __MATHCALL_REDIR_NAME(name) __ ## f32 ## name ## ieee128 # undef __MATHCALL_NARROW # define __MATHCALL_NARROW(func, redir, nargs) \ @@ -573,7 +573,7 @@ extern double __REDIRECT_NTH (nexttoward, (double __x, long double __y), # undef _Marg_ # undef __MATHCALL_NAME # if defined __LDBL_COMPAT \ - || __LONG_DOUBLE_USES_FLOAT128 == 1 + || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 # undef __MATHCALL_REDIR_NAME # undef __MATHCALL_NARROW # define __MATHCALL_NARROW(func, redir, nargs) \ @@ -588,7 +588,7 @@ extern double __REDIRECT_NTH (nexttoward, (double __x, long double __y), # undef __MATHCALL_NARROW # define __MATHCALL_NARROW(func, redir, nargs) \ __MATHCALL_NARROW_REDIR (func, redir, nargs) -# elif __LONG_DOUBLE_USES_FLOAT128 == 1 +# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 # define __MATHCALL_REDIR_NAME(name) __ ## f64 ## name ## ieee128 # undef __MATHCALL_NARROW # define __MATHCALL_NARROW(func, redir, nargs) \ @@ -599,7 +599,7 @@ extern double __REDIRECT_NTH (nexttoward, (double __x, long double __y), # undef _Marg_ # undef __MATHCALL_NAME # if defined __LDBL_COMPAT \ - || __LONG_DOUBLE_USES_FLOAT128 == 1 + || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 # undef __MATHCALL_REDIR_NAME # undef __MATHCALL_NARROW # define __MATHCALL_NARROW(func, redir, nargs) \ diff --git a/math/test-ldouble.h b/math/test-ldouble.h index b9ef6f41f9..3d62c92e14 100644 --- a/math/test-ldouble.h +++ b/math/test-ldouble.h @@ -29,7 +29,7 @@ /* On architectures which redirect long double to _Float128 ABI, we must choose the float128 ulps. Similarly, on such architectures, the ABI used may be dependent on how the compiler was invoked. */ -#elif __LONG_DOUBLE_USES_FLOAT128 == 1 +#elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 # define TYPE_STR "float128" # define ULP_IDX ULP_FLT128 #else diff --git a/misc/err.h b/misc/err.h index d146a55054..e56cd73c0e 100644 --- a/misc/err.h +++ b/misc/err.h @@ -53,7 +53,7 @@ extern void verrx (int __status, const char *, __gnuc_va_list) __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0))); #include <bits/floatn.h> -#if defined __LDBL_COMPAT || __LONG_DOUBLE_USES_FLOAT128 == 1 +#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 # include <bits/err-ldbl.h> #endif diff --git a/misc/error.h b/misc/error.h index bb8a3b26a4..41d54c568f 100644 --- a/misc/error.h +++ b/misc/error.h @@ -48,7 +48,7 @@ extern unsigned int error_message_count; extern int error_one_per_line; #include <bits/floatn.h> -#if defined __LDBL_COMPAT || __LONG_DOUBLE_USES_FLOAT128 == 1 +#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 # include <bits/error-ldbl.h> #else /* Do not inline error and error_at_line when long double has the same diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h index dd5f69f833..9fa371ab86 100644 --- a/misc/sys/cdefs.h +++ b/misc/sys/cdefs.h @@ -452,7 +452,7 @@ #include <bits/wordsize.h> #include <bits/long-double.h> -#if __LONG_DOUBLE_USES_FLOAT128 == 1 +#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 # ifdef __REDIRECT /* Alias name defined automatically. */ @@ -503,7 +503,7 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf __LDBL_REDIR1_NTH (name, proto, __nldbl_##alias) # endif |
