Discussion:
[PATCH] In _IEEE_LIBM mode, use weak symbols instead of wrapper funcs [v3]
Keith Packard
2018-09-21 19:53:02 UTC
Permalink
When the math library is compiled to just use bare IEEE_LIBM mode, many
public functions are just wrappers around the __ieee754 version.
Eliminate the extra function by creating a weak alias symbol for the
public name directly from the ieee754 name.

v2:
Use __weak_reference macro instead of using
'__attribute__((weak, alias' to make this code portable
to non-ELF systems.

v3:
Use __strong_reference macro instead of __weak_reference to
avoid changing the symbol in the resulting library. Make the
use of this and the un-definition of the wrapper functions
conditional on both the definition of _IEEE_LIBM and
__strong_reference so that systems without the latter will
still compile the wrapper functions and work properly.

Signed-off-by: Keith Packard <***@keithp.com>
---
newlib/libm/math/e_acos.c | 4 ++++
newlib/libm/math/e_acosh.c | 4 ++++
newlib/libm/math/e_asin.c | 4 ++++
newlib/libm/math/e_atan2.c | 4 ++++
newlib/libm/math/e_atanh.c | 4 ++++
newlib/libm/math/e_cosh.c | 4 ++++
newlib/libm/math/e_exp.c | 4 ++++
newlib/libm/math/e_fmod.c | 4 ++++
newlib/libm/math/e_hypot.c | 4 ++++
newlib/libm/math/e_j0.c | 8 ++++++++
newlib/libm/math/e_j1.c | 8 ++++++++
newlib/libm/math/e_jn.c | 8 ++++++++
newlib/libm/math/e_log.c | 4 ++++
newlib/libm/math/e_log10.c | 4 ++++
newlib/libm/math/e_pow.c | 4 ++++
newlib/libm/math/e_rem_pio2.c | 4 ++++
newlib/libm/math/e_remainder.c | 4 ++++
newlib/libm/math/e_scalb.c | 4 ++++
newlib/libm/math/e_sinh.c | 4 ++++
newlib/libm/math/e_sqrt.c | 4 ++++
newlib/libm/math/ef_acos.c | 4 ++++
newlib/libm/math/ef_acosh.c | 4 ++++
newlib/libm/math/ef_asin.c | 4 ++++
newlib/libm/math/ef_atan2.c | 4 ++++
newlib/libm/math/ef_atanh.c | 4 ++++
newlib/libm/math/ef_cosh.c | 4 ++++
newlib/libm/math/ef_exp.c | 4 ++++
newlib/libm/math/ef_fmod.c | 4 ++++
newlib/libm/math/ef_hypot.c | 4 ++++
newlib/libm/math/ef_j0.c | 8 ++++++++
newlib/libm/math/ef_j1.c | 8 ++++++++
newlib/libm/math/ef_jn.c | 8 ++++++++
newlib/libm/math/ef_log.c | 4 ++++
newlib/libm/math/ef_log10.c | 4 ++++
newlib/libm/math/ef_pow.c | 4 ++++
newlib/libm/math/ef_rem_pio2.c | 4 ++++
newlib/libm/math/ef_remainder.c | 4 ++++
newlib/libm/math/ef_scalb.c | 4 ++++
newlib/libm/math/ef_sinh.c | 4 ++++
newlib/libm/math/ef_sqrt.c | 4 ++++
newlib/libm/math/el_hypot.c | 4 ++++
newlib/libm/math/er_gamma.c | 4 ++++
newlib/libm/math/er_lgamma.c | 4 ++++
newlib/libm/math/erf_gamma.c | 4 ++++
newlib/libm/math/erf_lgamma.c | 4 ++++
newlib/libm/math/w_acos.c | 6 ++----
newlib/libm/math/w_acosh.c | 7 +++----
newlib/libm/math/w_asin.c | 6 ++----
newlib/libm/math/w_atanh.c | 10 ++--------
newlib/libm/math/w_cosh.c | 8 +++-----
newlib/libm/math/w_exp.c | 6 ++----
newlib/libm/math/w_fmod.c | 6 ++----
newlib/libm/math/w_hypot.c | 6 ++----
newlib/libm/math/w_j0.c | 12 ++++--------
newlib/libm/math/w_j1.c | 12 ++++--------
newlib/libm/math/w_jn.c | 12 ++++--------
newlib/libm/math/w_log.c | 6 ++----
newlib/libm/math/w_log10.c | 6 ++----
newlib/libm/math/w_pow.c | 6 ++----
newlib/libm/math/w_remainder.c | 6 ++----
newlib/libm/math/w_scalb.c | 7 +++----
newlib/libm/math/w_sinh.c | 6 ++----
newlib/libm/math/w_sqrt.c | 6 ++----
newlib/libm/math/wf_acos.c | 6 ++----
newlib/libm/math/wf_acosh.c | 6 ++----
newlib/libm/math/wf_asin.c | 6 ++----
newlib/libm/math/wf_atanh.c | 6 ++----
newlib/libm/math/wf_cosh.c | 6 ++----
newlib/libm/math/wf_exp.c | 6 ++----
newlib/libm/math/wf_fmod.c | 6 ++----
newlib/libm/math/wf_gamma.c | 6 ++----
newlib/libm/math/wf_hypot.c | 6 ++----
newlib/libm/math/wf_j0.c | 12 ++++--------
newlib/libm/math/wf_j1.c | 12 ++++--------
newlib/libm/math/wf_jn.c | 12 ++++--------
newlib/libm/math/wf_lgamma.c | 6 ++----
newlib/libm/math/wf_log.c | 6 ++----
newlib/libm/math/wf_log10.c | 6 ++----
newlib/libm/math/wf_pow.c | 6 ++----
newlib/libm/math/wf_remainder.c | 6 ++----
newlib/libm/math/wf_scalb.c | 6 ++----
newlib/libm/math/wf_sinh.c | 6 ++----
newlib/libm/math/wf_sqrt.c | 6 ++----
newlib/libm/math/wr_gamma.c | 6 ++----
newlib/libm/math/wr_lgamma.c | 6 ++----
newlib/libm/math/wrf_gamma.c | 6 ++----
newlib/libm/math/wrf_lgamma.c | 6 ++----
87 files changed, 303 insertions(+), 197 deletions(-)

diff --git a/newlib/libm/math/e_acos.c b/newlib/libm/math/e_acos.c
index 319b1d56f..58704d32c 100644
--- a/newlib/libm/math/e_acos.c
+++ b/newlib/libm/math/e_acos.c
@@ -59,6 +59,10 @@ qS2 = 2.02094576023350569471e+00, /* 0x40002AE5, 0x9C598AC8 */
qS3 = -6.88283971605453293030e-01, /* 0xBFE6066C, 0x1B8D0159 */
qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_acos, acos);
+#endif
+
#ifdef __STDC__
double __ieee754_acos(double x)
#else
diff --git a/newlib/libm/math/e_acosh.c b/newlib/libm/math/e_acosh.c
index 27984eb23..40fa60b10 100644
--- a/newlib/libm/math/e_acosh.c
+++ b/newlib/libm/math/e_acosh.c
@@ -38,6 +38,10 @@ static double
one = 1.0,
ln2 = 6.93147180559945286227e-01; /* 0x3FE62E42, 0xFEFA39EF */

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_acosh, acosh);
+#endif
+
#ifdef __STDC__
double __ieee754_acosh(double x)
#else
diff --git a/newlib/libm/math/e_asin.c b/newlib/libm/math/e_asin.c
index 4b6f45e15..6549e5630 100644
--- a/newlib/libm/math/e_asin.c
+++ b/newlib/libm/math/e_asin.c
@@ -68,6 +68,10 @@ qS2 = 2.02094576023350569471e+00, /* 0x40002AE5, 0x9C598AC8 */
qS3 = -6.88283971605453293030e-01, /* 0xBFE6066C, 0x1B8D0159 */
qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_asin, asin);
+#endif
+
#ifdef __STDC__
double __ieee754_asin(double x)
#else
diff --git a/newlib/libm/math/e_atan2.c b/newlib/libm/math/e_atan2.c
index 8e9650f29..54cc63693 100644
--- a/newlib/libm/math/e_atan2.c
+++ b/newlib/libm/math/e_atan2.c
@@ -55,6 +55,10 @@ pi_o_2 = 1.5707963267948965580E+00, /* 0x3FF921FB, 0x54442D18 */
pi = 3.1415926535897931160E+00, /* 0x400921FB, 0x54442D18 */
pi_lo = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_atan2, atan2);
+#endif
+
#ifdef __STDC__
double __ieee754_atan2(double y, double x)
#else
diff --git a/newlib/libm/math/e_atanh.c b/newlib/libm/math/e_atanh.c
index 58ad325f9..f56576652 100644
--- a/newlib/libm/math/e_atanh.c
+++ b/newlib/libm/math/e_atanh.c
@@ -46,6 +46,10 @@ static const double zero = 0.0;
static double zero = 0.0;
#endif

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_atanh, atanh);
+#endif
+
#ifdef __STDC__
double __ieee754_atanh(double x)
#else
diff --git a/newlib/libm/math/e_cosh.c b/newlib/libm/math/e_cosh.c
index a6310bd07..058cdbc34 100644
--- a/newlib/libm/math/e_cosh.c
+++ b/newlib/libm/math/e_cosh.c
@@ -42,6 +42,10 @@ static const double one = 1.0, half=0.5, huge = 1.0e300;
static double one = 1.0, half=0.5, huge = 1.0e300;
#endif

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_cosh, cosh);
+#endif
+
#ifdef __STDC__
double __ieee754_cosh(double x)
#else
diff --git a/newlib/libm/math/e_exp.c b/newlib/libm/math/e_exp.c
index 81ea64dfb..4d76e2974 100644
--- a/newlib/libm/math/e_exp.c
+++ b/newlib/libm/math/e_exp.c
@@ -102,6 +102,10 @@ P4 = -1.65339022054652515390e-06, /* 0xBEBBBD41, 0xC5D26BF1 */
P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */


