about summary refs log tree commit diff
path: root/sysdeps/ieee754/dbl-64
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2017-09-29 23:54:33 +0000
committerJoseph Myers <joseph@codesourcery.com>2017-09-29 23:54:33 +0000
commit1e2bffd05c36a9be30d7092d6593a9e9aa009ada (patch)
tree58c96efbf24f98615dee97efafe6528b3d47e8b5 /sysdeps/ieee754/dbl-64
parent8172aad937f52fe4ae891a206492150815791f2a (diff)
downloadglibc-1e2bffd05c36a9be30d7092d6593a9e9aa009ada.tar.gz
glibc-1e2bffd05c36a9be30d7092d6593a9e9aa009ada.tar.xz
glibc-1e2bffd05c36a9be30d7092d6593a9e9aa009ada.zip
Use libm_alias_double for some dbl-64 functions.
Continuing the move of libm aliases to common macros that can create
_FloatN / _FloatNx aliases in future, this patch converts some dbl-64
functions to using libm_alias_double, thereby eliminating the need for
some ldbl-opt wrappers.

This patch deliberately limits what functions are converted so that it
can be verified by comparison of stipped binaries.  Specifically, atan
and tan are excluded because they first need converting to being weak
aliases; fma is omitted as it has additional complications with
versions in other directories (removing the ldbl-opt version can
e.g. cause the ldbl-128 version to be used instead of dbl-64); and
functions that have both dbl-64/wordsize-64 and ldbl-opt versions are
excluded because ldbl-opt currently always wraps dbl-64 function
versions, so changing those will result in platforms using both
ldbl-opt and dbl-64/wordsize-64 (i.e. alpha) starting to use the
dbl-64/wordsize-64 versions of those functions (which is good, as an
optimization, but still best separated from the present patch to get
better validation).

Tested for x86_64, and tested with build-many-glibcs.py that installed
stripped shared libraries are unchanged by the patch.

	* sysdeps/ieee754/dbl-64/s_asinh.c: Include <libm-alias-double.h>.
	(asinh): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_cbrt.c: Include <libm-alias-double.h>.
	(cbrt): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_copysign.c: Include
	<libm-alias-double.h>.
	(copysign): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_erf.c: Include <libm-alias-double.h>.
	(erf): Define using libm_alias_double.
	(erfc): Likewise.
	* sysdeps/ieee754/dbl-64/s_expm1.c: Include <libm-alias-double.h>.
	(expm1): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_fabs.c: Include <libm-alias-double.h>.
	(fabs): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_fromfp.c (fromfp): Define using
	libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_fromfp_main.c: Include
	<libm-alias-double.h>.
	* sysdeps/ieee754/dbl-64/s_fromfpx.c (fromfpx): Define using
	libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_getpayload.c: Include
	<libm-alias-double.h>.
	(getpayload): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_llrint.c: Include
	<libm-alias-double.h>.
	(llrint): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_lrint.c: Include <libm-alias-double.h>.
	(lrint): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_nextup.c: Include
	<libm-alias-double.h>.
	(nextup): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_roundeven.c: Include
	<libm-alias-double.h>.
	(roundeven): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_setpayload.c (setpayload): Define using
	libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_setpayload_main.c: Include
	<libm-alias-double.h>.
	* sysdeps/ieee754/dbl-64/s_setpayloadsig.c (setpayloadsig): Define
	using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_sin.c: Include <libm-alias-double.h>.
	(cos): Define using libm_alias_double.
	(sin): Likewise.
	* sysdeps/ieee754/dbl-64/s_sincos.c: Include
	<libm-alias-double.h>.
	(sincos): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_tanh.c: Include <libm-alias-double.h>.
	(tanh): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_totalorder.c: Include
	<libm-alias-double.h>.
	(totalorder): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_totalordermag.c: Include
	<libm-alias-double.h>.
	(totalordermag): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_ufromfp.c (ufromfp): Define using
	libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_ufromfpx.c (ufromfpx): Define using
	libm_alias_double.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_getpayload.c: Include
	<libm-alias-double.h>.
	(getpayload): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_roundeven.c: Include
	<libm-alias-double.h>.
	(roundeven): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_setpayload_main.c: Include
	<libm-alias-double.h>.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_totalorder.c: Include
	<libm-alias-double.h>.
	(totalorder): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_totalordermag.c: Include
	<libm-alias-double.h>.
	(totalordermag): Define using libm_alias_double.
	* sysdeps/ieee754/ldbl-opt/s_copysign.c (copysignl): Only define
	libc compat symbol here.
	* sysdeps/ieee754/ldbl-opt/s_asinh.c: Remove file.
	* sysdeps/ieee754/ldbl-opt/s_cbrt.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/s_erf.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/s_expm1.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/s_fabs.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/s_llrint.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/s_lrint.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/s_sin.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/s_sincos.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/s_tanh.c: Likewise.
