[3/4] In _IEEE_LIBM mode, use weak symbols instead of wrapper funcs

Message ID 20180827183231.25728-4-keithp@keithp.com
State Superseded
Headers show
Series
  • A selection of cleanups
Related show

Commit Message

Keith Packard Aug. 27, 2018, 6:32 p.m.
From: Keith Packard <keithp@keithp.com>


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.

Signed-off-by: Keith Packard <keithp@keithp.com>

---
 newlib/libm/math/e_acos.c       |  5 +++++
 newlib/libm/math/e_acosh.c      |  5 +++++
 newlib/libm/math/e_asin.c       |  5 +++++
 newlib/libm/math/e_atan2.c      |  5 +++++
 newlib/libm/math/e_atanh.c      |  5 +++++
 newlib/libm/math/e_cosh.c       |  5 +++++
 newlib/libm/math/e_exp.c        |  5 +++++
 newlib/libm/math/e_fmod.c       |  5 +++++
 newlib/libm/math/e_hypot.c      |  5 +++++
 newlib/libm/math/e_j0.c         | 10 ++++++++++
 newlib/libm/math/e_j1.c         | 10 ++++++++++
 newlib/libm/math/e_jn.c         | 10 ++++++++++
 newlib/libm/math/e_log.c        |  5 +++++
 newlib/libm/math/e_log10.c      |  5 +++++
 newlib/libm/math/e_pow.c        |  5 +++++
 newlib/libm/math/e_rem_pio2.c   |  5 +++++
 newlib/libm/math/e_remainder.c  |  5 +++++
 newlib/libm/math/e_scalb.c      | 10 ++++++++++
 newlib/libm/math/e_sinh.c       |  5 +++++
 newlib/libm/math/e_sqrt.c       |  5 +++++
 newlib/libm/math/ef_acos.c      |  5 +++++
 newlib/libm/math/ef_acosh.c     |  5 +++++
 newlib/libm/math/ef_asin.c      |  5 +++++
 newlib/libm/math/ef_atan2.c     |  5 +++++
 newlib/libm/math/ef_atanh.c     |  5 +++++
 newlib/libm/math/ef_cosh.c      |  5 +++++
 newlib/libm/math/ef_exp.c       |  5 +++++
 newlib/libm/math/ef_fmod.c      |  5 +++++
 newlib/libm/math/ef_hypot.c     |  5 +++++
 newlib/libm/math/ef_j0.c        | 10 ++++++++++
 newlib/libm/math/ef_j1.c        | 10 ++++++++++
 newlib/libm/math/ef_jn.c        | 10 ++++++++++
 newlib/libm/math/ef_log.c       |  5 +++++
 newlib/libm/math/ef_log10.c     |  5 +++++
 newlib/libm/math/ef_pow.c       |  5 +++++
 newlib/libm/math/ef_rem_pio2.c  |  5 +++++
 newlib/libm/math/ef_remainder.c |  5 +++++
 newlib/libm/math/ef_scalb.c     | 10 ++++++++++
 newlib/libm/math/ef_sinh.c      |  5 +++++
 newlib/libm/math/ef_sqrt.c      |  5 +++++
 newlib/libm/math/er_gamma.c     |  5 +++++
 newlib/libm/math/er_lgamma.c    |  5 +++++
 newlib/libm/math/erf_gamma.c    |  5 +++++
 newlib/libm/math/erf_lgamma.c   |  5 +++++
 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     |  7 +++----
 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 ++----
 86 files changed, 360 insertions(+), 197 deletions(-)

-- 
2.18.0

Comments

Craig Howland Aug. 27, 2018, 7:23 p.m. | #1
On 08/27/2018 02:32 PM, keithp@keithp.com wrote:
> From: Keith Packard <keithp@keithp.com>

>

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

>

> Signed-off-by: Keith Packard <keithp@keithp.com>

> ---

>   newlib/libm/math/e_acos.c       |  5 +++++

>   ...

>   86 files changed, 360 insertions(+), 197 deletions(-)

>

> diff --git a/newlib/libm/math/e_acos.c b/newlib/libm/math/e_acos.c

> index 319b1d56f..25509c0f0 100644

> --- a/newlib/libm/math/e_acos.c

> +++ b/newlib/libm/math/e_acos.c

> @@ -59,6 +59,11 @@ qS2 =  2.02094576023350569471e+00, /* 0x40002AE5, 0x9C598AC8 */

>   qS3 = -6.88283971605453293030e-01, /* 0xBFE6066C, 0x1B8D0159 */

>   qS4 =  7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */

>   

> +#ifdef _IEEE_LIBM

> +double acos(double x)

> +	__attribute__((weak, alias("__ieee754_acos")));

> +#endif

> +

>   #ifdef __STDC__

>   	double __ieee754_acos(double x)

>   #else

> ...