+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_exp, exp);
+#endif
+
#ifdef __STDC__
double __ieee754_exp(double x) /* default IEEE double exp */
#else
diff --git a/newlib/libm/math/e_fmod.c b/newlib/libm/math/e_fmod.c
index f9739eec2..ddcc8efae 100644
--- a/newlib/libm/math/e_fmod.c
+++ b/newlib/libm/math/e_fmod.c
@@ -27,6 +27,10 @@ static const double one = 1.0, Zero[] = {0.0, -0.0,};
static double one = 1.0, Zero[] = {0.0, -0.0,};
#endif

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_fmod, fmod);
+#endif
+
#ifdef __STDC__
double __ieee754_fmod(double x, double y)
#else
diff --git a/newlib/libm/math/e_hypot.c b/newlib/libm/math/e_hypot.c
index 03f7f51e5..0663b52a4 100644
--- a/newlib/libm/math/e_hypot.c
+++ b/newlib/libm/math/e_hypot.c
@@ -47,6 +47,10 @@

#ifndef _DOUBLE_IS_32BITS

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_hypot, hypot);
+#endif
+
#ifdef __STDC__
double __ieee754_hypot(double x, double y)
#else
diff --git a/newlib/libm/math/e_j0.c b/newlib/libm/math/e_j0.c
index 13773cbf9..80e0dc672 100644
--- a/newlib/libm/math/e_j0.c
+++ b/newlib/libm/math/e_j0.c
@@ -91,6 +91,10 @@ static const double zero = 0.0;
static double zero = 0.0;
#endif

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_j0, j0);
+#endif
+
#ifdef __STDC__
double __ieee754_j0(double x)
#else
@@ -160,6 +164,10 @@ v02 = 7.60068627350353253702e-05, /* 0x3F13ECBB, 0xF578C6C1 */
v03 = 2.59150851840457805467e-07, /* 0x3E91642D, 0x7FF202FD */
v04 = 4.41110311332675467403e-10; /* 0x3DFE5018, 0x3BD6D9EF */

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_y0, y0);
+#endif
+
#ifdef __STDC__
double __ieee754_y0(double x)
#else
diff --git a/newlib/libm/math/e_j1.c b/newlib/libm/math/e_j1.c
index 098eb569e..0a95d7f63 100644
--- a/newlib/libm/math/e_j1.c
+++ b/newlib/libm/math/e_j1.c
@@ -92,6 +92,10 @@ static const double zero = 0.0;
static double zero = 0.0;
#endif

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_j1, j1);
+#endif
+
#ifdef __STDC__
double __ieee754_j1(double x)
#else
@@ -161,6 +165,10 @@ static double V0[5] = {
1.66559246207992079114e-11, /* 0x3DB25039, 0xDACA772A */
};

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_y1, y1);
+#endif
+
#ifdef __STDC__
double __ieee754_y1(double x)
#else
diff --git a/newlib/libm/math/e_jn.c b/newlib/libm/math/e_jn.c
index 1eea27be0..eedcf48e2 100644
--- a/newlib/libm/math/e_jn.c
+++ b/newlib/libm/math/e_jn.c
@@ -56,6 +56,10 @@ static const double zero = 0.00000000000000000000e+00;
static double zero = 0.00000000000000000000e+00;
#endif

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_jn, jn);
+#endif
+
#ifdef __STDC__
double __ieee754_jn(int n, double x)
#else
@@ -216,6 +220,10 @@ static double zero = 0.00000000000000000000e+00;
if(sgn==1) return -b; else return b;
}

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_yn, yn);
+#endif
+
#ifdef __STDC__
double __ieee754_yn(int n, double x)
#else
diff --git a/newlib/libm/math/e_log.c b/newlib/libm/math/e_log.c
index ac4a95068..5dbb20754 100644
--- a/newlib/libm/math/e_log.c
+++ b/newlib/libm/math/e_log.c
@@ -89,6 +89,10 @@ static const double zero = 0.0;
static double zero = 0.0;
#endif

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_log, log);
+#endif
+
#ifdef __STDC__
double __ieee754_log(double x)
#else
diff --git a/newlib/libm/math/e_log10.c b/newlib/libm/math/e_log10.c
index f7daaa1b2..88e0f9eff 100644
--- a/newlib/libm/math/e_log10.c
+++ b/newlib/libm/math/e_log10.c
@@ -64,6 +64,10 @@ static const double zero = 0.0;
static double zero = 0.0;
#endif

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_log10, log10);
+#endif
+
#ifdef __STDC__
double __ieee754_log10(double x)
#else
diff --git a/newlib/libm/math/e_pow.c b/newlib/libm/math/e_pow.c
index 6d2a501a1..ccb8df716 100644
--- a/newlib/libm/math/e_pow.c
+++ b/newlib/libm/math/e_pow.c
@@ -99,6 +99,10 @@ ivln2 = 1.44269504088896338700e+00, /* 0x3FF71547, 0x652B82FE =1/ln2 */
ivln2_h = 1.44269502162933349609e+00, /* 0x3FF71547, 0x60000000 =24b 1/ln2*/
ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_pow, pow);
+#endif
+
#ifdef __STDC__
double __ieee754_pow(double x, double y)
#else
diff --git a/newlib/libm/math/e_rem_pio2.c b/newlib/libm/math/e_rem_pio2.c
index ddfecba2d..db731662c 100644
--- a/newlib/libm/math/e_rem_pio2.c
+++ b/newlib/libm/math/e_rem_pio2.c
@@ -82,6 +82,10 @@ pio2_2t = 2.02226624879595063154e-21, /* 0x3BA3198A, 0x2E037073 */
pio2_3 = 2.02226624871116645580e-21, /* 0x3BA3198A, 0x2E000000 */
pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_rem_pio2, rem_pio2);
+#endif
+
#ifdef __STDC__
__int32_t __ieee754_rem_pio2(double x, double *y)
#else
diff --git a/newlib/libm/math/e_remainder.c b/newlib/libm/math/e_remainder.c
index ae7ce649a..7f2fba664 100644
--- a/newlib/libm/math/e_remainder.c
+++ b/newlib/libm/math/e_remainder.c
@@ -31,6 +31,10 @@ static double zero = 0.0;
#endif


+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_remainder, remainder);
+#endif
+
#ifdef __STDC__
double __ieee754_remainder(double x, double p)
#else
diff --git a/newlib/libm/math/e_scalb.c b/newlib/libm/math/e_scalb.c
index 4d8bb8b71..579ed1ee9 100644
--- a/newlib/libm/math/e_scalb.c
+++ b/newlib/libm/math/e_scalb.c
@@ -21,6 +21,10 @@

