From 5ce8f125063cfd8660710a80243cb705e66f0626 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Thu, 29 Oct 2015 22:29:21 +0000 Subject: [PATCH] Make drem an alias of remainder (bug 16171). The libm drem functions just call the corresponding __remainder functions. This patch removes the unnecessary wrappers by making them into weak aliases at the ELF level. Tested for x86_64, x86, mips64 and powerpc. [BZ #16171] * math/w_remainder.c (drem): Define as weak alias of __remainder. [NO_LONG_DOUBLE] (dreml): Define as weak alias of __remainder. * math/w_remainderf.c (dremf): Define as weak alias of __remainderf. * math/w_remainderl.c (dreml): Define as weak alias of __remainderl. * sysdeps/ia64/fpu/e_remainder.S (drem): Define as weak alias of __remainder. * sysdeps/ia64/fpu/e_remainderf.S (dremf): Define as weak alias of __remainderf. * sysdeps/ia64/fpu/e_remainderl.S (dreml): Define as weak alias of __remainderl. * sysdeps/ieee754/ldbl-opt/nldbl-remainder.c (dreml): Define as weak alias of remainderl. * sysdeps/ieee754/ldbl-opt/w_remainder.c [LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)] (__drem): Define as strong alias of __remainder. [LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)] (dreml): Use compat_symbol. * sysdeps/ieee754/ldbl-opt/w_remainderl.c (__dreml): Define as strong alias of __remainderl. (dreml): Use long_double_symbol. * math/Makefile (libm-calls): Remove w_drem. * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Remove drem. (CFLAGS-nldbl-drem.c): Remove variable. (CFLAGS-nldbl-remainder.c): Add -fno-builtin-dreml. * math/w_drem.c: Remove file. * math/w_dremf.c: Likewise. * math/w_dreml.c: Likewise. * sysdeps/ieee754/ldbl-opt/nldbl-drem.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_drem.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_dreml.c: Likewise. --- ChangeLog | 33 ++++++++++++++++++++++++++++++ NEWS | 24 +++++++++++----------- math/Makefile | 2 +- math/w_drem.c | 19 ----------------- math/w_dremf.c | 16 --------------- math/w_dreml.c | 17 --------------- math/w_remainder.c | 2 ++ math/w_remainderf.c | 1 + math/w_remainderl.c | 1 + sysdeps/ia64/fpu/e_remainder.S | 1 + sysdeps/ia64/fpu/e_remainderf.S | 1 + sysdeps/ia64/fpu/e_remainderl.S | 1 + sysdeps/ieee754/ldbl-opt/Makefile | 5 ++--- sysdeps/ieee754/ldbl-opt/nldbl-drem.c | 8 -------- sysdeps/ieee754/ldbl-opt/nldbl-remainder.c | 2 ++ sysdeps/ieee754/ldbl-opt/w_drem.c | 5 ----- sysdeps/ieee754/ldbl-opt/w_dreml.c | 5 ----- sysdeps/ieee754/ldbl-opt/w_remainder.c | 2 ++ sysdeps/ieee754/ldbl-opt/w_remainderl.c | 2 ++ 19 files changed, 61 insertions(+), 86 deletions(-) delete mode 100644 math/w_drem.c delete mode 100644 math/w_dremf.c delete mode 100644 math/w_dreml.c delete mode 100644 sysdeps/ieee754/ldbl-opt/nldbl-drem.c delete mode 100644 sysdeps/ieee754/ldbl-opt/w_drem.c delete mode 100644 sysdeps/ieee754/ldbl-opt/w_dreml.c diff --git a/ChangeLog b/ChangeLog index ab88beee2c..e938a5338f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,38 @@ 2015-10-29 Joseph Myers + [BZ #16171] + * math/w_remainder.c (drem): Define as weak alias of __remainder. + [NO_LONG_DOUBLE] (dreml): Define as weak alias of __remainder. + * math/w_remainderf.c (dremf): Define as weak alias of + __remainderf. + * math/w_remainderl.c (dreml): Define as weak alias of + __remainderl. + * sysdeps/ia64/fpu/e_remainder.S (drem): Define as weak alias of + __remainder. + * sysdeps/ia64/fpu/e_remainderf.S (dremf): Define as weak alias of + __remainderf. + * sysdeps/ia64/fpu/e_remainderl.S (dreml): Define as weak alias of + __remainderl. + * sysdeps/ieee754/ldbl-opt/nldbl-remainder.c (dreml): Define as + weak alias of remainderl. + * sysdeps/ieee754/ldbl-opt/w_remainder.c + [LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)] (__drem): Define as strong + alias of __remainder. + [LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)] (dreml): Use compat_symbol. + * sysdeps/ieee754/ldbl-opt/w_remainderl.c (__dreml): Define as + strong alias of __remainderl. + (dreml): Use long_double_symbol. + * math/Makefile (libm-calls): Remove w_drem. + * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Remove drem. + (CFLAGS-nldbl-drem.c): Remove variable. + (CFLAGS-nldbl-remainder.c): Add -fno-builtin-dreml. + * math/w_drem.c: Remove file. + * math/w_dremf.c: Likewise. + * math/w_dreml.c: Likewise. + * sysdeps/ieee754/ldbl-opt/nldbl-drem.c: Likewise. + * sysdeps/ieee754/ldbl-opt/w_drem.c: Likewise. + * sysdeps/ieee754/ldbl-opt/w_dreml.c: Likewise. + * sysdeps/i386/configure.ac (cpuid.h): Do not test for header. * sysdeps/i386/configure: Regenerated. * sysdeps/x86_64/configure.ac (cpuid.h): Do not test for header. diff --git a/NEWS b/NEWS index 0831d35881..ae89162d81 100644 --- a/NEWS +++ b/NEWS @@ -10,18 +10,18 @@ Version 2.23 * The following bugs are resolved with this release: 887, 2542, 2543, 2558, 2898, 4404, 6803, 10432, 14341, 14912, 15367, - 15384, 15470, 15491, 15786, 15918, 16068, 16141, 16296, 16347, 16399, - 16415, 16422, 16517, 16519, 16520, 16521, 16620, 16734, 16973, 16985, - 17118, 17243, 17244, 17250, 17404, 17441, 17787, 17886, 17887, 17905, - 18084, 18086, 18240, 18265, 18370, 18421, 18480, 18525, 18595, 18589, - 18610, 18611, 18618, 18647, 18661, 18674, 18675, 18681, 18699, 18724, - 18743, 18757, 18778, 18781, 18787, 18789, 18790, 18795, 18796, 18803, - 18820, 18823, 18824, 18825, 18857, 18863, 18870, 18872, 18873, 18875, - 18887, 18918, 18921, 18928, 18951, 18952, 18953, 18956, 18961, 18966, - 18967, 18969, 18970, 18977, 18980, 18981, 18982, 18985, 19003, 19007, - 19012, 19016, 19018, 19032, 19046, 19048, 19049, 19050, 19059, 19071, - 19074, 19076, 19077, 19078, 19079, 19085, 19086, 19088, 19094, 19095, - 19124, 19125, 19129, 19134, 19137, 19156, 19174, 19181. + 15384, 15470, 15491, 15786, 15918, 16068, 16141, 16171, 16296, 16347, + 16399, 16415, 16422, 16517, 16519, 16520, 16521, 16620, 16734, 16973, + 16985, 17118, 17243, 17244, 17250, 17404, 17441, 17787, 17886, 17887, + 17905, 18084, 18086, 18240, 18265, 18370, 18421, 18480, 18525, 18595, + 18589, 18610, 18611, 18618, 18647, 18661, 18674, 18675, 18681, 18699, + 18724, 18743, 18757, 18778, 18781, 18787, 18789, 18790, 18795, 18796, + 18803, 18820, 18823, 18824, 18825, 18857, 18863, 18870, 18872, 18873, + 18875, 18887, 18918, 18921, 18928, 18951, 18952, 18953, 18956, 18961, + 18966, 18967, 18969, 18970, 18977, 18980, 18981, 18982, 18985, 19003, + 19007, 19012, 19016, 19018, 19032, 19046, 19048, 19049, 19050, 19059, + 19071, 19074, 19076, 19077, 19078, 19079, 19085, 19086, 19088, 19094, + 19095, 19124, 19125, 19129, 19134, 19137, 19156, 19174, 19181. * A defect in the malloc implementation, present since glibc 2.15 (2012) or glibc 2.10 via --enable-experimental-malloc (2009), could result in the diff --git a/math/Makefile b/math/Makefile index dedd7ee5ea..3efbc58d5c 100644 --- a/math/Makefile +++ b/math/Makefile @@ -51,7 +51,7 @@ libm-calls = e_acos e_acosh e_asin e_atan2 e_atanh e_cosh e_exp e_fmod \ s_floor s_log1p w_log1p s_logb \ s_nextafter s_nexttoward s_rint s_scalbln w_scalbln \ s_significand s_sin s_tan s_tanh w_acos w_acosh w_asin \ - w_atan2 w_atanh w_cosh w_drem w_exp w_exp2 w_exp10 w_fmod \ + w_atan2 w_atanh w_cosh w_exp w_exp2 w_exp10 w_fmod \ w_tgamma w_hypot w_j0 w_j1 w_jn w_lgamma w_lgamma_r \ w_log w_log10 w_pow w_remainder w_scalb w_sinh w_sqrt \ w_ilogb \ diff --git a/math/w_drem.c b/math/w_drem.c deleted file mode 100644 index 843b67aa80..0000000000 --- a/math/w_drem.c +++ /dev/null @@ -1,19 +0,0 @@ -/* - * drem() wrapper for remainder(). - * - * Written by J.T. Conklin, - * Placed into the Public Domain, 1994. - */ - -#include - -double -__drem (double x, double y) -{ - return __remainder(x, y); -} -weak_alias (__drem, drem) -#ifdef NO_LONG_DOUBLE -strong_alias (__drem, __dreml) -weak_alias (__drem, dreml) -#endif diff --git a/math/w_dremf.c b/math/w_dremf.c deleted file mode 100644 index c5e7c63af5..0000000000 --- a/math/w_dremf.c +++ /dev/null @@ -1,16 +0,0 @@ -/* - * dremf() wrapper for remainderf(). - * - * Written by J.T. Conklin, - * Placed into the Public Domain, 1994. - */ - -#include -#include - -float -__dremf (float x, float y) -{ - return __remainderf(x, y); -} -weak_alias (__dremf, dremf) diff --git a/math/w_dreml.c b/math/w_dreml.c deleted file mode 100644 index 8d0139ac28..0000000000 --- a/math/w_dreml.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * dreml() wrapper for remainderl(). - * - * Written by J.T. Conklin, - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - * Placed into the Public Domain, 1994. - */ - -#include - -long double -__dreml (long double x, long double y) -{ - return __remainderl(x, y); -} -weak_alias (__dreml, dreml) diff --git a/math/w_remainder.c b/math/w_remainder.c index a6da1921dc..aa70f0213f 100644 --- a/math/w_remainder.c +++ b/math/w_remainder.c @@ -32,7 +32,9 @@ __remainder (double x, double y) return __ieee754_remainder (x, y); } weak_alias (__remainder, remainder) +weak_alias (__remainder, drem) #ifdef NO_LONG_DOUBLE strong_alias (__remainder, __remainderl) weak_alias (__remainder, remainderl) +weak_alias (__remainder, dreml) #endif diff --git a/math/w_remainderf.c b/math/w_remainderf.c index c003002287..beb07756c5 100644 --- a/math/w_remainderf.c +++ b/math/w_remainderf.c @@ -32,3 +32,4 @@ __remainderf (float x, float y) return __ieee754_remainderf (x, y); } weak_alias (__remainderf, remainderf) +weak_alias (__remainderf, dremf) diff --git a/math/w_remainderl.c b/math/w_remainderl.c index b25929d16e..393c99aad0 100644 --- a/math/w_remainderl.c +++ b/math/w_remainderl.c @@ -32,3 +32,4 @@ __remainderl (long double x, long double y) return __ieee754_remainderl (x, y); } weak_alias (__remainderl, remainderl) +weak_alias (__remainderl, dreml) diff --git a/sysdeps/ia64/fpu/e_remainder.S b/sysdeps/ia64/fpu/e_remainder.S index 3e065171b3..3cd5aac578 100644 --- a/sysdeps/ia64/fpu/e_remainder.S +++ b/sysdeps/ia64/fpu/e_remainder.S @@ -529,6 +529,7 @@ EXP_ERROR_RETURN: } GLOBAL_IEEE754_END(remainder) +weak_alias (__remainder, drem) diff --git a/sysdeps/ia64/fpu/e_remainderf.S b/sysdeps/ia64/fpu/e_remainderf.S index 2d7385d568..df4cfdddc8 100644 --- a/sysdeps/ia64/fpu/e_remainderf.S +++ b/sysdeps/ia64/fpu/e_remainderf.S @@ -548,6 +548,7 @@ EXP_ERROR_RETURN: } GLOBAL_IEEE754_END(remainderf) +weak_alias (__remainderf, dremf) diff --git a/sysdeps/ia64/fpu/e_remainderl.S b/sysdeps/ia64/fpu/e_remainderl.S index 30658e5487..d9a9ee8d29 100644 --- a/sysdeps/ia64/fpu/e_remainderl.S +++ b/sysdeps/ia64/fpu/e_remainderl.S @@ -557,6 +557,7 @@ EXP_ERROR_RETURN: } GLOBAL_IEEE754_END(remainderl) +weak_alias (__remainderl, dreml) LOCAL_LIBM_ENTRY(__libm_error_region) .prologue diff --git a/sysdeps/ieee754/ldbl-opt/Makefile b/sysdeps/ieee754/ldbl-opt/Makefile index 222122de0b..53091e410c 100644 --- a/sysdeps/ieee754/ldbl-opt/Makefile +++ b/sysdeps/ieee754/ldbl-opt/Makefile @@ -31,7 +31,7 @@ libnldbl-calls = asprintf dprintf fprintf fscanf fwprintf fwscanf iovfscanf \ tanh acosh asinh atanh exp log log10 exp10 pow10 expm1 \ log1p logb exp2 sqrt cbrt fabs floor j0 j1 y0 y1 erf erfc \ lgamma tgamma gamma rint nearbyint round trunc \ - copysign fdim fmax fmin nextafter pow hypot fmod drem \ + copysign fdim fmax fmin nextafter pow hypot fmod \ remainder ldexp scalbn frexp modf scalbln fma nan sincos \ jn yn ilogb remquo lrint lround llrint llround nexttowardf \ nexttoward conj cacos cacosh casin catan catanh ccos ccosh \ @@ -81,7 +81,6 @@ CFLAGS-nldbl-csinh.c = -fno-builtin-csinhl CFLAGS-nldbl-csqrt.c = -fno-builtin-csqrtl CFLAGS-nldbl-ctan.c = -fno-builtin-ctanl CFLAGS-nldbl-ctanh.c = -fno-builtin-ctanhl -CFLAGS-nldbl-drem.c = -fno-builtin-dreml CFLAGS-nldbl-erf.c = -fno-builtin-erfl CFLAGS-nldbl-erfc.c = -fno-builtin-erfcl CFLAGS-nldbl-exp.c = -fno-builtin-expl @@ -125,7 +124,7 @@ CFLAGS-nldbl-nexttoward.c = -fno-builtin-nexttoward -fno-builtin-nexttowardl CFLAGS-nldbl-nexttowardf.c = -fno-builtin-nexttowardf CFLAGS-nldbl-pow.c = -fno-builtin-powl CFLAGS-nldbl-pow10.c = -fno-builtin-pow10l -CFLAGS-nldbl-remainder.c = -fno-builtin-remainderl +CFLAGS-nldbl-remainder.c = -fno-builtin-remainderl -fno-builtin-dreml CFLAGS-nldbl-remquo.c = -fno-builtin-remquol CFLAGS-nldbl-rint.c = -fno-builtin-rintl CFLAGS-nldbl-round.c = -fno-builtin-roundl diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-drem.c b/sysdeps/ieee754/ldbl-opt/nldbl-drem.c deleted file mode 100644 index 1e08ce1d28..0000000000 --- a/sysdeps/ieee754/ldbl-opt/nldbl-drem.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "nldbl-compat.h" - -double -attribute_hidden -dreml (double x, double y) -{ - return drem (x, y); -} diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-remainder.c b/sysdeps/ieee754/ldbl-opt/nldbl-remainder.c index a8d5bafb5f..581dc78a4d 100644 --- a/sysdeps/ieee754/ldbl-opt/nldbl-remainder.c +++ b/sysdeps/ieee754/ldbl-opt/nldbl-remainder.c @@ -6,3 +6,5 @@ remainderl (double x, double y) { return remainder (x, y); } +extern __typeof (remainderl) dreml attribute_hidden; +weak_alias (remainderl, dreml) diff --git a/sysdeps/ieee754/ldbl-opt/w_drem.c b/sysdeps/ieee754/ldbl-opt/w_drem.c deleted file mode 100644 index 788a5d29d6..0000000000 --- a/sysdeps/ieee754/ldbl-opt/w_drem.c +++ /dev/null @@ -1,5 +0,0 @@ -#include -#include -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) -compat_symbol (libm, __drem, dreml, GLIBC_2_0); -#endif diff --git a/sysdeps/ieee754/ldbl-opt/w_dreml.c b/sysdeps/ieee754/ldbl-opt/w_dreml.c deleted file mode 100644 index d14d7e202c..0000000000 --- a/sysdeps/ieee754/ldbl-opt/w_dreml.c +++ /dev/null @@ -1,5 +0,0 @@ -#include -#undef weak_alias -#define weak_alias(n,a) -#include -long_double_symbol (libm, __dreml, dreml); diff --git a/sysdeps/ieee754/ldbl-opt/w_remainder.c b/sysdeps/ieee754/ldbl-opt/w_remainder.c index 94d98930f4..dfa7b7f569 100644 --- a/sysdeps/ieee754/ldbl-opt/w_remainder.c +++ b/sysdeps/ieee754/ldbl-opt/w_remainder.c @@ -2,4 +2,6 @@ #include #if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) compat_symbol (libm, __remainder, remainderl, GLIBC_2_0); +strong_alias (__remainder, __drem) +compat_symbol (libm, __drem, dreml, GLIBC_2_0); #endif diff --git a/sysdeps/ieee754/ldbl-opt/w_remainderl.c b/sysdeps/ieee754/ldbl-opt/w_remainderl.c index e450a25bbc..7a344b7709 100644 --- a/sysdeps/ieee754/ldbl-opt/w_remainderl.c +++ b/sysdeps/ieee754/ldbl-opt/w_remainderl.c @@ -3,3 +3,5 @@ #define weak_alias(n,a) #include long_double_symbol (libm, __remainderl, remainderl); +strong_alias (__remainderl, __dreml) +long_double_symbol (libm, __dreml, dreml); -- 2.11.4.GIT