Diffstat (limited to 'sysdeps/ieee754/dbl-64')
-rw-r--r--sysdeps/ieee754/dbl-64/s_asinh.c7
-rw-r--r--sysdeps/ieee754/dbl-64/s_cbrt.c7
-rw-r--r--sysdeps/ieee754/dbl-64/s_copysign.c7
-rw-r--r--sysdeps/ieee754/dbl-64/s_erf.c13
-rw-r--r--sysdeps/ieee754/dbl-64/s_expm1.c7
-rw-r--r--sysdeps/ieee754/dbl-64/s_fabs.c7
-rw-r--r--sysdeps/ieee754/dbl-64/s_fromfp.c6
-rw-r--r--sysdeps/ieee754/dbl-64/s_fromfp_main.c1
-rw-r--r--sysdeps/ieee754/dbl-64/s_fromfpx.c6
-rw-r--r--sysdeps/ieee754/dbl-64/s_getpayload.c7
-rw-r--r--sysdeps/ieee754/dbl-64/s_llrint.c7
-rw-r--r--sysdeps/ieee754/dbl-64/s_lrint.c7
-rw-r--r--sysdeps/ieee754/dbl-64/s_nextup.c7
-rw-r--r--sysdeps/ieee754/dbl-64/s_roundeven.c7
-rw-r--r--sysdeps/ieee754/dbl-64/s_setpayload.c6
-rw-r--r--sysdeps/ieee754/dbl-64/s_setpayload_main.c1
-rw-r--r--sysdeps/ieee754/dbl-64/s_setpayloadsig.c6
-rw-r--r--sysdeps/ieee754/dbl-64/s_sin.c13
-rw-r--r--sysdeps/ieee754/dbl-64/s_sincos.c7
-rw-r--r--sysdeps/ieee754/dbl-64/s_tanh.c7
-rw-r--r--sysdeps/ieee754/dbl-64/s_totalorder.c7
-rw-r--r--sysdeps/ieee754/dbl-64/s_totalordermag.c7
-rw-r--r--sysdeps/ieee754/dbl-64/s_ufromfp.c6
-rw-r--r--sysdeps/ieee754/dbl-64/s_ufromfpx.c6
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_getpayload.c7
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_roundeven.c7
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_setpayload_main.c1
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_totalorder.c7
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_totalordermag.c7
29 files changed, 51 insertions, 140 deletions
diff --git a/sysdeps/ieee754/dbl-64/s_asinh.c b/sysdeps/ieee754/dbl-64/s_asinh.c
index 9193301b5e..31f67e29a0 100644
--- a/sysdeps/ieee754/dbl-64/s_asinh.c
+++ b/sysdeps/ieee754/dbl-64/s_asinh.c
@@ -24,6 +24,7 @@
 #include <float.h>
 #include <math.h>
 #include <math_private.h>
+#include <libm-alias-double.h>
 
 static const double
   one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */
@@ -65,8 +66,4 @@ __asinh (double x)
     }
   return __copysign (w, x);
 }
-weak_alias (__asinh, asinh)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__asinh, __asinhl)
-weak_alias (__asinh, asinhl)
-#endif
+libm_alias_double (__asinh, asinh)
diff --git a/sysdeps/ieee754/dbl-64/s_cbrt.c b/sysdeps/ieee754/dbl-64/s_cbrt.c
index 689abc89ec..884476c75d 100644
--- a/sysdeps/ieee754/dbl-64/s_cbrt.c
+++ b/sysdeps/ieee754/dbl-64/s_cbrt.c
@@ -20,6 +20,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <libm-alias-double.h>
 
 
 #define CBRT2 1.2599210498948731648		/* 2^(1/3) */