#ifndef _DOUBLE_IS_32BITS

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_scalb, scalb);
+#endif
+
#ifdef _SCALB_INT
#ifdef __STDC__
double __ieee754_scalb(double x, int fn)
diff --git a/newlib/libm/math/e_sinh.c b/newlib/libm/math/e_sinh.c
index cf7ebfb88..772a50d87 100644
--- a/newlib/libm/math/e_sinh.c
+++ b/newlib/libm/math/e_sinh.c
@@ -39,6 +39,10 @@ static const double one = 1.0, shuge = 1.0e307;
static double one = 1.0, shuge = 1.0e307;
#endif

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_sinh, sinh);
+#endif
+
#ifdef __STDC__
double __ieee754_sinh(double x)
#else
diff --git a/newlib/libm/math/e_sqrt.c b/newlib/libm/math/e_sqrt.c
index 78fc52417..7e8c3b55c 100644
--- a/newlib/libm/math/e_sqrt.c
+++ b/newlib/libm/math/e_sqrt.c
@@ -91,6 +91,10 @@ static const double one = 1.0, tiny=1.0e-300;
static double one = 1.0, tiny=1.0e-300;
#endif

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_sqrt, sqrt);
+#endif
+
#ifdef __STDC__
double __ieee754_sqrt(double x)
#else
diff --git a/newlib/libm/math/ef_acos.c b/newlib/libm/math/ef_acos.c
index f73f97de7..ca9e36d4f 100644
--- a/newlib/libm/math/ef_acos.c
+++ b/newlib/libm/math/ef_acos.c
@@ -35,6 +35,10 @@ qS2 = 2.0209457874e+00, /* 0x4001572d */
qS3 = -6.8828397989e-01, /* 0xbf303361 */
qS4 = 7.7038154006e-02; /* 0x3d9dc62e */

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_acosf, acosf);
+#endif
+
#ifdef __STDC__
float __ieee754_acosf(float x)
#else
diff --git a/newlib/libm/math/ef_acosh.c b/newlib/libm/math/ef_acosh.c
index 1119c2c86..4c31c049f 100644
--- a/newlib/libm/math/ef_acosh.c
+++ b/newlib/libm/math/ef_acosh.c
@@ -24,6 +24,10 @@ static float
one = 1.0,
ln2 = 6.9314718246e-01; /* 0x3f317218 */

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_acoshf, acoshf);
+#endif
+
#ifdef __STDC__
float __ieee754_acoshf(float x)
#else
diff --git a/newlib/libm/math/ef_asin.c b/newlib/libm/math/ef_asin.c
index c49dcbbca..3cff64ddd 100644
--- a/newlib/libm/math/ef_asin.c
+++ b/newlib/libm/math/ef_asin.c
@@ -37,6 +37,10 @@ qS2 = 2.0209457874e+00, /* 0x4001572d */
qS3 = -6.8828397989e-01, /* 0xbf303361 */
qS4 = 7.7038154006e-02; /* 0x3d9dc62e */

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_asinf, asinf);
+#endif
+
#ifdef __STDC__
float __ieee754_asinf(float x)
#else
diff --git a/newlib/libm/math/ef_atan2.c b/newlib/libm/math/ef_atan2.c
index d57480b03..80e0c1872 100644
--- a/newlib/libm/math/ef_atan2.c
+++ b/newlib/libm/math/ef_atan2.c
@@ -28,6 +28,10 @@ pi_o_2 = 1.5707963705e+00, /* 0x3fc90fdb */
pi = 3.1415927410e+00, /* 0x40490fdb */
pi_lo = -8.7422776573e-08; /* 0xb3bbbd2e */

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_atan2f, atan2f);
+#endif
+
#ifdef __STDC__
float __ieee754_atan2f(float y, float x)
#else
diff --git a/newlib/libm/math/ef_atanh.c b/newlib/libm/math/ef_atanh.c
index 74b3d3d6a..d558f99bc 100644
--- a/newlib/libm/math/ef_atanh.c
+++ b/newlib/libm/math/ef_atanh.c
@@ -28,6 +28,10 @@ static const float zero = 0.0;
static float zero = 0.0;
#endif

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_atanhf, atanhf);
+#endif
+
#ifdef __STDC__
float __ieee754_atanhf(float x)
#else
diff --git a/newlib/libm/math/ef_cosh.c b/newlib/libm/math/ef_cosh.c
index bdce61a00..565886b1a 100644
--- a/newlib/libm/math/ef_cosh.c
+++ b/newlib/libm/math/ef_cosh.c
@@ -25,6 +25,10 @@ static const float one = 1.0, half=0.5, huge = 1.0e30;
static float one = 1.0, half=0.5, huge = 1.0e30;
#endif

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_coshf, coshf);
+#endif
+
#ifdef __STDC__
float __ieee754_coshf(float x)
#else
diff --git a/newlib/libm/math/ef_exp.c b/newlib/libm/math/ef_exp.c
index e817370ac..0f107a7a2 100644
--- a/newlib/libm/math/ef_exp.c
+++ b/newlib/libm/math/ef_exp.c
@@ -40,6 +40,10 @@ P3 = 6.6137559770e-05, /* 0x388ab355 */
P4 = -1.6533901999e-06, /* 0xb5ddea0e */
P5 = 4.1381369442e-08; /* 0x3331bb4c */

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_expf, expf);
+#endif
+
#ifdef __STDC__
float __ieee754_expf(float x) /* default IEEE double exp */
#else
diff --git a/newlib/libm/math/ef_fmod.c b/newlib/libm/math/ef_fmod.c
index 53c1ba280..e419d94fa 100644
--- a/newlib/libm/math/ef_fmod.c
+++ b/newlib/libm/math/ef_fmod.c
@@ -27,6 +27,10 @@ static const float one = 1.0, Zero[] = {0.0, -0.0,};
static float one = 1.0, Zero[] = {0.0, -0.0,};
#endif

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_fmodf, fmodf);
+#endif
+
#ifdef __STDC__
float __ieee754_fmodf(float x, float y)
#else
diff --git a/newlib/libm/math/ef_hypot.c b/newlib/libm/math/ef_hypot.c
index 9368eb41c..0838e6f81 100644
--- a/newlib/libm/math/ef_hypot.c
+++ b/newlib/libm/math/ef_hypot.c
@@ -15,6 +15,10 @@

#include "fdlibm.h"

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_hypotf, hypotf);
+#endif
+
#ifdef __STDC__
float __ieee754_hypotf(float x, float y)
#else
diff --git a/newlib/libm/math/ef_j0.c b/newlib/libm/math/ef_j0.c
index 866cfcf96..e5df254db 100644
--- a/newlib/libm/math/ef_j0.c
+++ b/newlib/libm/math/ef_j0.c
@@ -46,6 +46,10 @@ static const float zero = 0.0;
static float zero = 0.0;
#endif

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_j0f, j0f);
+#endif
+
#ifdef __STDC__
float __ieee754_j0f(float x)
#else
@@ -115,6 +119,10 @@ v02 = 7.6006865129e-05, /* 0x389f65e0 */
v03 = 2.5915085189e-07, /* 0x348b216c */
v04 = 4.4111031494e-10; /* 0x2ff280c2 */

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_y0f, y0f);
+#endif
+
#ifdef __STDC__
float __ieee754_y0f(float x)
#else
diff --git a/newlib/libm/math/ef_j1.c b/newlib/libm/math/ef_j1.c
index 01bd24cf1..e070faed8 100644
--- a/newlib/libm/math/ef_j1.c
+++ b/newlib/libm/math/ef_j1.c
@@ -47,6 +47,10 @@ static const float zero = 0.0;
static float zero = 0.0;
#endif

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_j1f, j1f);
+#endif
+
#ifdef __STDC__
float __ieee754_j1f(float x)
#else
@@ -116,6 +120,10 @@ static float V0[5] = {
1.6655924903e-11, /* 0x2d9281cf */
};

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_y1f, y1f);
+#endif
+
#ifdef __STDC__
float __ieee754_y1f(float x)
#else
diff --git a/newlib/libm/math/ef_jn.c b/newlib/libm/math/ef_jn.c
index e872c09c7..f8409e488 100644
--- a/newlib/libm/math/ef_jn.c
+++ b/newlib/libm/math/ef_jn.c
@@ -29,6 +29,10 @@ static const float zero = 0.0000000000e+00;
static float zero = 0.0000000000e+00;
#endif

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_jnf, jnf);
+#endif
+
#ifdef __STDC__
float __ieee754_jnf(int n, float x)
#else
@@ -166,6 +170,10 @@ static float zero = 0.0000000000e+00;
if(sgn==1) return -b; else return b;
}

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_ynf, ynf);
+#endif
+
#ifdef __STDC__
float __ieee754_ynf(int n, float x)
#else
diff --git a/newlib/libm/math/ef_log.c b/newlib/libm/math/ef_log.c
index 8dc902478..9c1025a6a 100644
--- a/newlib/libm/math/ef_log.c
+++ b/newlib/libm/math/ef_log.c
@@ -38,6 +38,10 @@ static const float zero = 0.0;
static float zero = 0.0;
#endif

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_logf, logf);
+#endif
+
#ifdef __STDC__
float __ieee754_logf(float x)
#else
diff --git a/newlib/libm/math/ef_log10.c b/newlib/libm/math/ef_log10.c
index 5ab23c43f..1e016994d 100644
--- a/newlib/libm/math/ef_log10.c
+++ b/newlib/libm/math/ef_log10.c
@@ -31,6 +31,10 @@ static const float zero = 0.0;
static float zero = 0.0;
#endif

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_log10f, log10f);
+#endif
+
#ifdef __STDC__
float __ieee754_log10f(float x)
#else
diff --git a/newlib/libm/math/ef_pow.c b/newlib/libm/math/ef_pow.c
index 524e3f9b0..2b574dc67 100644
--- a/newlib/libm/math/ef_pow.c
+++ b/newlib/libm/math/ef_pow.c
@@ -57,6 +57,10 @@ ivln2 = 1.4426950216e+00, /* 0x3fb8aa3b =1/ln2 */
ivln2_h = 1.4426879883e+00, /* 0x3fb8aa00 =16b 1/ln2*/
ivln2_l = 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_powf, powf);
+#endif
+
#ifdef __STDC__
float __ieee754_powf(float x, float y)
#else
diff --git a/newlib/libm/math/ef_rem_pio2.c b/newlib/libm/math/ef_rem_pio2.c
index f1191d09f..1409a1c7b 100644
--- a/newlib/libm/math/ef_rem_pio2.c
+++ b/newlib/libm/math/ef_rem_pio2.c
@@ -95,6 +95,10 @@ pio2_2t = 6.0770999344e-11, /* 0x2e85a308 */
pio2_3 = 6.0770943833e-11, /* 0x2e85a300 */
pio2_3t = 6.1232342629e-17; /* 0x248d3132 */

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_rem_pio2f, rem_pio2f);
+#endif
+
#ifdef __STDC__
__int32_t __ieee754_rem_pio2f(float x, float *y)
#else
diff --git a/newlib/libm/math/ef_remainder.c b/newlib/libm/math/ef_remainder.c
index 23d29d05a..dcd17dc83 100644
--- a/newlib/libm/math/ef_remainder.c
+++ b/newlib/libm/math/ef_remainder.c
@@ -22,6 +22,10 @@ static float zero = 0.0;
#endif


