From 104d2005d5b7fb13a970905ca3f4a7e7e783cf1a Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Tue, 6 Apr 2021 14:33:14 -0300 Subject: math: Remove the error handling wrapper from hypot and hypotf The error handling is moved to sysdeps/ieee754 version with no SVID support. The compatibility symbol versions still use the wrapper with SVID error handling around the new code. There is no new symbol version nor compatibility code on !LIBM_SVID_COMPAT targets (e.g. riscv). Only ia64 is unchanged, since it still uses the arch specific __libm_error_region on its implementation. Checked on x86_64-linux-gnu, i686-linux-gnu, and aarch64-linux-gnu. --- math/Versions | 2 ++ math/w_hypot.c | 8 ++++++++ math/w_hypot_compat.c | 13 ++++++++++--- math/w_hypotf.c | 8 ++++++++ math/w_hypotf_compat.c | 6 +++--- 5 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 math/w_hypot.c create mode 100644 math/w_hypotf.c (limited to 'math') diff --git a/math/Versions b/math/Versions index a4b5405ddc..fef7a08c3b 100644 --- a/math/Versions +++ b/math/Versions @@ -628,5 +628,7 @@ libm { fminimum_numf64x; fminimum_numf128; fminimum_magf64x; fminimum_magf128; fminimum_mag_numf64x; fminimum_mag_numf128; + # No SVID compatible error handling. + hypotf; hypot; } } diff --git a/math/w_hypot.c b/math/w_hypot.c new file mode 100644 index 0000000000..66f723a896 --- /dev/null +++ b/math/w_hypot.c @@ -0,0 +1,8 @@ +#include +#undef __USE_WRAPPER_TEMPLATE +#define __USE_WRAPPER_TEMPLATE 1 +#undef declare_mgen_alias +#define declare_mgen_alias(a, b) +#include +versioned_symbol (libm, __hypot, hypot, GLIBC_2_35); +libm_alias_float_other (__hypot, hypot) diff --git a/math/w_hypot_compat.c b/math/w_hypot_compat.c index f07039cc51..ec983a4ab8 100644 --- a/math/w_hypot_compat.c +++ b/math/w_hypot_compat.c @@ -20,9 +20,9 @@ #include -#if LIBM_SVID_COMPAT +#if LIBM_SVID_COMPAT && SHLIB_COMPAT (libm, GLIBC_2_0, GLIBC_2_35) double -__hypot (double x, double y) +__hypot_compat (double x, double y) { double z = __ieee754_hypot(x,y); if(__builtin_expect(!isfinite(z), 0) @@ -31,5 +31,12 @@ __hypot (double x, double y) return z; } -libm_alias_double (__hypot, hypot) +compat_symbol (libm, __hypot_compat, hypot, GLIBC_2_0); +# ifdef NO_LONG_DOUBLE +weak_alias (__hypot_compat, hypotl) +# endif +# ifdef LONG_DOUBLE_COMPAT +LONG_DOUBLE_COMPAT_CHOOSE_libm_hypotl ( + compat_symbol (libm, __hypot_compat, hypotl, FIRST_VERSION_libm_hypotl), ); +# endif #endif diff --git a/math/w_hypotf.c b/math/w_hypotf.c new file mode 100644 index 0000000000..b15a9b06d0 --- /dev/null +++ b/math/w_hypotf.c @@ -0,0 +1,8 @@ +#include +#undef __USE_WRAPPER_TEMPLATE +#define __USE_WRAPPER_TEMPLATE 1 +#undef declare_mgen_alias +#define declare_mgen_alias(a, b) +#include +versioned_symbol (libm, __hypotf, hypotf, GLIBC_2_35); +libm_alias_float_other (__hypotf, hypotf) diff --git a/math/w_hypotf_compat.c b/math/w_hypotf_compat.c index 05898d3420..2bde4553b0 100644 --- a/math/w_hypotf_compat.c +++ b/math/w_hypotf_compat.c @@ -22,9 +22,9 @@ #include -#if LIBM_SVID_COMPAT +#if LIBM_SVID_COMPAT && SHLIB_COMPAT (libm, GLIBC_2_0, GLIBC_2_35) float -__hypotf(float x, float y) +__hypotf_compat (float x, float y) { float z = __ieee754_hypotf(x,y); if(__builtin_expect(!isfinite(z), 0) @@ -34,5 +34,5 @@ __hypotf(float x, float y) return z; } -libm_alias_float (__hypot, hypot) +compat_symbol (libm, __hypotf_compat, hypotf, GLIBC_2_0); #endif -- cgit 1.4.1