@@ -69,8 +70,4 @@ __cbrt (double x)
 
   return __ldexp (x > 0.0 ? ym : -ym, xe / 3);
 }
-weak_alias (__cbrt, cbrt)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__cbrt, __cbrtl)
-weak_alias (__cbrt, cbrtl)
-#endif
+libm_alias_double (__cbrt, cbrt)
diff --git a/sysdeps/ieee754/dbl-64/s_copysign.c b/sysdeps/ieee754/dbl-64/s_copysign.c
index 7755e0d984..ab81d732ab 100644
--- a/sysdeps/ieee754/dbl-64/s_copysign.c
+++ b/sysdeps/ieee754/dbl-64/s_copysign.c
@@ -22,6 +22,7 @@ static char rcsid[] = "$NetBSD: s_copysign.c,v 1.8 1995/05/10 20:46:57 jtc Exp $
 
 #include <math.h>
 #include <math_private.h>
+#include <libm-alias-double.h>
 
 double
 __copysign (double x, double y)
@@ -32,8 +33,4 @@ __copysign (double x, double y)
   SET_HIGH_WORD (x, (hx & 0x7fffffff) | (hy & 0x80000000));
   return x;
 }
-weak_alias (__copysign, copysign)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__copysign, __copysignl)
-weak_alias (__copysign, copysignl)
-#endif
+libm_alias_double (__copysign, copysign)
diff --git a/sysdeps/ieee754/dbl-64/s_erf.c b/sysdeps/ieee754/dbl-64/s_erf.c
index 676b6f96e9..78287fd1cb 100644
--- a/sysdeps/ieee754/dbl-64/s_erf.c
+++ b/sysdeps/ieee754/dbl-64/s_erf.c
@@ -116,6 +116,7 @@ static char rcsid[] = "$NetBSD: s_erf.c,v 1.8 1995/05/10 20:47:05 jtc Exp $";
 #include <float.h>
 #include <math.h>
 #include <math_private.h>
+#include <libm-alias-double.h>
 #include <fix-int-fp-convert-zero.h>
 
 static const double
@@ -294,11 +295,7 @@ __erf (double x)
   else
     return r / x - one;
 }
-weak_alias (__erf, erf)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__erf, __erfl)
-weak_alias (__erf, erfl)
-#endif
+libm_alias_double (__erf, erf)
 
 double
 __erfc (double x)
@@ -421,8 +418,4 @@ __erfc (double x)
 	return two - tiny;
     }
 }
-weak_alias (__erfc, erfc)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__erfc, __erfcl)
-weak_alias (__erfc, erfcl)
-#endif
+libm_alias_double (__erfc, erfc)
diff --git a/sysdeps/ieee754/dbl-64/s_expm1.c b/sysdeps/ieee754/dbl-64/s_expm1.c
index 25370d3e78..3e136e7ee0 100644
--- a/sysdeps/ieee754/dbl-64/s_expm1.c
+++ b/sysdeps/ieee754/dbl-64/s_expm1.c
@@ -112,6 +112,7 @@
 #include <float.h>
 #include <math.h>
 #include <math_private.h>
+#include <libm-alias-double.h>
 #define one Q[0]
 static const double
   huge = 1.0e+300,
@@ -255,8 +256,4 @@ __expm1 (double x)
     }
   return y;
 }
-weak_alias (__expm1, expm1)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__expm1, __expm1l)
-weak_alias (__expm1, expm1l)
-#endif
+libm_alias_double (__expm1, expm1)
diff --git a/sysdeps/ieee754/dbl-64/s_fabs.c b/sysdeps/ieee754/dbl-64/s_fabs.c
index 73c09a269e..8232183324 100644
--- a/sysdeps/ieee754/dbl-64/s_fabs.c
+++ b/sysdeps/ieee754/dbl-64/s_fabs.c
@@ -19,14 +19,11 @@ static char rcsid[] = "$NetBSD: s_fabs.c,v 1.7 1995/05/10 20:47:13 jtc Exp $";
  */
 
 #include <math.h>
+#include <libm-alias-double.h>
 
 double
 __fabs (double x)
 {
   return __builtin_fabs (x);
 }