+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_remainderf, remainderf);
+#endif
+
#ifdef __STDC__
float __ieee754_remainderf(float x, float p)
#else
diff --git a/newlib/libm/math/ef_scalb.c b/newlib/libm/math/ef_scalb.c
index 8d973b1e7..0bc6b7bdc 100644
--- a/newlib/libm/math/ef_scalb.c
+++ b/newlib/libm/math/ef_scalb.c
@@ -16,6 +16,10 @@
#include "fdlibm.h"
#include <limits.h>

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_scalbf, scalbf);
+#endif
+
#ifdef _SCALB_INT
#ifdef __STDC__
float __ieee754_scalbf(float x, int fn)
diff --git a/newlib/libm/math/ef_sinh.c b/newlib/libm/math/ef_sinh.c
index a61b17294..c99142419 100644
--- a/newlib/libm/math/ef_sinh.c
+++ b/newlib/libm/math/ef_sinh.c
@@ -15,6 +15,10 @@

#include "fdlibm.h"

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_sinhf, sinhf);
+#endif
+
#ifdef __STDC__
static const float one = 1.0, shuge = 1.0e37;
#else
diff --git a/newlib/libm/math/ef_sqrt.c b/newlib/libm/math/ef_sqrt.c
index 80e7f360e..8432a58a7 100644
--- a/newlib/libm/math/ef_sqrt.c
+++ b/newlib/libm/math/ef_sqrt.c
@@ -21,6 +21,10 @@ static const float one = 1.0, tiny=1.0e-30;
static float one = 1.0, tiny=1.0e-30;
#endif

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_sqrtf, sqrtf);
+#endif
+
#ifdef __STDC__
float __ieee754_sqrtf(float x)
#else
diff --git a/newlib/libm/math/el_hypot.c b/newlib/libm/math/el_hypot.c
index 737cde36b..241d3819c 100644
--- a/newlib/libm/math/el_hypot.c
+++ b/newlib/libm/math/el_hypot.c
@@ -6,6 +6,10 @@

#include "fdlibm.h"

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_hypotl, hypotl);
+#endif
+
long double
__ieee754_hypotl (long double x, long double y)
{
diff --git a/newlib/libm/math/er_gamma.c b/newlib/libm/math/er_gamma.c
index 3c0e241e5..5e521092d 100644
--- a/newlib/libm/math/er_gamma.c
+++ b/newlib/libm/math/er_gamma.c
@@ -21,6 +21,10 @@

#include "fdlibm.h"

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_gamma_r, gamma_r);
+#endif
+
#ifdef __STDC__
double __ieee754_gamma_r(double x, int *signgamp)
#else
diff --git a/newlib/libm/math/er_lgamma.c b/newlib/libm/math/er_lgamma.c
index 386a8a73b..1feab7e09 100644
--- a/newlib/libm/math/er_lgamma.c
+++ b/newlib/libm/math/er_lgamma.c
@@ -209,6 +209,10 @@ static double zero= 0.00000000000000000000e+00;
}


+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_lgamma_r, lgamma_r);
+#endif
+
#ifdef __STDC__
double __ieee754_lgamma_r(double x, int *signgamp)
#else
diff --git a/newlib/libm/math/erf_gamma.c b/newlib/libm/math/erf_gamma.c
index 9e529dce0..32bd74892 100644
--- a/newlib/libm/math/erf_gamma.c
+++ b/newlib/libm/math/erf_gamma.c
@@ -23,6 +23,10 @@

#include "fdlibm.h"

+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_gammaf_r, gammaf_r);
+#endif
+
#ifdef __STDC__
float __ieee754_gammaf_r(float x, int *signgamp)
#else
diff --git a/newlib/libm/math/erf_lgamma.c b/newlib/libm/math/erf_lgamma.c
index 3c6ba02af..cd9a5b81f 100644
--- a/newlib/libm/math/erf_lgamma.c
+++ b/newlib/libm/math/erf_lgamma.c
@@ -144,6 +144,10 @@ static float zero= 0.0000000000e+00;
}


+#if defined(_IEEE_LIBM) && defined(__strong_reference)
+__strong_reference(__ieee754_lgammaf_r, lgammaf_r);
+#endif
+
#ifdef __STDC__
float __ieee754_lgammaf_r(float x, int *signgamp)
#else
diff --git a/newlib/libm/math/w_acos.c b/newlib/libm/math/w_acos.c
index eb3e20111..12a68860d 100644
--- a/newlib/libm/math/w_acos.c
+++ b/newlib/libm/math/w_acos.c
@@ -70,6 +70,7 @@ MATHREF
#include "fdlibm.h"
#include <errno.h>

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifndef _DOUBLE_IS_32BITS

#ifdef __STDC__
@@ -79,9 +80,6 @@ MATHREF
double x;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_acos(x);
-#else
double z;
struct exception exc;
z = __ieee754_acos(x);
@@ -103,7 +101,7 @@ MATHREF
return exc.retval;
} else
return z;
-#endif
}

#endif /* defined(_DOUBLE_IS_32BITS) */
+#endif /* defined(_IEEE_LIBM) */
diff --git a/newlib/libm/math/w_acosh.c b/newlib/libm/math/w_acosh.c
index ac15bb1bd..d7887b1df 100644
--- a/newlib/libm/math/w_acosh.c
+++ b/newlib/libm/math/w_acosh.c
@@ -76,6 +76,8 @@ MATHREF
#include "fdlibm.h"
#include <errno.h>

+
+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifndef _DOUBLE_IS_32BITS

#ifdef __STDC__
@@ -85,9 +87,6 @@ MATHREF
double x;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_acosh(x);
-#else
double z;
struct exception exc;
z = __ieee754_acosh(x);
@@ -109,7 +108,7 @@ MATHREF
return exc.retval;
} else
return z;
-#endif
}

#endif /* defined(_DOUBLE_IS_32BITS) */
+#endif /* defined(_IEEE_LIBM) */
diff --git a/newlib/libm/math/w_asin.c b/newlib/libm/math/w_asin.c
index 9964d75b0..96074c3e2 100644
--- a/newlib/libm/math/w_asin.c
+++ b/newlib/libm/math/w_asin.c
@@ -76,6 +76,7 @@ MATHREF

#ifndef _DOUBLE_IS_32BITS

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
double asin(double x) /* wrapper asin */
#else
@@ -83,9 +84,6 @@ MATHREF
double x;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_asin(x);
-#else
double z;
struct exception exc;
z = __ieee754_asin(x);
@@ -107,7 +105,7 @@ MATHREF
return exc.retval;
} else
return z;
-#endif
}

#endif /* defined(_DOUBLE_IS_32BITS) */
+#endif
diff --git a/newlib/libm/math/w_atanh.c b/newlib/libm/math/w_atanh.c
index a87e23cc4..1156fbb06 100644
--- a/newlib/libm/math/w_atanh.c
+++ b/newlib/libm/math/w_atanh.c
@@ -74,6 +74,7 @@ QUICKREF
#include "fdlibm.h"
#include <errno.h>

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifndef _DOUBLE_IS_32BITS

#ifdef __STDC__
@@ -83,9 +84,6 @@ QUICKREF
double x;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_atanh(x);
-#else
double z,y;
struct exception exc;
z = __ieee754_atanh(x);
@@ -122,11 +120,7 @@ QUICKREF
return exc.retval;
} else
return z;
-#endif
}

#endif /* defined(_DOUBLE_IS_32BITS) */
-
-
-
-
+#endif
diff --git a/newlib/libm/math/w_cosh.c b/newlib/libm/math/w_cosh.c
index e5b08df00..81394a88d 100644
--- a/newlib/libm/math/w_cosh.c
+++ b/newlib/libm/math/w_cosh.c
@@ -60,8 +60,9 @@ QUICKREF
#include "fdlibm.h"
#include <errno.h>

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifndef _DOUBLE_IS_32BITS
-
+
#ifdef __STDC__
double cosh(double x) /* wrapper cosh */
#else
@@ -69,9 +70,6 @@ QUICKREF
double x;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_cosh(x);
-#else
double z;
struct exception exc;
z = __ieee754_cosh(x);
@@ -102,7 +100,7 @@ QUICKREF
return exc.retval;
} else
return z;
-#endif
}