While this is a nice idea, it is a problem for targets which don't support weak 
aliases (i.e. those without proper object file support for them).  (Does anyone 
know for certain if this is a real problem instead of just a theoretical one?  
(I'd guess so.)  All my Newlib targets are ELF.)  An alternative implementation 
could be macro definitions in math.h.
Craig
Joel Sherrill Aug. 27, 2018, 7:28 p.m. | #2
On Mon, Aug 27, 2018 at 2:23 PM, Craig Howland <howland@lgsinnovations.com>
wrote:

> On 08/27/2018 02:32 PM, keithp@keithp.com wrote:

>

>> From: Keith Packard <keithp@keithp.com>

>>

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

>>

>> Signed-off-by: Keith Packard <keithp@keithp.com>

>> ---

>>   newlib/libm/math/e_acos.c       |  5 +++++

>>   ...

>>   86 files changed, 360 insertions(+), 197 deletions(-)

>>

>> diff --git a/newlib/libm/math/e_acos.c b/newlib/libm/math/e_acos.c

>> index 319b1d56f..25509c0f0 100644

>> --- a/newlib/libm/math/e_acos.c

>> +++ b/newlib/libm/math/e_acos.c

>> @@ -59,6 +59,11 @@ qS2 =  2.02094576023350569471e+00, /* 0x40002AE5,

>> 0x9C598AC8 */

>>   qS3 = -6.88283971605453293030e-01, /* 0xBFE6066C, 0x1B8D0159 */

>>   qS4 =  7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */

>>   +#ifdef _IEEE_LIBM

>> +double acos(double x)

>> +       __attribute__((weak, alias("__ieee754_acos")));

>> +#endif

>> +

>>   #ifdef __STDC__

>>         double __ieee754_acos(double x)

>>   #else

>> ...

>>

> While this is a nice idea, it is a problem for targets which don't support

> weak aliases (i.e. those without proper object file support for them).

> (Does anyone know for certain if this is a real problem instead of just a

> theoretical one?  (I'd guess so.)  All my Newlib targets are ELF.)  An

> alternative implementation could be macro definitions in math.h.



My suggestion is to use the macro __weak_reference() from newlib's
sys/cdefs.h which appears to account for ELF and not-ELF.

This is from FreeBSD so I would have confidence that they got it right.

--joel


>

> Craig

>
Corinna Vinschen Aug. 29, 2018, 1:59 p.m. | #3
On Aug 27 14:28, Joel Sherrill wrote:
> On Mon, Aug 27, 2018 at 2:23 PM, Craig Howland <howland@lgsinnovations.com>

> wrote:

> 

> > On 08/27/2018 02:32 PM, keithp@keithp.com wrote:

> >

> >> From: Keith Packard <keithp@keithp.com>

> >>

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

> >>

> >> Signed-off-by: Keith Packard <keithp@keithp.com>

> >> ---

> >>   newlib/libm/math/e_acos.c       |  5 +++++

> >>   ...

> >>   86 files changed, 360 insertions(+), 197 deletions(-)

> >>

> >> diff --git a/newlib/libm/math/e_acos.c b/newlib/libm/math/e_acos.c

> >> index 319b1d56f..25509c0f0 100644

> >> --- a/newlib/libm/math/e_acos.c

> >> +++ b/newlib/libm/math/e_acos.c

> >> @@ -59,6 +59,11 @@ qS2 =  2.02094576023350569471e+00, /* 0x40002AE5,

> >> 0x9C598AC8 */

> >>   qS3 = -6.88283971605453293030e-01, /* 0xBFE6066C, 0x1B8D0159 */

> >>   qS4 =  7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */

> >>   +#ifdef _IEEE_LIBM

> >> +double acos(double x)

> >> +       __attribute__((weak, alias("__ieee754_acos")));

> >> +#endif

> >> +

> >>   #ifdef __STDC__

> >>         double __ieee754_acos(double x)

> >>   #else

> >> ...

> >>

> > While this is a nice idea, it is a problem for targets which don't support

> > weak aliases (i.e. those without proper object file support for them).

> > (Does anyone know for certain if this is a real problem instead of just a

> > theoretical one?  (I'd guess so.)  All my Newlib targets are ELF.)  An

> > alternative implementation could be macro definitions in math.h.

> 

> 

> My suggestion is to use the macro __weak_reference() from newlib's

> sys/cdefs.h which appears to account for ELF and not-ELF.

> 

> This is from FreeBSD so I would have confidence that they got it right.


Sounds good to me.  Also... who's setting IEEE_LIBM and where?  I don't
see any way to set this in the entire tree.


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat
Keith Packard Aug. 29, 2018, 4:32 p.m. | #4
Corinna Vinschen <vinschen@redhat.com> writes:

> Sounds good to me.  Also... who's setting IEEE_LIBM and where?  I don't

> see any way to set this in the entire tree.


I've created a parallel 'meson' based build system for smaller embedded
systems which allows this as an option. Anything to save bytes in flash.

https://salsa.debian.org/electronics-team/toolchains/newlib-nano

-- 
-keith

Patch

diff --git a/newlib/libm/math/e_acos.c b/newlib/libm/math/e_acos.c
index 319b1d56f..25509c0f0 100644
--- a/newlib/libm/math/e_acos.c
+++ b/newlib/libm/math/e_acos.c
@@ -59,6 +59,11 @@  qS2 =  2.02094576023350569471e+00, /* 0x40002AE5, 0x9C598AC8 */
 qS3 = -6.88283971605453293030e-01, /* 0xBFE6066C, 0x1B8D0159 */
 qS4 =  7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */
 
+#ifdef _IEEE_LIBM
+double acos(double x)
+	__attribute__((weak, alias("__ieee754_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..79b1412da 100644
--- a/newlib/libm/math/e_acosh.c
+++ b/newlib/libm/math/e_acosh.c
@@ -38,6 +38,11 @@  static double
 one	= 1.0,
 ln2	= 6.93147180559945286227e-01;  /* 0x3FE62E42, 0xFEFA39EF */
 
+#ifdef _IEEE_LIBM
+double acosh(double x)
+	__attribute__((weak, alias("__ieee754_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..2ae0dd442 100644
--- a/newlib/libm/math/e_asin.c
+++ b/newlib/libm/math/e_asin.c
@@ -68,6 +68,11 @@  qS2 =  2.02094576023350569471e+00, /* 0x40002AE5, 0x9C598AC8 */
 qS3 = -6.88283971605453293030e-01, /* 0xBFE6066C, 0x1B8D0159 */
 qS4 =  7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */
 
+#ifdef _IEEE_LIBM
+double asin(double x)
+	__attribute__((weak, alias("__ieee754_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..f3a7c8757 100644
--- a/newlib/libm/math/e_atan2.c
+++ b/newlib/libm/math/e_atan2.c
@@ -55,6 +55,11 @@  pi_o_2  = 1.5707963267948965580E+00, /* 0x3FF921FB, 0x54442D18 */
 pi      = 3.1415926535897931160E+00, /* 0x400921FB, 0x54442D18 */
 pi_lo   = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */
 
+#ifdef _IEEE_LIBM
+double atan2(double x, double y)
+	__attribute__((weak, alias("__ieee754_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..e2c539466 100644
--- a/newlib/libm/math/e_atanh.c
+++ b/newlib/libm/math/e_atanh.c
@@ -46,6 +46,11 @@  static const double zero = 0.0;
 static double zero = 0.0;
 #endif
 
+#ifdef _IEEE_LIBM
+double atanh(double x)
+	__attribute__((weak, alias("__ieee754_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..91eec65cf 100644
--- a/newlib/libm/math/e_cosh.c
+++ b/newlib/libm/math/e_cosh.c
@@ -42,6 +42,11 @@  static const double one = 1.0, half=0.5, huge = 1.0e300;
 static double one = 1.0, half=0.5, huge = 1.0e300;
 #endif
 
+#ifdef _IEEE_LIBM
+double cosh(double x)
+	__attribute__((weak, alias("__ieee754_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..1c6a88525 100644
--- a/newlib/libm/math/e_exp.c
+++ b/newlib/libm/math/e_exp.c
@@ -102,6 +102,11 @@  P4   = -1.65339022054652515390e-06, /* 0xBEBBBD41, 0xC5D26BF1 */
 P5   =  4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */
 
 
+#ifdef _IEEE_LIBM
+double exp(double x)
+	__attribute__((weak, alias("__ieee754_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..d0b607a92 100644
--- a/newlib/libm/math/e_fmod.c
+++ b/newlib/libm/math/e_fmod.c
@@ -27,6 +27,11 @@  static const double one = 1.0, Zero[] = {0.0, -0.0,};
 static double one = 1.0, Zero[] = {0.0, -0.0,};
 #endif
 
+#ifdef _IEEE_LIBM
+double fmod(double x, double y)
+	__attribute__((weak, alias("__ieee754_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..44c267d16 100644
--- a/newlib/libm/math/e_hypot.c
+++ b/newlib/libm/math/e_hypot.c
@@ -47,6 +47,11 @@ 
 
 #ifndef _DOUBLE_IS_32BITS
 
+#ifdef _IEEE_LIBM
+double hypot(double x, double y)
+	__attribute__((weak, alias("__ieee754_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..e98521520 100644
--- a/newlib/libm/math/e_j0.c
+++ b/newlib/libm/math/e_j0.c
@@ -91,6 +91,11 @@  static const double zero = 0.0;
 static double zero = 0.0;
 #endif
 
+#ifdef _IEEE_LIBM
+double j0(double x)
+	__attribute__((weak, alias("__ieee754_j0")));
+#endif
+
 #ifdef __STDC__
 	double __ieee754_j0(double x) 
 #else
@@ -160,6 +165,11 @@  v02  =  7.60068627350353253702e-05, /* 0x3F13ECBB, 0xF578C6C1 */
 v03  =  2.59150851840457805467e-07, /* 0x3E91642D, 0x7FF202FD */
 v04  =  4.41110311332675467403e-10; /* 0x3DFE5018, 0x3BD6D9EF */
 
+#ifdef _IEEE_LIBM
+double y0(double x)
+	__attribute__((weak, alias("__ieee754_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..895e8a511 100644
--- a/newlib/libm/math/e_j1.c
+++ b/newlib/libm/math/e_j1.c
@@ -92,6 +92,11 @@  static const double zero    = 0.0;
 static double zero    = 0.0;
 #endif
 
+#ifdef _IEEE_LIBM
+double j1(double x)
+	__attribute__((weak, alias("__ieee754_j1")));
+#endif
+
 #ifdef __STDC__
 	double __ieee754_j1(double x) 
 #else
@@ -161,6 +166,11 @@  static double V0[5] = {
   1.66559246207992079114e-11, /* 0x3DB25039, 0xDACA772A */
 };
 
+#ifdef _IEEE_LIBM
+double y1(double x)
+	__attribute__((weak, alias("__ieee754_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..b11348f16 100644
--- a/newlib/libm/math/e_jn.c
+++ b/newlib/libm/math/e_jn.c
@@ -56,6 +56,11 @@  static const double zero  =  0.00000000000000000000e+00;
 static double zero  =  0.00000000000000000000e+00;
 #endif
 
+#ifdef _IEEE_LIBM
+double jn(int n, double x)
+	__attribute__((weak, alias("__ieee754_jn")));
+#endif
+
 #ifdef __STDC__
 	double __ieee754_jn(int n, double x)
 #else
@@ -216,6 +221,11 @@  static double zero  =  0.00000000000000000000e+00;
 	if(sgn==1) return -b; else return b;
 }
 
+#ifdef _IEEE_LIBM
+double yn(int n, double x)
+	__attribute__((weak, alias("__ieee754_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..a4af67bef 100644
--- a/newlib/libm/math/e_log.c
+++ b/newlib/libm/math/e_log.c
@@ -89,6 +89,11 @@  static const double zero   =  0.0;
 static double zero   =  0.0;
 #endif
 
+#ifdef _IEEE_LIBM
+double log(double x)
+	__attribute__((weak, alias("__ieee754_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..60128d218 100644
--- a/newlib/libm/math/e_log10.c
+++ b/newlib/libm/math/e_log10.c
@@ -64,6 +64,11 @@  static const double zero   =  0.0;
 static double zero   =  0.0;
 #endif
 
+#ifdef _IEEE_LIBM
+double log10(double x)
+	__attribute__((weak, alias("__ieee754_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..d1ac5b2d2 100644
--- a/newlib/libm/math/e_pow.c
+++ b/newlib/libm/math/e_pow.c
@@ -99,6 +99,11 @@  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*/
 
+#ifdef _IEEE_LIBM
+double pow(double x, double y)
+	__attribute__((weak, alias("__ieee754_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..f9fa45309 100644
--- a/newlib/libm/math/e_rem_pio2.c
+++ b/newlib/libm/math/e_rem_pio2.c
@@ -82,6 +82,11 @@  pio2_2t =  2.02226624879595063154e-21, /* 0x3BA3198A, 0x2E037073 */
 pio2_3  =  2.02226624871116645580e-21, /* 0x3BA3198A, 0x2E000000 */
 pio2_3t =  8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */
 
+#ifdef _IEEE_LIBM
+__int32_t rem_pio2(double x, double *y)
+	__attribute__((weak, alias("__ieee754_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..fdbc8aff9 100644
--- a/newlib/libm/math/e_remainder.c
+++ b/newlib/libm/math/e_remainder.c
@@ -31,6 +31,11 @@  static double zero = 0.0;
 #endif
 
 
+#ifdef _IEEE_LIBM
+double remainder(double x, double p)
+	__attribute__((weak, alias("__ieee754_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 0bb924b43..a5bd9a863 100644
--- a/newlib/libm/math/e_scalb.c
+++ b/newlib/libm/math/e_scalb.c
@@ -21,6 +21,16 @@ 
 
 #ifndef _DOUBLE_IS_32BITS
 
+#ifdef _IEEE_LIBM
+#ifdef _SCALB_INT
+double scalb(double x, int fn)
+	__attribute__((weak, alias("__ieee754_scalb")));
+#else
+double scalb(double x, double fn)
+	__attribute__((weak, alias("__ieee754_scalb")));
+#endif
+#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..e57034262 100644
--- a/newlib/libm/math/e_sinh.c
+++ b/newlib/libm/math/e_sinh.c
@@ -39,6 +39,11 @@  static const double one = 1.0, shuge = 1.0e307;
 static double one = 1.0, shuge = 1.0e307;
 #endif
 
+#ifdef _IEEE_LIBM
+double sinh(double x)
+	__attribute__((weak, alias("__ieee754_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..3a9ec699a 100644
--- a/newlib/libm/math/e_sqrt.c
+++ b/newlib/libm/math/e_sqrt.c
@@ -91,6 +91,11 @@  static	const double	one	= 1.0, tiny=1.0e-300;
 static	double	one	= 1.0, tiny=1.0e-300;
 #endif
 
+#ifdef _IEEE_LIBM
+double sqrt(double x)
+	__attribute__((weak, alias("__ieee754_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..655bbf677 100644
--- a/newlib/libm/math/ef_acos.c
+++ b/newlib/libm/math/ef_acos.c
@@ -35,6 +35,11 @@  qS2 =  2.0209457874e+00, /* 0x4001572d */
 qS3 = -6.8828397989e-01, /* 0xbf303361 */
 qS4 =  7.7038154006e-02; /* 0x3d9dc62e */
 
+#ifdef _IEEE_LIBM
+float acosf(float x)
+	__attribute__((weak, alias("__ieee754_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..66b46f596 100644
--- a/newlib/libm/math/ef_acosh.c
+++ b/newlib/libm/math/ef_acosh.c
@@ -24,6 +24,11 @@  static float
 one	= 1.0,
 ln2	= 6.9314718246e-01;  /* 0x3f317218 */
 
+#ifdef _IEEE_LIBM
+float acoshf(float x)
+	__attribute__((weak, alias("__ieee754_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..2346bc6bd 100644
--- a/newlib/libm/math/ef_asin.c
+++ b/newlib/libm/math/ef_asin.c
@@ -37,6 +37,11 @@  qS2 =  2.0209457874e+00, /* 0x4001572d */
 qS3 = -6.8828397989e-01, /* 0xbf303361 */
 qS4 =  7.7038154006e-02; /* 0x3d9dc62e */
 
+#ifdef _IEEE_LIBM
+float asinf(float x)
+	__attribute__((weak, alias("__ieee754_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..1d8ca633a 100644
--- a/newlib/libm/math/ef_atan2.c
+++ b/newlib/libm/math/ef_atan2.c
@@ -28,6 +28,11 @@  pi_o_2  = 1.5707963705e+00, /* 0x3fc90fdb */
 pi      = 3.1415927410e+00,  /* 0x40490fdb */
 pi_lo   = -8.7422776573e-08; /* 0xb3bbbd2e */
 
+#ifdef _IEEE_LIBM
+float atan2f(float y, float x)
+	__attribute__((weak, alias("__ieee754_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..fb0dbd214 100644
--- a/newlib/libm/math/ef_atanh.c
+++ b/newlib/libm/math/ef_atanh.c
@@ -28,6 +28,11 @@  static const float zero = 0.0;
 static float zero = 0.0;
 #endif
 
+#ifdef _IEEE_LIBM
+float atanhf(float x)
+	__attribute__((weak, alias("__ieee754_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..3c3872588 100644
--- a/newlib/libm/math/ef_cosh.c
+++ b/newlib/libm/math/ef_cosh.c
@@ -25,6 +25,11 @@  static const float one = 1.0, half=0.5, huge = 1.0e30;
 static float one = 1.0, half=0.5, huge = 1.0e30;
 #endif
 
+#ifdef _IEEE_LIBM
+float coshf(float x)
+	__attribute__((weak, alias("__ieee754_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..1f20d5ffb 100644
--- a/newlib/libm/math/ef_exp.c
+++ b/newlib/libm/math/ef_exp.c
@@ -40,6 +40,11 @@  P3   =  6.6137559770e-05, /* 0x388ab355 */
 P4   = -1.6533901999e-06, /* 0xb5ddea0e */
 P5   =  4.1381369442e-08; /* 0x3331bb4c */
 
+#ifdef _IEEE_LIBM
+float expf(float x)
+	__attribute__((weak, alias("__ieee754_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..9a27c5dfe 100644
--- a/newlib/libm/math/ef_fmod.c
+++ b/newlib/libm/math/ef_fmod.c
@@ -27,6 +27,11 @@  static const float one = 1.0, Zero[] = {0.0, -0.0,};
 static float one = 1.0, Zero[] = {0.0, -0.0,};
 #endif
 
+#ifdef _IEEE_LIBM
+float fmodf(float x, float y)
+	__attribute__((weak, alias("__ieee754_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..9ad0e71fa 100644
--- a/newlib/libm/math/ef_hypot.c
+++ b/newlib/libm/math/ef_hypot.c
@@ -15,6 +15,11 @@ 
 
 #include "fdlibm.h"
 
+#ifdef _IEEE_LIBM
+float hypotf(float x, float y)
+	__attribute__((weak, alias("__ieee754_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..201b27830 100644
--- a/newlib/libm/math/ef_j0.c
+++ b/newlib/libm/math/ef_j0.c
@@ -46,6 +46,11 @@  static const float zero = 0.0;
 static float zero = 0.0;
 #endif
 
+#ifdef _IEEE_LIBM
+float j0f(float x)
+	__attribute__((weak, alias("__ieee754_j0f")));
+#endif
+
 #ifdef __STDC__
 	float __ieee754_j0f(float x) 
 #else
@@ -115,6 +120,11 @@  v02  =  7.6006865129e-05, /* 0x389f65e0 */
 v03  =  2.5915085189e-07, /* 0x348b216c */
 v04  =  4.4111031494e-10; /* 0x2ff280c2 */
 
+#ifdef _IEEE_LIBM
+float y0f(float x)
+	__attribute__((weak, alias("__ieee754_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..4d57ff40a 100644
--- a/newlib/libm/math/ef_j1.c
+++ b/newlib/libm/math/ef_j1.c
@@ -47,6 +47,11 @@  static const float zero    = 0.0;
 static float zero    = 0.0;
 #endif
 
+#ifdef _IEEE_LIBM
+float j1f(float x)
+	__attribute__((weak, alias("__ieee754_j1f")));
+#endif
+
 #ifdef __STDC__
 	float __ieee754_j1f(float x) 
 #else
@@ -116,6 +121,11 @@  static float V0[5] = {
   1.6655924903e-11, /* 0x2d9281cf */
 };
 
+#ifdef _IEEE_LIBM
+float y1f(float x)
+	__attribute__((weak, alias("__ieee754_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..4481a49a7 100644
--- a/newlib/libm/math/ef_jn.c
+++ b/newlib/libm/math/ef_jn.c
@@ -29,6 +29,11 @@  static const float zero  =  0.0000000000e+00;
 static float zero  =  0.0000000000e+00;
 #endif
 
+#ifdef _IEEE_LIBM
+float jnf(int n, float x)
+	__attribute__((weak, alias("__ieee754_jnf")));
+#endif
+
 #ifdef __STDC__
 	float __ieee754_jnf(int n, float x)
 #else
@@ -166,6 +171,11 @@  static float zero  =  0.0000000000e+00;
 	if(sgn==1) return -b; else return b;
 }
 
+#ifdef _IEEE_LIBM
+float ynf(int n, float x)
+	__attribute__((weak, alias("__ieee754_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..160ee7057 100644
--- a/newlib/libm/math/ef_log.c
+++ b/newlib/libm/math/ef_log.c
@@ -38,6 +38,11 @@  static const float zero   =  0.0;
 static float zero   =  0.0;
 #endif
 
+#ifdef _IEEE_LIBM
+float logf(float x)
+	__attribute__((weak, alias("__ieee754_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..51c57a15a 100644
--- a/newlib/libm/math/ef_log10.c
+++ b/newlib/libm/math/ef_log10.c
@@ -31,6 +31,11 @@  static const float zero   =  0.0;
 static float zero   =  0.0;
 #endif
 
+#ifdef _IEEE_LIBM
+float log10f(float x)
+	__attribute__((weak, alias("__ieee754_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..8953dc44d 100644
--- a/newlib/libm/math/ef_pow.c
+++ b/newlib/libm/math/ef_pow.c
@@ -57,6 +57,11 @@  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*/
 
+#ifdef _IEEE_LIBM
+float powf(float x, float y)
+	__attribute__((weak, alias("__ieee754_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..73d0e3248 100644
--- a/newlib/libm/math/ef_rem_pio2.c
+++ b/newlib/libm/math/ef_rem_pio2.c
@@ -95,6 +95,11 @@  pio2_2t =  6.0770999344e-11, /* 0x2e85a308 */
 pio2_3  =  6.0770943833e-11, /* 0x2e85a300 */
 pio2_3t =  6.1232342629e-17; /* 0x248d3132 */
 
+#ifdef _IEEE_LIBM
+__int32_t rem_pio2f(float x, float *y)
+	__attribute__((weak, alias("__ieee754_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..7fccd95eb 100644
--- a/newlib/libm/math/ef_remainder.c
+++ b/newlib/libm/math/ef_remainder.c
@@ -22,6 +22,11 @@  static float zero = 0.0;
 #endif
 
 
+#ifdef _IEEE_LIBM
+float remainderf(float x, float p)
+	__attribute__((weak, alias("__ieee754_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..c8cca24f7 100644
--- a/newlib/libm/math/ef_scalb.c
+++ b/newlib/libm/math/ef_scalb.c
@@ -16,6 +16,16 @@ 
 #include "fdlibm.h"
 #include <limits.h>
 
+#ifdef _IEEE_LIBM
+#ifdef _SCALB_INT
+float scalbf(float x, int fn)
+	__attribute__((weak, alias("__ieee754_scalbf")));
+#else
+float scalbf(float x, float fn)
+	__attribute__((weak, alias("__ieee754_scalbf")));
+#endif
+#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..db4c20485 100644
--- a/newlib/libm/math/ef_sinh.c
+++ b/newlib/libm/math/ef_sinh.c
@@ -21,6 +21,11 @@  static const float one = 1.0, shuge = 1.0e37;
 static float one = 1.0, shuge = 1.0e37;
 #endif
 
+#ifdef _IEEE_LIBM
+float sinhf(float x)
+	__attribute__((weak, alias("__ieee754_sinhf")));
+#endif
+
 #ifdef __STDC__
 	float __ieee754_sinhf(float x)
 #else
diff --git a/newlib/libm/math/ef_sqrt.c b/newlib/libm/math/ef_sqrt.c
index 80e7f360e..5be7ab4d0 100644
--- a/newlib/libm/math/ef_sqrt.c
+++ b/newlib/libm/math/ef_sqrt.c
@@ -21,6 +21,11 @@  static	const float	one	= 1.0, tiny=1.0e-30;
 static	float	one	= 1.0, tiny=1.0e-30;
 #endif
 
+#ifdef _IEEE_LIBM
+float sqrtf(float x)
+	__attribute__((weak, alias("__ieee754_sqrtf")));
+#endif
+
 #ifdef __STDC__
 	float __ieee754_sqrtf(float x)
 #else
diff --git a/newlib/libm/math/er_gamma.c b/newlib/libm/math/er_gamma.c
index 3c0e241e5..245ab822c 100644
--- a/newlib/libm/math/er_gamma.c
+++ b/newlib/libm/math/er_gamma.c
@@ -21,6 +21,11 @@ 
 
 #include "fdlibm.h"
 
+#ifdef _IEEE_LIBM
+double gamma_r(double x, int *signgamp)
+	__attribute__((weak, alias("__ieee754_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..df4f5552d 100644
--- a/newlib/libm/math/er_lgamma.c
+++ b/newlib/libm/math/er_lgamma.c
@@ -209,6 +209,11 @@  static double zero=  0.00000000000000000000e+00;
 }
 
 
+#ifdef _IEEE_LIBM
+double lgamma_r(double x, int *signgamp)
+	__attribute__((weak, alias("__ieee754_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..e7b87efe4 100644
--- a/newlib/libm/math/erf_gamma.c
+++ b/newlib/libm/math/erf_gamma.c
@@ -23,6 +23,11 @@ 
 
 #include "fdlibm.h"
 
+#ifdef _IEEE_LIBM
+float gammaf_r(float x, int *signgamp)
+	__attribute__((weak, alias("__ieee754_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..4df4418c4 100644
--- a/newlib/libm/math/erf_lgamma.c
+++ b/newlib/libm/math/erf_lgamma.c
@@ -144,6 +144,11 @@  static float zero=  0.0000000000e+00;
 }
 
 
+#ifdef _IEEE_LIBM
+float lgammaf_r(float x, int *signgamp)
+	__attribute__((weak, alias("__ieee754_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..2cd5247e2 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>
 
+#ifndef _IEEE_LIBM
 #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..5979526ab 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>
 
+
+#ifndef _IEEE_LIBM
 #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..a39ca9425 100644
--- a/newlib/libm/math/w_asin.c
+++ b/newlib/libm/math/w_asin.c
@@ -76,6 +76,7 @@  MATHREF
 
 #ifndef _DOUBLE_IS_32BITS
 
+#ifndef _IEEE_LIBM
 #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..1be3f5da2 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>
 
+#ifndef _IEEE_LIBM
 #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..9cfa0111f 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>
 
+#ifndef _IEEE_LIBM
 #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..1b6e9ece8 100644
--- a/newlib/libm/math/w_exp.c
+++ b/newlib/libm/math/w_exp.c
@@ -58,6 +58,7 @@  PORTABILITY
 
 #ifndef _DOUBLE_IS_32BITS
 
+#ifndef _IEEE_LIBM
 #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..db8a52dfc 100644
--- a/newlib/libm/math/w_fmod.c
+++ b/newlib/libm/math/w_fmod.c
@@ -58,6 +58,7 @@  PORTABILITY
 
 #ifndef _DOUBLE_IS_32BITS
 
+#ifndef _IEEE_LIBM
 #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..bb4dca845 100644
--- a/newlib/libm/math/w_hypot.c
+++ b/newlib/libm/math/w_hypot.c
@@ -55,6 +55,7 @@  PORTABILITY
 
 #ifndef _DOUBLE_IS_32BITS
 
+#ifndef _IEEE_LIBM
 #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..d706a7714 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
 
+#ifndef _IEEE_LIBM
 #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
 
+#ifndef _IEEE_LIBM
 #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..902369ed6 100644
--- a/newlib/libm/math/w_j1.c
+++ b/newlib/libm/math/w_j1.c
@@ -20,6 +20,7 @@ 
 
 #ifndef _DOUBLE_IS_32BITS
 
+#ifndef _IEEE_LIBM
 #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
 
+#ifndef _IEEE_LIBM
 #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..e4cb4d157 100644
--- a/newlib/libm/math/w_jn.c
+++ b/newlib/libm/math/w_jn.c
@@ -42,6 +42,7 @@ 
 
 #ifndef _DOUBLE_IS_32BITS
 
+#ifndef _IEEE_LIBM
 #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
 
+#ifndef _IEEE_LIBM
 #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..9c1e9ba2d 100644
--- a/newlib/libm/math/w_log.c
+++ b/newlib/libm/math/w_log.c
@@ -54,6 +54,7 @@  PORTABILITY
 
 #ifndef _DOUBLE_IS_32BITS
 
+#ifndef _IEEE_LIBM
 #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..3c4ce18aa 100644
--- a/newlib/libm/math/w_log10.c
+++ b/newlib/libm/math/w_log10.c
@@ -50,6 +50,7 @@  PORTABILITY
 
 #ifndef _DOUBLE_IS_32BITS
 
+#ifndef _IEEE_LIBM
 #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..46bb70f07 100644
--- a/newlib/libm/math/w_pow.c
+++ b/newlib/libm/math/w_pow.c
@@ -57,6 +57,7 @@  PORTABILITY
 
 #ifndef _DOUBLE_IS_32BITS
 
+#ifndef _IEEE_LIBM
 #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..325a1f3a9 100644
--- a/newlib/libm/math/w_remainder.c
+++ b/newlib/libm/math/w_remainder.c
@@ -46,6 +46,7 @@  PORTABILITY
 
 #ifndef _DOUBLE_IS_32BITS
 
+#ifndef _IEEE_LIBM
 #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..b1aa1c9b0 100644
--- a/newlib/libm/math/w_scalb.c
+++ b/newlib/libm/math/w_scalb.c
@@ -22,6 +22,8 @@ 
 
 #ifndef _DOUBLE_IS_32BITS
 
+#ifndef _IEEE_LIBM
+
 #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..77136c83d 100644
--- a/newlib/libm/math/w_sinh.c
+++ b/newlib/libm/math/w_sinh.c
@@ -66,6 +66,7 @@  QUICKREF
 
 #ifndef _DOUBLE_IS_32BITS
 
+#ifndef _IEEE_LIBM
 #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..793426294 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>
 
+#ifndef _IEEE_LIBM
 #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..c945600a9 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>
 
+#ifndef _IEEE_LIBM
 	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..9d0165e66 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>
 
+#ifndef _IEEE_LIBM
 #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..ff5815211 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>
 
+#ifndef _IEEE_LIBM
 #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..d69c344ab 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>
 
+#ifndef _IEEE_LIBM
 #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..68cbc0754 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>
 
+#ifndef _IEEE_LIBM
 #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..277cd025b 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>
 
+#ifndef _IEEE_LIBM
 #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..af6683baf 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>
 
+#ifndef _IEEE_LIBM
 #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..a1b5d171f 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>
 
+#ifndef _IEEE_LIBM
 #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..15310a678 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>
 
+#ifndef _IEEE_LIBM
 #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..8ed93d926 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>
 
+#ifndef _IEEE_LIBM
 #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
 
+#ifndef _IEEE_LIBM
 #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..86aadf0e5 100644
--- a/newlib/libm/math/wf_j1.c
+++ b/newlib/libm/math/wf_j1.c
@@ -21,6 +21,7 @@ 
 #include <errno.h>
 
 
+#ifndef _IEEE_LIBM
 #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
 
+#ifndef _IEEE_LIBM
 #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..0bd49a79b 100644
--- a/newlib/libm/math/wf_jn.c
+++ b/newlib/libm/math/wf_jn.c
@@ -17,6 +17,7 @@ 
 #include <errno.h>
 
 
+#ifndef _IEEE_LIBM
 #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
 
+#ifndef _IEEE_LIBM
 #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..01aaacad9 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>
 
+#ifndef _IEEE_LIBM
 #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..3ed01653a 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>
 
+#ifndef _IEEE_LIBM
 #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..a201c7336 100644
--- a/newlib/libm/math/wf_log10.c
+++ b/newlib/libm/math/wf_log10.c
@@ -20,6 +20,8 @@ 
 #include "fdlibm.h"
 #include <errno.h>
 
+#ifndef _IEEE_LIBM
+	return __ieee754_log10f(x);
 #ifdef __STDC__
 	float log10f(float x)		/* wrapper log10f */
 #else
@@ -27,9 +29,6 @@ 
 	float x;
 #endif
 {
-#ifdef _IEEE_LIBM
-	return __ieee754_log10f(x);
-#else
 	float z;
 	struct exception exc;
 	z = __ieee754_log10f(x);
@@ -71,8 +70,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..7ab2b7cca 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>
 
+#ifndef _IEEE_LIBM
 #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..b976e3616 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>
 
+#ifndef _IEEE_LIBM
 #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..58df3dfc6 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>
 
+#ifndef _IEEE_LIBM
 #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..9657ad8fc 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>
 
+#ifndef _IEEE_LIBM
 #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..784fa0df7 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>
 
+#ifndef _IEEE_LIBM
 #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..17f02be82 100644
--- a/newlib/libm/math/wr_gamma.c
+++ b/newlib/libm/math/wr_gamma.c
@@ -20,6 +20,7 @@ 
 
 #ifndef _DOUBLE_IS_32BITS
 
+#ifndef _IEEE_LIBM
 #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..ef38d9525 100644
--- a/newlib/libm/math/wr_lgamma.c
+++ b/newlib/libm/math/wr_lgamma.c
@@ -20,6 +20,7 @@ 
 
 #ifndef _DOUBLE_IS_32BITS
 
+#ifndef _IEEE_LIBM
 #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..4cb3cc1a1 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>
 
+#ifndef _IEEE_LIBM
 #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..60e4b9952 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>
 
+#ifndef _IEEE_LIBM
 #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