-weak_alias (__fabs, fabs)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__fabs, __fabsl)
-weak_alias (__fabs, fabsl)
-#endif
+libm_alias_double (__fabs, fabs)
diff --git a/sysdeps/ieee754/dbl-64/s_fromfp.c b/sysdeps/ieee754/dbl-64/s_fromfp.c
index efc02f7481..30572b2a9b 100644
--- a/sysdeps/ieee754/dbl-64/s_fromfp.c
+++ b/sysdeps/ieee754/dbl-64/s_fromfp.c
@@ -2,8 +2,4 @@
 #define INEXACT 0
 #define FUNC __fromfp
 #include <s_fromfp_main.c>
-weak_alias (__fromfp, fromfp)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__fromfp, __fromfpl)
-weak_alias (__fromfp, fromfpl)
-#endif
+libm_alias_double (__fromfp, fromfp)
diff --git a/sysdeps/ieee754/dbl-64/s_fromfp_main.c b/sysdeps/ieee754/dbl-64/s_fromfp_main.c
index ca0aa82092..c0539224ac 100644
--- a/sysdeps/ieee754/dbl-64/s_fromfp_main.c
+++ b/sysdeps/ieee754/dbl-64/s_fromfp_main.c
@@ -20,6 +20,7 @@
 #include <fenv.h>
 #include <math.h>
 #include <math_private.h>
+#include <libm-alias-double.h>
 #include <stdbool.h>
 #include <stdint.h>
 
diff --git a/sysdeps/ieee754/dbl-64/s_fromfpx.c b/sysdeps/ieee754/dbl-64/s_fromfpx.c
index 4451b2d08b..b7a0d59a05 100644
--- a/sysdeps/ieee754/dbl-64/s_fromfpx.c
+++ b/sysdeps/ieee754/dbl-64/s_fromfpx.c
@@ -2,8 +2,4 @@
 #define INEXACT 1
 #define FUNC __fromfpx
 #include <s_fromfp_main.c>
-weak_alias (__fromfpx, fromfpx)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__fromfpx, __fromfpxl)
-weak_alias (__fromfpx, fromfpxl)
-#endif
+libm_alias_double (__fromfpx, fromfpx)
diff --git a/sysdeps/ieee754/dbl-64/s_getpayload.c b/sysdeps/ieee754/dbl-64/s_getpayload.c
index a868109e0a..632d78e4be 100644
--- a/sysdeps/ieee754/dbl-64/s_getpayload.c
+++ b/sysdeps/ieee754/dbl-64/s_getpayload.c
@@ -19,6 +19,7 @@
 #include <fix-int-fp-convert-zero.h>
 #include <math.h>
 #include <math_private.h>
+#include <libm-alias-double.h>
 #include <stdint.h>
 
 double
@@ -32,8 +33,4 @@ __getpayload (const double *x)
     return 0.0f;
   return (double) ix;
 }
-weak_alias (__getpayload, getpayload)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__getpayload, __getpayloadl)
-weak_alias (__getpayload, getpayloadl)
-#endif
+libm_alias_double (__getpayload, getpayload)
diff --git a/sysdeps/ieee754/dbl-64/s_llrint.c b/sysdeps/ieee754/dbl-64/s_llrint.c
index 574c6087ee..b643563c44 100644
--- a/sysdeps/ieee754/dbl-64/s_llrint.c
+++ b/sysdeps/ieee754/dbl-64/s_llrint.c
@@ -23,6 +23,7 @@
 #include <math.h>
 
 #include <math_private.h>
+#include <libm-alias-double.h>
 #include <fix-fp-int-convert-overflow.h>
 
 static const double two52[2] =
@@ -96,8 +97,4 @@ __llrint (double x)
   return sx ? -result : result;
 }
 
-weak_alias (__llrint, llrint)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__llrint, __llrintl)
-weak_alias (__llrint, llrintl)
-#endif
+libm_alias_double (__llrint, llrint)
diff --git a/sysdeps/ieee754/dbl-64/s_lrint.c b/sysdeps/ieee754/dbl-64/s_lrint.c
index d2da6f9a5d..26ac66465d 100644
--- a/sysdeps/ieee754/dbl-64/s_lrint.c
+++ b/sysdeps/ieee754/dbl-64/s_lrint.c
@@ -23,6 +23,7 @@
 #include <math.h>
 
 #include <math_private.h>