#endif /* defined(_DOUBLE_IS_32BITS) */
+#endif
diff --git a/newlib/libm/math/w_exp.c b/newlib/libm/math/w_exp.c
index 0c4467712..d528649e4 100644
--- a/newlib/libm/math/w_exp.c
+++ b/newlib/libm/math/w_exp.c
@@ -58,6 +58,7 @@ PORTABILITY

#ifndef _DOUBLE_IS_32BITS

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
static const double
#else
@@ -73,9 +74,6 @@ u_threshold= -7.45133219101941108420e+02; /* 0xc0874910, 0xD52D3051 */
double x;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_exp(x);
-#else
double z;
struct exception exc;
z = __ieee754_exp(x);
@@ -123,8 +121,8 @@ u_threshold= -7.45133219101941108420e+02; /* 0xc0874910, 0xD52D3051 */
}
}
return z;
-#endif
}

#endif /* defined(_DOUBLE_IS_32BITS) */
+#endif
#endif /* __OBSOLETE_MATH */
diff --git a/newlib/libm/math/w_fmod.c b/newlib/libm/math/w_fmod.c
index df11dc34c..caee7cc1c 100644
--- a/newlib/libm/math/w_fmod.c
+++ b/newlib/libm/math/w_fmod.c
@@ -58,6 +58,7 @@ PORTABILITY

#ifndef _DOUBLE_IS_32BITS

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
double fmod(double x, double y) /* wrapper fmod */
#else
@@ -65,9 +66,6 @@ PORTABILITY
double x,y;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_fmod(x,y);
-#else
double z;
struct exception exc;
z = __ieee754_fmod(x,y);
@@ -93,7 +91,7 @@ PORTABILITY
return exc.retval;
} else
return z;
-#endif
}
+#endif

#endif /* defined(_DOUBLE_IS_32BITS) */
diff --git a/newlib/libm/math/w_hypot.c b/newlib/libm/math/w_hypot.c
index 533702277..ca8756fb7 100644
--- a/newlib/libm/math/w_hypot.c
+++ b/newlib/libm/math/w_hypot.c
@@ -55,6 +55,7 @@ PORTABILITY

#ifndef _DOUBLE_IS_32BITS

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
double hypot(double x, double y)/* wrapper hypot */
#else
@@ -62,9 +63,6 @@ PORTABILITY
double x,y;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_hypot(x,y);
-#else
double z;
struct exception exc;
z = __ieee754_hypot(x,y);
@@ -96,7 +94,7 @@ PORTABILITY
return exc.retval;
} else
return z;
-#endif
}
+#endif

#endif /* defined(_DOUBLE_IS_32BITS) */
diff --git a/newlib/libm/math/w_j0.c b/newlib/libm/math/w_j0.c
index ab05dbdeb..7882acd55 100644
--- a/newlib/libm/math/w_j0.c
+++ b/newlib/libm/math/w_j0.c
@@ -94,6 +94,7 @@ None of the Bessel functions are in ANSI C.

#ifndef _DOUBLE_IS_32BITS

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
double j0(double x) /* wrapper j0 */
#else
@@ -101,9 +102,6 @@ None of the Bessel functions are in ANSI C.
double x;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_j0(x);
-#else
struct exception exc;
double z = __ieee754_j0(x);
if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
@@ -124,9 +122,10 @@ None of the Bessel functions are in ANSI C.
return exc.retval;
} else
return z;
-#endif
}
+#endif

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
double y0(double x) /* wrapper y0 */
#else
@@ -134,9 +133,6 @@ None of the Bessel functions are in ANSI C.
double x;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_y0(x);
-#else
double z;
struct exception exc;
z = __ieee754_y0(x);
@@ -183,8 +179,8 @@ None of the Bessel functions are in ANSI C.
return exc.retval;
} else
return z;
-#endif
}
+#endif

#endif /* defined(_DOUBLE_IS_32BITS) */

diff --git a/newlib/libm/math/w_j1.c b/newlib/libm/math/w_j1.c
index ba7df1566..7fe7b391e 100644
--- a/newlib/libm/math/w_j1.c
+++ b/newlib/libm/math/w_j1.c
@@ -20,6 +20,7 @@

#ifndef _DOUBLE_IS_32BITS

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
double j1(double x) /* wrapper j1 */
#else
@@ -27,9 +28,6 @@
double x;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_j1(x);
-#else
double z;
struct exception exc;
z = __ieee754_j1(x);
@@ -51,9 +49,10 @@
return exc.retval;
} else
return z;
-#endif
}
+#endif

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
double y1(double x) /* wrapper y1 */
#else
@@ -61,9 +60,6 @@
double x;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_y1(x);
-#else
double z;
struct exception exc;
z = __ieee754_y1(x);
@@ -110,8 +106,8 @@
return exc.retval;
} else
return z;
-#endif
}
+#endif

#endif /* defined(_DOUBLE_IS_32BITS) */

diff --git a/newlib/libm/math/w_jn.c b/newlib/libm/math/w_jn.c
index 6cadc9a01..b8aa99007 100644
--- a/newlib/libm/math/w_jn.c
+++ b/newlib/libm/math/w_jn.c
@@ -42,6 +42,7 @@

#ifndef _DOUBLE_IS_32BITS

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
double jn(int n, double x) /* wrapper jn */
#else
@@ -49,9 +50,6 @@
double x; int n;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_jn(n,x);
-#else
double z;
struct exception exc;
z = __ieee754_jn(n,x);
@@ -74,9 +72,10 @@
return exc.retval;
} else
return z;
-#endif
}
+#endif

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
double yn(int n, double x) /* wrapper yn */
#else
@@ -84,9 +83,6 @@
double x; int n;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_yn(n,x);
-#else
double z;
struct exception exc;
z = __ieee754_yn(n,x);
@@ -135,7 +131,7 @@
return exc.retval;
} else
return z;
-#endif
}
+#endif

#endif /* defined(_DOUBLE_IS_32BITS) */
diff --git a/newlib/libm/math/w_log.c b/newlib/libm/math/w_log.c
index 5f66d26ad..4d07b8711 100644
--- a/newlib/libm/math/w_log.c
+++ b/newlib/libm/math/w_log.c
@@ -54,6 +54,7 @@ PORTABILITY

#ifndef _DOUBLE_IS_32BITS

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
double log(double x) /* wrapper log */
#else
@@ -61,9 +62,6 @@ PORTABILITY
double x;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_log(x);
-#else
double z;
struct exception exc;
z = __ieee754_log(x);
@@ -103,8 +101,8 @@ PORTABILITY
if (exc.err != 0)
errno = exc.err;
return exc.retval;
-#endif
}
+#endif

#endif /* defined(_DOUBLE_IS_32BITS) */
#endif /* __OBSOLETE_MATH */
diff --git a/newlib/libm/math/w_log10.c b/newlib/libm/math/w_log10.c
index 3b436d539..929912a01 100644
--- a/newlib/libm/math/w_log10.c
+++ b/newlib/libm/math/w_log10.c
@@ -50,6 +50,7 @@ PORTABILITY

#ifndef _DOUBLE_IS_32BITS

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
double log10(double x) /* wrapper log10 */
#else
@@ -57,9 +58,6 @@ PORTABILITY
double x;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_log10(x);
-#else
double z;
struct exception exc;
z = __ieee754_log10(x);
@@ -102,7 +100,7 @@ PORTABILITY
return exc.retval;
} else
return z;
-#endif
}
+#endif

#endif /* defined(_DOUBLE_IS_32BITS) */
diff --git a/newlib/libm/math/w_pow.c b/newlib/libm/math/w_pow.c
index 9d1e396a5..0e26dc667 100644
--- a/newlib/libm/math/w_pow.c
+++ b/newlib/libm/math/w_pow.c
@@ -57,6 +57,7 @@ PORTABILITY

#ifndef _DOUBLE_IS_32BITS

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
double pow(double x, double y) /* wrapper pow */
#else
@@ -64,9 +65,6 @@ PORTABILITY
double x,y;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_pow(x,y);
-#else
double z;
#ifndef HUGE_VAL
#define HUGE_VAL inf
@@ -204,8 +202,8 @@ PORTABILITY
return exc.retval;
}
return z;
-#endif
}
+#endif

#endif /* defined(_DOUBLE_IS_32BITS) */
#endif /* __OBSOLETE_MATH */
diff --git a/newlib/libm/math/w_remainder.c b/newlib/libm/math/w_remainder.c
index 5b13390f9..9c5390f97 100644
--- a/newlib/libm/math/w_remainder.c
+++ b/newlib/libm/math/w_remainder.c
@@ -46,6 +46,7 @@ PORTABILITY

#ifndef _DOUBLE_IS_32BITS

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
double remainder(double x, double y) /* wrapper remainder */
#else
@@ -53,9 +54,6 @@ PORTABILITY
double x,y;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_remainder(x,y);
-#else
double z;
struct exception exc;
z = __ieee754_remainder(x,y);
@@ -78,8 +76,8 @@ PORTABILITY
return exc.retval;
} else
return z;
-#endif
}
+#endif

#endif /* defined(_DOUBLE_IS_32BITS) */

diff --git a/newlib/libm/math/w_scalb.c b/newlib/libm/math/w_scalb.c
index c32496892..2bd89537b 100644
--- a/newlib/libm/math/w_scalb.c
+++ b/newlib/libm/math/w_scalb.c
@@ -22,6 +22,8 @@

#ifndef _DOUBLE_IS_32BITS

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
+
#ifdef __STDC__
#ifdef _SCALB_INT
double scalb(double x, int fn) /* wrapper scalb */
@@ -37,9 +39,6 @@
#endif
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_scalb(x,fn);
-#else
double z;
#ifndef HUGE_VAL
#define HUGE_VAL inf
@@ -88,7 +87,7 @@
if(!finite(fn)) errno = ERANGE;
#endif
return z;
-#endif
}
+#endif

#endif /* defined(_DOUBLE_IS_32BITS) */
diff --git a/newlib/libm/math/w_sinh.c b/newlib/libm/math/w_sinh.c
index 340a7112d..21990e9c7 100644
--- a/newlib/libm/math/w_sinh.c
+++ b/newlib/libm/math/w_sinh.c
@@ -66,6 +66,7 @@ QUICKREF

#ifndef _DOUBLE_IS_32BITS

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
double sinh(double x) /* wrapper sinh */
#else
@@ -73,9 +74,6 @@ QUICKREF
double x;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_sinh(x);
-#else
double z;
struct exception exc;
z = __ieee754_sinh(x);
@@ -106,7 +104,7 @@ QUICKREF
return exc.retval;
} else
return z;
-#endif
}
+#endif

#endif /* defined(_DOUBLE_IS_32BITS) */
diff --git a/newlib/libm/math/w_sqrt.c b/newlib/libm/math/w_sqrt.c
index 61d42fcec..62cb85c71 100644
--- a/newlib/libm/math/w_sqrt.c
+++ b/newlib/libm/math/w_sqrt.c
@@ -47,6 +47,7 @@ PORTABILITY
#include "fdlibm.h"
#include <errno.h>

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifndef _DOUBLE_IS_32BITS

#ifdef __STDC__
@@ -56,9 +57,6 @@ PORTABILITY
double x;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_sqrt(x);
-#else
struct exception exc;
double z;
z = __ieee754_sqrt(x);
@@ -82,7 +80,7 @@ PORTABILITY
return exc.retval;
} else
return z;
-#endif
}

#endif /* defined(_DOUBLE_IS_32BITS) */
+#endif /* defined(_IEEE_LIBM) */
diff --git a/newlib/libm/math/wf_acos.c b/newlib/libm/math/wf_acos.c
index 8154c795e..9daabe906 100644
--- a/newlib/libm/math/wf_acos.c
+++ b/newlib/libm/math/wf_acos.c
@@ -20,11 +20,9 @@
#include "fdlibm.h"
#include <errno.h>

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
float acosf(float x) /* wrapper acosf */
{
-#ifdef _IEEE_LIBM
- return __ieee754_acosf(x);
-#else
float z;
struct exception exc;
z = __ieee754_acosf(x);
@@ -46,8 +44,8 @@
return (float)exc.retval;
} else
return z;
-#endif
}
+#endif

#ifdef _DOUBLE_IS_32BITS

diff --git a/newlib/libm/math/wf_acosh.c b/newlib/libm/math/wf_acosh.c
index fc8ec3a0a..b4d3e5f52 100644
--- a/newlib/libm/math/wf_acosh.c
+++ b/newlib/libm/math/wf_acosh.c
@@ -21,6 +21,7 @@
#include "fdlibm.h"
#include <errno.h>

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
float acoshf(float x) /* wrapper acoshf */
#else
@@ -28,9 +29,6 @@
float x;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_acoshf(x);
-#else
float z;
struct exception exc;
z = __ieee754_acoshf(x);
@@ -52,8 +50,8 @@
return (float)exc.retval;
} else
return z;
-#endif
}
+#endif

#ifdef _DOUBLE_IS_32BITS

diff --git a/newlib/libm/math/wf_asin.c b/newlib/libm/math/wf_asin.c
index 385de5499..bc63f3f57 100644
--- a/newlib/libm/math/wf_asin.c
+++ b/newlib/libm/math/wf_asin.c
@@ -22,6 +22,7 @@
#include "fdlibm.h"
#include <errno.h>

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
float asinf(float x) /* wrapper asinf */
#else
@@ -29,9 +30,6 @@
float x;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_asinf(x);
-#else
float z;
struct exception exc;
z = __ieee754_asinf(x);
@@ -53,8 +51,8 @@
return (float)exc.retval;
} else
return z;
-#endif
}
+#endif

#ifdef _DOUBLE_IS_32BITS

diff --git a/newlib/libm/math/wf_atanh.c b/newlib/libm/math/wf_atanh.c
index 565630411..031bbdac9 100644
--- a/newlib/libm/math/wf_atanh.c
+++ b/newlib/libm/math/wf_atanh.c
@@ -19,6 +19,7 @@
#include "fdlibm.h"
#include <errno.h>

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
float atanhf(float x) /* wrapper atanhf */
#else
@@ -26,9 +27,6 @@
float x;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_atanhf(x);
-#else
float z,y;
struct exception exc;
z = __ieee754_atanhf(x);
@@ -65,8 +63,8 @@
return (float)exc.retval;
} else
return z;
-#endif
}
+#endif

#ifdef _DOUBLE_IS_32BITS

diff --git a/newlib/libm/math/wf_cosh.c b/newlib/libm/math/wf_cosh.c
index 02eb12472..27ba5b901 100644
--- a/newlib/libm/math/wf_cosh.c
+++ b/newlib/libm/math/wf_cosh.c
@@ -20,6 +20,7 @@
#include "fdlibm.h"
#include <errno.h>

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
float coshf(float x) /* wrapper coshf */
#else
@@ -27,9 +28,6 @@
float x;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_coshf(x);
-#else
float z;
struct exception exc;
z = __ieee754_coshf(x);
@@ -60,8 +58,8 @@
return (float)exc.retval;
} else
return z;
-#endif
}
+#endif

#ifdef _DOUBLE_IS_32BITS

diff --git a/newlib/libm/math/wf_exp.c b/newlib/libm/math/wf_exp.c
index f16af1d1b..10b798f58 100644
--- a/newlib/libm/math/wf_exp.c
+++ b/newlib/libm/math/wf_exp.c
@@ -21,6 +21,7 @@
#if __OBSOLETE_MATH
#include <errno.h>

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
static const float
#else
@@ -36,9 +37,6 @@ u_threshold= -1.0397208405e+02; /* 0xc2cff1b5 */
float x;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_expf(x);
-#else
float z;
struct exception exc;
z = __ieee754_expf(x);
@@ -86,8 +84,8 @@ u_threshold= -1.0397208405e+02; /* 0xc2cff1b5 */
}
}
return z;
-#endif
}
+#endif

#ifdef _DOUBLE_IS_32BITS

diff --git a/newlib/libm/math/wf_fmod.c b/newlib/libm/math/wf_fmod.c
index 030ca3e7a..9cbb0fff3 100644
--- a/newlib/libm/math/wf_fmod.c
+++ b/newlib/libm/math/wf_fmod.c
@@ -20,6 +20,7 @@
#include "fdlibm.h"
#include <errno.h>

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
float fmodf(float x, float y) /* wrapper fmodf */
#else
@@ -27,9 +28,6 @@
float x,y;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_fmodf(x,y);
-#else
float z;
struct exception exc;
z = __ieee754_fmodf(x,y);
@@ -55,8 +53,8 @@
return (float)exc.retval;
} else
return z;
-#endif
}
+#endif

#ifdef _DOUBLE_IS_32BITS

diff --git a/newlib/libm/math/wf_gamma.c b/newlib/libm/math/wf_gamma.c
index 1204f3999..332e27275 100644
--- a/newlib/libm/math/wf_gamma.c
+++ b/newlib/libm/math/wf_gamma.c
@@ -18,6 +18,7 @@
#include <reent.h>
#include <errno.h>

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
float gammaf(float x)
#else
@@ -25,9 +26,6 @@
float x;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_gammaf_r(x,&(_REENT_SIGNGAM(_REENT)));
-#else
float y;
struct exception exc;
y = __ieee754_gammaf_r(x,&(_REENT_SIGNGAM(_REENT)));
@@ -75,8 +73,8 @@
return (float)exc.retval;
} else
return y;
+}
#endif
-}

#ifdef _DOUBLE_IS_32BITS