+#include <libm-alias-double.h>
 #include <fix-fp-int-convert-overflow.h>
 
 static const double two52[2] =
@@ -120,8 +121,4 @@ __lrint (double x)
   return sx ? -result : result;
 }
 
-weak_alias (__lrint, lrint)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__lrint, __lrintl)
-weak_alias (__lrint, lrintl)
-#endif
+libm_alias_double (__lrint, lrint)
diff --git a/sysdeps/ieee754/dbl-64/s_nextup.c b/sysdeps/ieee754/dbl-64/s_nextup.c
index fb01859e91..624e1f075d 100644
--- a/sysdeps/ieee754/dbl-64/s_nextup.c
+++ b/sysdeps/ieee754/dbl-64/s_nextup.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <libm-alias-double.h>
 
 /* Return the least floating-point number greater than X.  */
 double
@@ -51,8 +52,4 @@ __nextup (double x)
   return x;
 }
 
-weak_alias (__nextup, nextup)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__nextup, __nextupl)
-weak_alias (__nextup, nextupl)
-#endif
+libm_alias_double (__nextup, nextup)
diff --git a/sysdeps/ieee754/dbl-64/s_roundeven.c b/sysdeps/ieee754/dbl-64/s_roundeven.c
index feb874c336..402f68a68d 100644
--- a/sysdeps/ieee754/dbl-64/s_roundeven.c
+++ b/sysdeps/ieee754/dbl-64/s_roundeven.c
@@ -19,6 +19,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <libm-alias-double.h>
 #include <stdint.h>
 
 #define BIAS 0x3ff
@@ -101,8 +102,4 @@ __roundeven (double x)
   return x;
 }
 hidden_def (__roundeven)
-weak_alias (__roundeven, roundeven)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__roundeven, __roundevenl)
-weak_alias (__roundeven, roundevenl)
-#endif
+libm_alias_double (__roundeven, roundeven)
diff --git a/sysdeps/ieee754/dbl-64/s_setpayload.c b/sysdeps/ieee754/dbl-64/s_setpayload.c
index a37846aa53..0f536956f4 100644
--- a/sysdeps/ieee754/dbl-64/s_setpayload.c
+++ b/sysdeps/ieee754/dbl-64/s_setpayload.c
@@ -1,8 +1,4 @@
 #define SIG 0
 #define FUNC __setpayload
 #include <s_setpayload_main.c>
-weak_alias (__setpayload, setpayload)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__setpayload, __setpayloadl)
-weak_alias (__setpayload, setpayloadl)
-#endif
+libm_alias_double (__setpayload, setpayload)
diff --git a/sysdeps/ieee754/dbl-64/s_setpayload_main.c b/sysdeps/ieee754/dbl-64/s_setpayload_main.c
index c6128c7fe4..98cf1d1bbe 100644
--- a/sysdeps/ieee754/dbl-64/s_setpayload_main.c
+++ b/sysdeps/ieee754/dbl-64/s_setpayload_main.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <libm-alias-double.h>
 #include <nan-high-order-bit.h>
 #include <stdint.h>
 
diff --git a/sysdeps/ieee754/dbl-64/s_setpayloadsig.c b/sysdeps/ieee754/dbl-64/s_setpayloadsig.c
index ad1ee7a3f3..96ea34b070 100644
--- a/sysdeps/ieee754/dbl-64/s_setpayloadsig.c
+++ b/sysdeps/ieee754/dbl-64/s_setpayloadsig.c
@@ -1,8 +1,4 @@
 #define SIG 1
 #define FUNC __setpayloadsig
 #include <s_setpayload_main.c>
-weak_alias (__setpayloadsig, setpayloadsig)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__setpayloadsig, __setpayloadsigl)
-weak_alias (__setpayloadsig, setpayloadsigl)
-#endif
+libm_alias_double (__setpayloadsig, setpayloadsig)
diff --git a/sysdeps/ieee754/dbl-64/s_sin.c b/sysdeps/ieee754/dbl-64/s_sin.c
index c258d39e49..3572af301f 100644
--- a/sysdeps/ieee754/dbl-64/s_sin.c
+++ b/sysdeps/ieee754/dbl-64/s_sin.c
@@ -52,6 +52,7 @@
 #include "MathLib.h"
 #include <math.h>
 #include <math_private.h>