diff --git a/newlib/libm/math/wf_hypot.c b/newlib/libm/math/wf_hypot.c
index c04ace110..c6eab1109 100644
--- a/newlib/libm/math/wf_hypot.c
+++ b/newlib/libm/math/wf_hypot.c
@@ -20,6 +20,7 @@
#include "fdlibm.h"
#include <errno.h>

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
float hypotf(float x, float y) /* wrapper hypotf */
#else
@@ -27,9 +28,6 @@
float x,y;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_hypotf(x,y);
-#else
float z;
struct exception exc;
z = __ieee754_hypotf(x,y);
@@ -61,8 +59,8 @@
return (float)exc.retval;
} else
return z;
-#endif
}
+#endif

#ifdef _DOUBLE_IS_32BITS

diff --git a/newlib/libm/math/wf_j0.c b/newlib/libm/math/wf_j0.c
index 1f7f5ede5..9ef66a0bf 100644
--- a/newlib/libm/math/wf_j0.c
+++ b/newlib/libm/math/wf_j0.c
@@ -20,6 +20,7 @@
#include "fdlibm.h"
#include <errno.h>

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
float j0f(float x) /* wrapper j0f */
#else
@@ -27,9 +28,6 @@
float x;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_j0f(x);
-#else
struct exception exc;
float z = __ieee754_j0f(x);
if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
@@ -50,9 +48,10 @@
return (float)exc.retval;
} else
return z;
-#endif
}
+#endif

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
float y0f(float x) /* wrapper y0f */
#else
@@ -60,9 +59,6 @@
float x;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_y0f(x);
-#else
float z;
struct exception exc;
z = __ieee754_y0f(x);
@@ -109,8 +105,8 @@
return (float)exc.retval;
} else
return z;
-#endif
}
+#endif

#ifdef _DOUBLE_IS_32BITS

diff --git a/newlib/libm/math/wf_j1.c b/newlib/libm/math/wf_j1.c
index b91962881..146db386a 100644
--- a/newlib/libm/math/wf_j1.c
+++ b/newlib/libm/math/wf_j1.c
@@ -21,6 +21,7 @@
#include <errno.h>


+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
float j1f(float x) /* wrapper j1f */
#else
@@ -28,9 +29,6 @@
float x;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_j1f(x);
-#else
float z;
struct exception exc;
z = __ieee754_j1f(x);
@@ -52,9 +50,10 @@
return exc.retval;
} else
return z;
-#endif
}
+#endif

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
float y1f(float x) /* wrapper y1f */
#else
@@ -62,9 +61,6 @@
float x;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_y1f(x);
-#else
float z;
struct exception exc;
z = __ieee754_y1f(x);
@@ -111,8 +107,8 @@
return (float)exc.retval;
} else
return z;
-#endif
}
+#endif

#ifdef _DOUBLE_IS_32BITS

diff --git a/newlib/libm/math/wf_jn.c b/newlib/libm/math/wf_jn.c
index 837b6b703..fe9d5680f 100644
--- a/newlib/libm/math/wf_jn.c
+++ b/newlib/libm/math/wf_jn.c
@@ -17,6 +17,7 @@
#include <errno.h>


+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
float jnf(int n, float x) /* wrapper jnf */
#else
@@ -24,9 +25,6 @@
float x; int n;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_jnf(n,x);
-#else
float z;
struct exception exc;
z = __ieee754_jnf(n,x);
@@ -49,9 +47,10 @@
return exc.retval;
} else
return z;
-#endif
}
+#endif

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
float ynf(int n, float x) /* wrapper ynf */
#else
@@ -59,9 +58,6 @@
float x; int n;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_ynf(n,x);
-#else
float z;
struct exception exc;
z = __ieee754_ynf(n,x);
@@ -110,8 +106,8 @@
return (float)exc.retval;
} else
return z;
-#endif
}
+#endif

#ifdef _DOUBLE_IS_32BITS

diff --git a/newlib/libm/math/wf_lgamma.c b/newlib/libm/math/wf_lgamma.c
index f1bf0c019..0ed989765 100644
--- a/newlib/libm/math/wf_lgamma.c
+++ b/newlib/libm/math/wf_lgamma.c
@@ -18,6 +18,7 @@
#include <reent.h>
#include <errno.h>

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
float lgammaf(float x)
#else
@@ -25,9 +26,6 @@
float x;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_lgammaf_r(x,&(_REENT_SIGNGAM(_REENT)));
-#else
float y;
struct exception exc;
y = __ieee754_lgammaf_r(x,&(_REENT_SIGNGAM(_REENT)));
@@ -69,8 +67,8 @@
return (float)exc.retval;
} else
return y;
-#endif
}
+#endif

#ifdef _DOUBLE_IS_32BITS

diff --git a/newlib/libm/math/wf_log.c b/newlib/libm/math/wf_log.c
index 07be8d63c..a07a3eb3c 100644
--- a/newlib/libm/math/wf_log.c
+++ b/newlib/libm/math/wf_log.c
@@ -21,6 +21,7 @@
#if __OBSOLETE_MATH
#include <errno.h>

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
float logf(float x) /* wrapper logf */
#else
@@ -28,9 +29,6 @@
float x;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_logf(x);
-#else
float z;
struct exception exc;
z = __ieee754_logf(x);
@@ -69,8 +67,8 @@
if (exc.err != 0)
errno = exc.err;
return (float)exc.retval;
-#endif
}
+#endif

#ifdef _DOUBLE_IS_32BITS

diff --git a/newlib/libm/math/wf_log10.c b/newlib/libm/math/wf_log10.c
index 11c595637..8f36bfe02 100644
--- a/newlib/libm/math/wf_log10.c
+++ b/newlib/libm/math/wf_log10.c
@@ -20,6 +20,7 @@
#include "fdlibm.h"
#include <errno.h>

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
float log10f(float x) /* wrapper log10f */
#else
@@ -27,9 +28,6 @@
float x;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_log10f(x);
-#else
float z;
struct exception exc;
z = __ieee754_log10f(x);
@@ -71,8 +69,8 @@
return (float)exc.retval;
} else
return z;
-#endif
}
+#endif

#ifdef _DOUBLE_IS_32BITS

diff --git a/newlib/libm/math/wf_pow.c b/newlib/libm/math/wf_pow.c
index f753b5226..98e1fc6c7 100644
--- a/newlib/libm/math/wf_pow.c
+++ b/newlib/libm/math/wf_pow.c
@@ -21,6 +21,7 @@
#if __OBSOLETE_MATH
#include <errno.h>

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
float powf(float x, float y) /* wrapper powf */
#else
@@ -28,9 +29,6 @@
float x,y;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_powf(x,y);
-#else
float z;
struct exception exc;
z=__ieee754_powf(x,y);
@@ -164,8 +162,8 @@
return (float)exc.retval;
}
return z;
-#endif
}
+#endif

#ifdef _DOUBLE_IS_32BITS

diff --git a/newlib/libm/math/wf_remainder.c b/newlib/libm/math/wf_remainder.c
index f38c23785..709e1948f 100644
--- a/newlib/libm/math/wf_remainder.c
+++ b/newlib/libm/math/wf_remainder.c
@@ -20,6 +20,7 @@
#include "fdlibm.h"
#include <errno.h>

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
float remainderf(float x, float y) /* wrapper remainder */
#else
@@ -27,9 +28,6 @@
float x,y;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_remainderf(x,y);
-#else
float z;
struct exception exc;
z = __ieee754_remainderf(x,y);
@@ -52,8 +50,8 @@
return (float)exc.retval;
} else
return z;
-#endif
}
+#endif

#ifdef _DOUBLE_IS_32BITS

diff --git a/newlib/libm/math/wf_scalb.c b/newlib/libm/math/wf_scalb.c
index d2c3cd2aa..1f74b7931 100644
--- a/newlib/libm/math/wf_scalb.c
+++ b/newlib/libm/math/wf_scalb.c
@@ -22,6 +22,7 @@
#include "fdlibm.h"
#include <errno.h>

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
#ifdef _SCALB_INT
float scalbf(float x, int fn) /* wrapper scalbf */
@@ -37,9 +38,6 @@
#endif
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_scalbf(x,fn);
-#else
float z;
#ifndef HUGE_VAL
#define HUGE_VAL inf
@@ -88,8 +86,8 @@
if(!finitef(fn)) errno = ERANGE;
#endif
return z;
-#endif
}
+#endif

#ifdef _DOUBLE_IS_32BITS

diff --git a/newlib/libm/math/wf_sinh.c b/newlib/libm/math/wf_sinh.c
index 80c7a8e6e..73487fc7c 100644
--- a/newlib/libm/math/wf_sinh.c
+++ b/newlib/libm/math/wf_sinh.c
@@ -20,6 +20,7 @@
#include "fdlibm.h"
#include <errno.h>

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
float sinhf(float x) /* wrapper sinhf */
#else
@@ -27,9 +28,6 @@
float x;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_sinhf(x);
-#else
float z;
struct exception exc;
z = __ieee754_sinhf(x);
@@ -60,8 +58,8 @@
return (float)exc.retval;
} else
return z;
-#endif
}
+#endif

#ifdef _DOUBLE_IS_32BITS

diff --git a/newlib/libm/math/wf_sqrt.c b/newlib/libm/math/wf_sqrt.c
index 4536ba0ac..c3820e883 100644
--- a/newlib/libm/math/wf_sqrt.c
+++ b/newlib/libm/math/wf_sqrt.c
@@ -20,6 +20,7 @@
#include "fdlibm.h"
#include <errno.h>

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
float sqrtf(float x) /* wrapper sqrtf */
#else
@@ -27,9 +28,6 @@
float x;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_sqrtf(x);
-#else
float z;
struct exception exc;
z = __ieee754_sqrtf(x);
@@ -54,8 +52,8 @@
return (float)exc.retval;
} else
return z;
-#endif
}
+#endif

#ifdef _DOUBLE_IS_32BITS

diff --git a/newlib/libm/math/wr_gamma.c b/newlib/libm/math/wr_gamma.c
index 0092ed02c..85a1f6527 100644
--- a/newlib/libm/math/wr_gamma.c
+++ b/newlib/libm/math/wr_gamma.c
@@ -20,6 +20,7 @@

#ifndef _DOUBLE_IS_32BITS

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
double gamma_r(double x, int *signgamp) /* wrapper lgamma_r */
#else
@@ -27,9 +28,6 @@
double x; int *signgamp;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_gamma_r(x,signgamp);
-#else
double y;
struct exception exc;
y = __ieee754_gamma_r(x,signgamp);
@@ -70,7 +68,7 @@
return exc.retval;
} else
return y;
-#endif
}
+#endif

#endif /* defined(_DOUBLE_IS_32BITS) */
diff --git a/newlib/libm/math/wr_lgamma.c b/newlib/libm/math/wr_lgamma.c
index c59c1cce9..5d1245330 100644
--- a/newlib/libm/math/wr_lgamma.c
+++ b/newlib/libm/math/wr_lgamma.c
@@ -20,6 +20,7 @@

#ifndef _DOUBLE_IS_32BITS

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
double lgamma_r(double x, int *signgamp) /* wrapper lgamma_r */
#else
@@ -27,9 +28,6 @@
double x; int *signgamp;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_lgamma_r(x,signgamp);
-#else
double y;
struct exception exc;
y = __ieee754_lgamma_r(x,signgamp);
@@ -71,7 +69,7 @@
return exc.retval;
} else
return y;
-#endif
}
+#endif

#endif /* defined(_DOUBLE_IS_32BITS) */
diff --git a/newlib/libm/math/wrf_gamma.c b/newlib/libm/math/wrf_gamma.c
index ae285f564..518bb8ecb 100644
--- a/newlib/libm/math/wrf_gamma.c
+++ b/newlib/libm/math/wrf_gamma.c
@@ -20,6 +20,7 @@
#include "fdlibm.h"
#include <errno.h>

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
float gammaf_r(float x, int *signgamp) /* wrapper lgammaf_r */
#else
@@ -27,9 +28,6 @@
float x; int *signgamp;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_gammaf_r(x,signgamp);
-#else
float y;
struct exception exc;
y = __ieee754_gammaf_r(x,signgamp);
@@ -70,5 +68,5 @@
return (float)exc.retval;
} else
return y;
-#endif
}
+#endif
diff --git a/newlib/libm/math/wrf_lgamma.c b/newlib/libm/math/wrf_lgamma.c
index 73985e271..7cc1cf855 100644
--- a/newlib/libm/math/wrf_lgamma.c
+++ b/newlib/libm/math/wrf_lgamma.c
@@ -20,6 +20,7 @@
#include "fdlibm.h"
#include <errno.h>

+#if !defined(_IEEE_LIBM) || !defined(__strong_reference)
#ifdef __STDC__
float lgammaf_r(float x, int *signgamp) /* wrapper lgammaf_r */
#else
@@ -27,9 +28,6 @@
float x; int *signgamp;
#endif
{
-#ifdef _IEEE_LIBM
- return __ieee754_lgammaf_r(x,signgamp);
-#else
float y;
struct exception exc;
y = __ieee754_lgammaf_r(x,signgamp);
@@ -71,5 +69,5 @@
return (float)exc.retval;
} else
return y;
-#endif
}
+#endif
--
2.19.0
Craig Howland
2018-09-21 20:17:19 UTC
Permalink
Post by Keith Packard
When the math library is compiled to just use bare IEEE_LIBM mode, many
public functions are just wrappers around the __ieee754 version.
Eliminate the extra function by creating a weak alias symbol for the
public name directly from the ieee754 name.
Use __weak_reference macro instead of using
'__attribute__((weak, alias' to make this code portable
to non-ELF systems.
Use __strong_reference macro instead of __weak_reference to
avoid changing the symbol in the resulting library. Make the
use of this and the un-definition of the wrapper functions
conditional on both the definition of _IEEE_LIBM and
__strong_reference so that systems without the latter will
still compile the wrapper functions and work properly.
I don't see anything which makes the definition of __strong_reference dependent
upon target.  In sys/cdefs.h it is only dependent upon __GNUC__.
Keith Packard
2018-09-21 20:29:29 UTC
Permalink
Post by Craig Howland
I don't see anything which makes the definition of __strong_reference dependent
upon target.  In sys/cdefs.h it is only dependent upon __GNUC__.
Which makes sense -- there shouldn't be any platform which cannot
support these strong references; they're just a duplicate symbol
with the same value and properties. However, it does depend on __GNUC__,
and one can imagine someone using a compiler other than gcc?
--
-keith
Craig Howland
2018-09-21 20:37:45 UTC
Permalink
Post by Keith Packard
Post by Craig Howland
I don't see anything which makes the definition of __strong_reference dependent
upon target.  In sys/cdefs.h it is only dependent upon __GNUC__.
Which makes sense -- there shouldn't be any platform which cannot
support these strong references; they're just a duplicate symbol
with the same value and properties. However, it does depend on __GNUC__,
and one can imagine someone using a compiler other than gcc?
It's no difference than a weak alias--it requires object file support.  To quote
from the GCC manual about a function alias attribute (which is what the macro
ends up using), "This attribute requires assembler and object file support, and
may not be available on all targets."
Keith Packard
2018-09-21 20:58:55 UTC
Permalink
It's no difference than a weak alias--it requires object file support.  To quote
from the GCC manual about a function alias attribute (which is what the macro
ends up using), "This attribute requires assembler and object file support, and
may not be available on all targets."
It is different from weak in that it doesn't require any object file or
linker support. For instance, here's what the __strong_reference does in
e_acos.c:

.globl acos
.set acos,__ieee754_acos

Using __weak_reference does this instead:

.weak acos
.equ acos, __ieee754_acos

The GCC docs don't really talk about non-weak aliases at all which makes
me unhappy as it would be useful to know if the statement you quoted
refers to *all* aliases, or only weak aliases.

However, given the current GCC docs, we'll certainly want to use a
separate conditional instead of attempting to auto-detect this mode.

I'll add that, but I won't add any autotools mechanism to define it as I
cannot rebuild the configure scripts on Debian any longer.

I'm not getting a sense of whether you think this is a useful change
though; it seems like a fairly obvious optimization of the existing
feature to me, but perhaps you're finding it too complicated to be
useful upstream?
--
-keith
Craig Howland
2018-09-21 21:29:46 UTC
Permalink
Post by Keith Packard
Post by Craig Howland
It's no difference than a weak alias--it requires object file support.  To quote
from the GCC manual about a function alias attribute (which is what the macro
ends up using), "This attribute requires assembler and object file support, and
may not be available on all targets."
It is different from weak in that it doesn't require any object file or
linker support. For instance, here's what the __strong_reference does in
.globl acos
.set acos,__ieee754_acos
.weak acos
.equ acos, __ieee754_acos
The GCC docs don't really talk about non-weak aliases at all which makes
me unhappy as it would be useful to know if the statement you quoted
refers to *all* aliases, or only weak aliases.
The quoted statement comes from the alias definition, which is strong unless
weak is added to it, so I take it as applying to all. (The example in the manual
has weak in it, but that doesn't mean the whole description only applies with
weak.  Weak has its own, separate, description which is even more limited (only
ELF and a.out), which implies the one for alias applies to all.)  However, I
don't know for sure for all assemblers and object file formats. Someone on the
list probably does.
Post by Keith Packard
However, given the current GCC docs, we'll certainly want to use a
separate conditional instead of attempting to auto-detect this mode.
I'll add that, but I won't add any autotools mechanism to define it as I
cannot rebuild the configure scripts on Debian any longer.
I'm not getting a sense of whether you think this is a useful change
though; it seems like a fairly obvious optimization of the existing
feature to me, but perhaps you're finding it too complicated to be
useful upstream?
The goal is a good one (getting rid of the additional function call when it
degenerates to just a wrapper), but it does need a method that won't break any
targets.

Loading...