+#include <libm-alias-double.h>
 #include <fenv.h>
 
 /* Helper macros to compute sin of the input values.  */
@@ -912,16 +913,8 @@ cslow2 (double x)
 }
 
 #ifndef __cos
-weak_alias (__cos, cos)
-# ifdef NO_LONG_DOUBLE
-strong_alias (__cos, __cosl)
-weak_alias (__cos, cosl)
-# endif
+libm_alias_double (__cos, cos)
 #endif
 #ifndef __sin
-weak_alias (__sin, sin)
-# ifdef NO_LONG_DOUBLE
-strong_alias (__sin, __sinl)
-weak_alias (__sin, sinl)
-# endif
+libm_alias_double (__sin, sin)
 #endif
diff --git a/sysdeps/ieee754/dbl-64/s_sincos.c b/sysdeps/ieee754/dbl-64/s_sincos.c
index 05cff50ce8..19c4d320c4 100644
--- a/sysdeps/ieee754/dbl-64/s_sincos.c
+++ b/sysdeps/ieee754/dbl-64/s_sincos.c
@@ -21,6 +21,7 @@
 #include <math.h>
 
 #include <math_private.h>
+#include <libm-alias-double.h>
 
 #define __sin __sin_local
 #define __cos __cos_local
@@ -106,8 +107,4 @@ __sincos (double x, double *sinx, double *cosx)
 
   *sinx = *cosx = x / x;
 }
-weak_alias (__sincos, sincos)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__sincos, __sincosl)
-weak_alias (__sincos, sincosl)
-#endif
+libm_alias_double (__sincos, sincos)
diff --git a/sysdeps/ieee754/dbl-64/s_tanh.c b/sysdeps/ieee754/dbl-64/s_tanh.c
index 344a2f0330..321bf44142 100644
--- a/sysdeps/ieee754/dbl-64/s_tanh.c
+++ b/sysdeps/ieee754/dbl-64/s_tanh.c
@@ -41,6 +41,7 @@ static char rcsid[] = "$NetBSD: s_tanh.c,v 1.7 1995/05/10 20:48:22 jtc Exp $";
 #include <float.h>
 #include <math.h>
 #include <math_private.h>
+#include <libm-alias-double.h>
 
 static const double one = 1.0, two = 2.0, tiny = 1.0e-300;
 
@@ -91,8 +92,4 @@ __tanh (double x)
     }
   return (jx >= 0) ? z : -z;
 }
-weak_alias (__tanh, tanh)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__tanh, __tanhl)
-weak_alias (__tanh, tanhl)
-#endif
+libm_alias_double (__tanh, tanh)
diff --git a/sysdeps/ieee754/dbl-64/s_totalorder.c b/sysdeps/ieee754/dbl-64/s_totalorder.c
index 2504319319..d67347897b 100644
--- a/sysdeps/ieee754/dbl-64/s_totalorder.c
+++ b/sysdeps/ieee754/dbl-64/s_totalorder.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <libm-alias-double.h>
 #include <nan-high-order-bit.h>
 #include <stdint.h>
 
@@ -49,8 +50,4 @@ __totalorder (double x, double y)
   ly ^= hy_sign;
   return hx < hy || (hx == hy && lx <= ly);
 }
-weak_alias (__totalorder, totalorder)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__totalorder, __totalorderl)
-weak_alias (__totalorder, totalorderl)
-#endif
+libm_alias_double (__totalorder, totalorder)
diff --git a/sysdeps/ieee754/dbl-64/s_totalordermag.c b/sysdeps/ieee754/dbl-64/s_totalordermag.c
index b5f3cff67e..c0ba226b2d 100644
--- a/sysdeps/ieee754/dbl-64/s_totalordermag.c
+++ b/sysdeps/ieee754/dbl-64/s_totalordermag.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <libm-alias-double.h>
 #include <nan-high-order-bit.h>
 #include <stdint.h>
 
@@ -44,8 +45,4 @@ __totalordermag (double x, double y)
 #endif
   return hx < hy || (hx == hy && lx <= ly);
 }
-weak_alias (__totalordermag, totalordermag)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__totalordermag, __totalordermagl)
-weak_alias (__totalordermag, totalordermagl)
-#endif
+libm_alias_double (__totalordermag, totalordermag)
diff --git a/sysdeps/ieee754/dbl-64/s_ufromfp.c b/sysdeps/ieee754/dbl-64/s_ufromfp.c
index f2b9537338..2532215981 100644
--- a/sysdeps/ieee754/dbl-64/s_ufromfp.c
+++ b/sysdeps/ieee754/dbl-64/s_ufromfp.c
@@ -2,8 +2,4 @@
 #define INEXACT 0
 #define FUNC __ufromfp
 #include <s_fromfp_main.c>
-weak_alias (__ufromfp, ufromfp)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__ufromfp, __ufromfpl)
-weak_alias (__ufromfp, ufromfpl)
-#endif
+libm_alias_double (__ufromfp, ufromfp)
diff --git a/sysdeps/ieee754/dbl-64/s_ufromfpx.c b/sysdeps/ieee754/dbl-64/s_ufromfpx.c
index f360e760e2..0945dfce08 100644
--- a/sysdeps/ieee754/dbl-64/s_ufromfpx.c
+++ b/sysdeps/ieee754/dbl-64/s_ufromfpx.c
@@ -2,8 +2,4 @@
 #define INEXACT 1
 #define FUNC __ufromfpx
 #include <s_fromfp_main.c>
-weak_alias (__ufromfpx, ufromfpx)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__ufromfpx, __ufromfpxl)
-weak_alias (__ufromfpx, ufromfpxl)
-#endif
+libm_alias_double (__ufromfpx, ufromfpx)
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_getpayload.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_getpayload.c
index 79a62e3e63..85eecb1c1f 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_getpayload.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_getpayload.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <libm-alias-double.h>
 #include <stdint.h>
 
 double
@@ -28,8 +29,4 @@ __getpayload (const double *x)
   ix &= 0x7ffffffffffffULL;
   return (double) ix;
 }
-weak_alias (__getpayload, getpayload)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__getpayload, __getpayloadl)
-weak_alias (__getpayload, getpayloadl)
-#endif
+libm_alias_double (__getpayload, getpayload)
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_roundeven.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_roundeven.c
index 3f7619b5f3..828c3760fd 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_roundeven.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_roundeven.c
@@ -19,6 +19,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <libm-alias-double.h>
 #include <stdint.h>
 
 #define BIAS 0x3ff
@@ -67,8 +68,4 @@ __roundeven (double x)
   return x;
 }
 hidden_def (__roundeven)
-weak_alias (__roundeven, roundeven)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__roundeven, __roundevenl)
-weak_alias (__roundeven, roundevenl)
-#endif
+libm_alias_double (__roundeven, roundeven)
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_setpayload_main.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_setpayload_main.c
index d4f6d55432..023b7cdb64 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_setpayload_main.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_setpayload_main.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <math_private.h>
+#include <libm-alias-double.h>
 #include <nan-high-order-bit.h>
 #include <stdint.h>
 
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_totalorder.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_totalorder.c
index 1d2b3d9710..1db23e2432 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_totalorder.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_totalorder.c
@@ -19,6 +19,7 @@
 #include <math.h>
 #include <math_private.h>
 #include <nan-high-order-bit.h>
+#include <libm-alias-double.h>
 #include <stdint.h>
 
 int
@@ -45,8 +46,4 @@ __totalorder (double x, double y)
   iy ^= iy_sign >> 1;
   return ix <= iy;
 }
-weak_alias (__totalorder, totalorder)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__totalorder, __totalorderl)
-weak_alias (__totalorder, totalorderl)
-#endif
+libm_alias_double (__totalorder, totalorder)
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_totalordermag.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_totalordermag.c
index 94ce11ccc5..7fcab90766 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_totalordermag.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_totalordermag.c
@@ -19,6 +19,7 @@
 #include <math.h>
 #include <math_private.h>
 #include <nan-high-order-bit.h>
+#include <libm-alias-double.h>
 #include <stdint.h>
 
 int
@@ -42,8 +43,4 @@ __totalordermag (double x, double y)
 #endif
   return ix <= iy;
 }
-weak_alias (__totalordermag, totalordermag)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__totalordermag, __totalordermagl)
-weak_alias (__totalordermag, totalordermagl)
-#endif
+libm_alias_double (__totalordermag, totalordermag)