about summary refs log tree commit diff
path: root/sysdeps/ieee754/ldbl-96
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2017-09-14 22:28:53 +0000
committerJoseph Myers <joseph@codesourcery.com>2017-09-14 22:28:53 +0000
commit01f2881245eabf6daeeb8505242047ece4027c5a (patch)
treef0029f6a0e5c9c7289119ae573b4ea28508e4764 /sysdeps/ieee754/ldbl-96
parent503c92c37a95f769762e65aff9383b302178c2bc (diff)
downloadglibc-01f2881245eabf6daeeb8505242047ece4027c5a.tar.gz
glibc-01f2881245eabf6daeeb8505242047ece4027c5a.tar.xz
glibc-01f2881245eabf6daeeb8505242047ece4027c5a.zip
Make more libm functions into weak aliases.
Many libm functions define the function as __<func> and then define
<func> as a weak alias.  This is not at all limited to cases where
there is an internal call that has namespace reasons to need to call
__<func> instead of <func>.

The common macros for creating libm function aliases work on the basis
of public function names all being aliases; that is, they define
aliases for functions using the above pattern.  Thus, where a function
just defines the public name <func> directly, changing that to be a
weak alias enables a subsequent conversion to the common macros to
retain the exact existing symbols (and so be testable by comparison of
stripped binaries).

This patch converts many existing functions to use the weak alias
pattern, as preparation for subsequent conversions to common macros.
I do expect that _FloatN/_FloatNx function aliases will end up needing
new variants of the common macros that do *not* create the original
float / double / long double name of a function - for cases where that
name is created specially to give it a particular symbol version, for
example - but for functions that can use the most common macros to
create all the public names as aliases, it makes sense for them to do
so.

Regarding the Bessel function wrappers in this patch: only float and
double wrappers are changed because the long double wrappers already
used the weak alias pattern.

Tested for x86_64, and with build-many-glibcs.py.

	* include/math.h (roundeven): Change hidden_proto call to
	__roundeven.
	* math/w_j0_compat.c (j0): Rename to __j0 and define as weak
	alias.
	[NO_LONG_DOUBLE] (__j0l): New strong alias.
	(y0): Rename to __y0 and define as weak alias.
	[NO_LONG_DOUBLE] (__y0l): New strong alias.
	* math/w_j0f_compat.c (j0f): Rename to __j0f and define as weak
	alias.
	(y0f): Rename to __y0f and define as weak alias.
	* math/w_j1_compat.c (j1): Rename to __j1 and define as weak
	alias.
	[NO_LONG_DOUBLE] (__j1l): New strong alias.
	(y1): Rename to __y1 and define as weak alias.
	[NO_LONG_DOUBLE] (__y1l): New strong alias.
	* math/w_j1f_compat.c (j1f): Rename to __j1f and define as weak
	alias.
	(y1f): Rename to __y1f and define as weak alias.
	* math/w_jn_compat.c (jn): Rename to __jn and define as weak
	alias.
	[NO_LONG_DOUBLE] (__jnl): New strong alias.
	(yn): Rename to __yn and define as weak alias.
	[NO_LONG_DOUBLE] (__ynl): New strong alias.
	* math/w_jnf_compat.c (jnf): Rename to __jnf and define as weak
	alias.
	(ynf): Rename to __ynf and define as weak alias.
	* sysdeps/ieee754/dbl-64/s_fromfp.c (FUNC): Define to __fromfp.
	(fromfp): Define as weak alias.
	[NO_LONG_DOUBLE] (__fromfpl): New strong alias.
	* sysdeps/ieee754/dbl-64/s_fromfpx.c (FUNC): Define to __fromfpx.
	(fromfpx): Define as weak alias.
	[NO_LONG_DOUBLE] (__fromfpxl): New strong alias.
	* sysdeps/ieee754/dbl-64/s_getpayload.c (getpayload): Rename to
	__getpayload and define as weak alias.
	[NO_LONG_DOUBLE] (__getpayloadl): New strong alias.
	* sysdeps/ieee754/dbl-64/s_roundeven.c (roundeven): Rename to
	__roundeven and define as weak alias.
	[NO_LONG_DOUBLE] (__roundevenl): New strong alias.
	* sysdeps/ieee754/dbl-64/s_setpayload.c (FUNC): Define to
	__setpayload.
	(setpayload): Define as weak alias.
	[NO_LONG_DOUBLE] (__setpayloadl): New strong alias.
	* sysdeps/ieee754/dbl-64/s_setpayloadsig.c (FUNC): Define to
	__setpayloadsig.
	(setpayloadsig): Define as weak alias.
	[NO_LONG_DOUBLE] (__setpayloadsigl): New strong alias.
	* sysdeps/ieee754/dbl-64/s_totalorder.c (totalorder): Rename to
	__totalorder and define as weak alias.
	[NO_LONG_DOUBLE] (__totalorderl): New strong alias.
	* sysdeps/ieee754/dbl-64/s_totalordermag.c (totalordermag): Rename
	to __totalordermag and define as weak alias.
	[NO_LONG_DOUBLE] (__totalordermagl): New strong alias.
	* sysdeps/ieee754/dbl-64/s_ufromfp.c (FUNC): Define to __ufromfp.
	(ufromfp): Define as weak alias.
	[NO_LONG_DOUBLE] (__ufromfpl): New strong alias.
	* sysdeps/ieee754/dbl-64/s_ufromfpx.c (FUNC): Define to
	__ufromfpx.
	(ufromfpx): Define as weak alias.
	[NO_LONG_DOUBLE] (__ufromfpxl): New strong alias.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_getpayload.c (getpayload):
	Rename to __getpayload and define as weak alias.
	[NO_LONG_DOUBLE] (__getpayloadl): New strong alias.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_roundeven.c (roundeven):
	Rename to __roundeven and define as weak alias.
	[NO_LONG_DOUBLE] (__roundevenl): New strong alias.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_totalorder.c (totalorder):
	Rename to __totalorder and define as weak alias.
	[NO_LONG_DOUBLE] (__totalorderl): New strong alias.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_totalordermag.c
	(totalordermag): Rename to __totalordermag and define as weak
	alias.
	[NO_LONG_DOUBLE] (__totalordermagl): New strong alias.
	* sysdeps/ieee754/float128/float128_private.h (__getpayloadl): New
	macro.
	(__roundevenl): Likewise.
	(__totalorderl): Likewise.
	(__totalordermagl): Likewise
	* sysdeps/ieee754/float128/s_fromfpf128.c (FUNC): Define to
	__fromfpf128.
	(fromfpf128): Define as weak alias.
	* sysdeps/ieee754/float128/s_fromfpxf128.c (FUNC): Define to
	__fromfpxf128.
	(fromfpxf128): Define as weak alias.
	* sysdeps/ieee754/float128/s_setpayloadf128.c (FUNC): Define to
	__setpayloadf128.
	(setpayloadf128): Define as weak alias.
	* sysdeps/ieee754/float128/s_setpayloadsigf128.c (FUNC): Define to
	__setpayloadsigf128.
	(setpayloadsigf128): Define as weak alias.
	* sysdeps/ieee754/float128/s_ufromfpf128.c (FUNC): Define to
	__ufromfpf128.
	(ufromfpf128): Define as weak alias.
	* sysdeps/ieee754/float128/s_ufromfpxf128.c (FUNC): Define to
	__ufromfpxf128.
	(ufromfpxf128): Define as weak alias.
	* sysdeps/ieee754/flt-32/s_fromfpf.c (FUNC): Define to __fromfpf.
	(fromfpf): Define as weak alias.
	* sysdeps/ieee754/flt-32/s_fromfpxf.c (FUNC): Define to
	__fromfpxf.
	(fromfpxf): Define as weak alias.
	* sysdeps/ieee754/flt-32/s_getpayloadf.c (getpayloadf): Rename to
	__getpayloadf and define as weak alias.
	* sysdeps/ieee754/flt-32/s_roundevenf.c (roundevenf): Rename to
	__roundevenf and define as weak alias.
	* sysdeps/ieee754/flt-32/s_setpayloadf.c (FUNC): Define to
	__setpayloadf.
	(setpayloadf): Define as weak alias.
	* sysdeps/ieee754/flt-32/s_setpayloadsigf.c (FUNC): Define to
	__setpayloadsigf.
	(setpayloadsigf): Define as weak alias.
	* sysdeps/ieee754/flt-32/s_totalorderf.c (totalorderf): Rename to
	__totalorderf and define as weak alias.
	* sysdeps/ieee754/flt-32/s_totalordermagf.c (totalordermagf):
	Rename to __totalordermagf and define as weak alias.
	* sysdeps/ieee754/flt-32/s_ufromfpf.c (FUNC): Define to
	__ufromfpf.
	(ufromfpf): Define as weak alias.
	* sysdeps/ieee754/flt-32/s_ufromfpxf.c (FUNC): Define to
	__ufromfpxf.
	(ufromfpxf): Define as weak alias.
	* sysdeps/ieee754/ldbl-128/s_fromfpl.c (FUNC): Define to
	__fromfpl.
	(fromfpl): Define as weak alias.
	* sysdeps/ieee754/ldbl-128/s_fromfpxl.c (FUNC): Define to
	__fromfpxl.
	(fromfpxl): Define as weak alias.
	* sysdeps/ieee754/ldbl-128/s_getpayloadl.c (getpayloadl): Rename
	to __getpayloadl and define as weak alias.
	* sysdeps/ieee754/ldbl-128/s_roundevenl.c (roundevenl): Rename to
	__roundevenl and define as weak alias.
	* sysdeps/ieee754/ldbl-128/s_setpayloadl.c (FUNC): Define to
	__setpayloadl.
	(setpayloadl): Define as weak alias.
	* sysdeps/ieee754/ldbl-128/s_setpayloadsigl.c (FUNC): Define to
	__setpayloadsigl.
	(setpayloadsigl): Define as weak alias.
	* sysdeps/ieee754/ldbl-128/s_totalorderl.c (totalorderl): Rename
	to __totalorderl and define as weak alias.
	* sysdeps/ieee754/ldbl-128/s_totalordermagl.c (totalordermagl):
	Rename to __totalordermagl and define as weak alias.
	* sysdeps/ieee754/ldbl-128/s_ufromfpl.c (FUNC): Define to
	__ufromfpl.
	(ufromfpl): Define as weak alias.
	* sysdeps/ieee754/ldbl-128/s_ufromfpxl.c (FUNC): Define to
	__ufromfpxl.
	(ufromfpxl): Define as weak alias.
	* sysdeps/ieee754/ldbl-128ibm/s_fromfpl.c (FUNC): Define to
	__fromfpl.
	(fromfpl): Define as weak alias.
	* sysdeps/ieee754/ldbl-128ibm/s_fromfpxl.c (FUNC): Define to
	__fromfpxl.
	(fromfpxl): Define as weak alias.
	* sysdeps/ieee754/ldbl-128ibm/s_getpayloadl.c (getpayloadl):
	Rename to __getpayloadl and define as weak alias.
	* sysdeps/ieee754/ldbl-128ibm/s_roundevenl.c (roundevenl): Rename
	to __roundevenl and define as weak alias.  Call __roundeven
	instead of roundeven.
	* sysdeps/ieee754/ldbl-128ibm/s_setpayloadl.c (FUNC): Define to
	__setpayloadl.
	(setpayloadl): Define as weak alias.
	* sysdeps/ieee754/ldbl-128ibm/s_setpayloadsigl.c (FUNC): Define to
	__setpayloadsigl.
	(setpayloadsigl): Define as weak alias.
	* sysdeps/ieee754/ldbl-128ibm/s_totalorderl.c (totalorderl):
	Rename to __totalorderl and define as weak alias.
	* sysdeps/ieee754/ldbl-128ibm/s_totalordermagl.c (totalordermagl):
	Rename to __totalordermagl and define as weak alias.
	* sysdeps/ieee754/ldbl-128ibm/s_ufromfpl.c (FUNC): Define to
	__ufromfpl.
	(ufromfpl): Define as weak alias.
	* sysdeps/ieee754/ldbl-128ibm/s_ufromfpxl.c (FUNC): Define to
	__ufromfpxl.
	(ufromfpxl): Define as weak alias.
	* sysdeps/ieee754/ldbl-96/s_fromfpl.c (FUNC): Define to
	__fromfpl.
	(fromfpl): Define as weak alias.
	* sysdeps/ieee754/ldbl-96/s_fromfpxl.c (FUNC): Define to
	__fromfpxl.
	(fromfpxl): Define as weak alias.
	* sysdeps/ieee754/ldbl-96/s_getpayloadl.c (getpayloadl): Rename to
	__getpayloadl and define as weak alias.
	* sysdeps/ieee754/ldbl-96/s_roundevenl.c (roundevenl): Rename to
	__roundevenl and define as weak alias.
	* sysdeps/ieee754/ldbl-96/s_setpayloadl.c (FUNC): Define to
	__setpayloadl.
	(setpayloadl): Define as weak alias.
	* sysdeps/ieee754/ldbl-96/s_setpayloadsigl.c (FUNC): Define to
	__setpayloadsigl.
	(setpayloadsigl): Define as weak alias.
	* sysdeps/ieee754/ldbl-96/s_totalorderl.c (totalorderl): Rename to
	__totalorderl and define as weak alias.
	* sysdeps/ieee754/ldbl-96/s_totalordermagl.c (totalordermagl):
	Rename to __totalordermagl and define as weak alias.
	* sysdeps/ieee754/ldbl-96/s_ufromfpl.c (FUNC): Define to
	__ufromfpl.
	(ufromfpl): Define as weak alias.
	* sysdeps/ieee754/ldbl-96/s_ufromfpxl.c (FUNC): Define to
	__ufromfpxl.
	(ufromfpxl): Define as weak alias.
Diffstat (limited to 'sysdeps/ieee754/ldbl-96')
-rw-r--r--sysdeps/ieee754/ldbl-96/s_fromfpl.c3
-rw-r--r--sysdeps/ieee754/ldbl-96/s_fromfpxl.c3
-rw-r--r--sysdeps/ieee754/ldbl-96/s_getpayloadl.c3
-rw-r--r--sysdeps/ieee754/ldbl-96/s_roundevenl.c3
-rw-r--r--sysdeps/ieee754/ldbl-96/s_setpayloadl.c3
-rw-r--r--sysdeps/ieee754/ldbl-96/s_setpayloadsigl.c3
-rw-r--r--sysdeps/ieee754/ldbl-96/s_totalorderl.c3
-rw-r--r--sysdeps/ieee754/ldbl-96/s_totalordermagl.c3
-rw-r--r--sysdeps/ieee754/ldbl-96/s_ufromfpl.c3
-rw-r--r--sysdeps/ieee754/ldbl-96/s_ufromfpxl.c3
10 files changed, 20 insertions, 10 deletions
diff --git a/sysdeps/ieee754/ldbl-96/s_fromfpl.c b/sysdeps/ieee754/ldbl-96/s_fromfpl.c
index e323b4c25b..f3fdba33c1 100644
--- a/sysdeps/ieee754/ldbl-96/s_fromfpl.c
+++ b/sysdeps/ieee754/ldbl-96/s_fromfpl.c
@@ -1,4 +1,5 @@
 #define UNSIGNED 0
 #define INEXACT 0
-#define FUNC fromfpl
+#define FUNC __fromfpl
 #include <s_fromfpl_main.c>
+weak_alias (__fromfpl, fromfpl)
diff --git a/sysdeps/ieee754/ldbl-96/s_fromfpxl.c b/sysdeps/ieee754/ldbl-96/s_fromfpxl.c
index 2f3189d7de..9477cc2ea7 100644
--- a/sysdeps/ieee754/ldbl-96/s_fromfpxl.c
+++ b/sysdeps/ieee754/ldbl-96/s_fromfpxl.c
@@ -1,4 +1,5 @@
 #define UNSIGNED 0
 #define INEXACT 1
-#define FUNC fromfpxl
+#define FUNC __fromfpxl
 #include <s_fromfpl_main.c>
+weak_alias (__fromfpxl, fromfpxl)
diff --git a/sysdeps/ieee754/ldbl-96/s_getpayloadl.c b/sysdeps/ieee754/ldbl-96/s_getpayloadl.c
index 6efe97baee..2c4dab2f58 100644
--- a/sysdeps/ieee754/ldbl-96/s_getpayloadl.c
+++ b/sysdeps/ieee754/ldbl-96/s_getpayloadl.c
@@ -21,7 +21,7 @@
 #include <stdint.h>
 
 long double
-getpayloadl (const long double *x)
+__getpayloadl (const long double *x)
 {
   uint16_t se __attribute__ ((unused));
   uint32_t hx, lx;
@@ -30,3 +30,4 @@ getpayloadl (const long double *x)
   uint64_t ix = ((uint64_t) hx << 32) | lx;
   return (long double) ix;
 }
+weak_alias (__getpayloadl, getpayloadl)
diff --git a/sysdeps/ieee754/ldbl-96/s_roundevenl.c b/sysdeps/ieee754/ldbl-96/s_roundevenl.c
index dab6aa6558..de09535fa6 100644
--- a/sysdeps/ieee754/ldbl-96/s_roundevenl.c
+++ b/sysdeps/ieee754/ldbl-96/s_roundevenl.c
@@ -26,7 +26,7 @@
 #define MAX_EXP (2 * BIAS + 1)
 
 long double
-roundevenl (long double x)
+__roundevenl (long double x)
 {
   uint16_t se;
   uint32_t hx, lx;
@@ -122,3 +122,4 @@ roundevenl (long double x)
   SET_LDOUBLE_WORDS (x, se, hx, lx);
   return x;
 }
+weak_alias (__roundevenl, roundevenl)
diff --git a/sysdeps/ieee754/ldbl-96/s_setpayloadl.c b/sysdeps/ieee754/ldbl-96/s_setpayloadl.c
index 1aba33e6e2..bb07a3533a 100644
--- a/sysdeps/ieee754/ldbl-96/s_setpayloadl.c
+++ b/sysdeps/ieee754/ldbl-96/s_setpayloadl.c
@@ -1,3 +1,4 @@
 #define SIG 0
-#define FUNC setpayloadl
+#define FUNC __setpayloadl
 #include <s_setpayloadl_main.c>
+weak_alias (__setpayloadl, setpayloadl)
diff --git a/sysdeps/ieee754/ldbl-96/s_setpayloadsigl.c b/sysdeps/ieee754/ldbl-96/s_setpayloadsigl.c
index d97e2c8206..4e920360d4 100644
--- a/sysdeps/ieee754/ldbl-96/s_setpayloadsigl.c
+++ b/sysdeps/ieee754/ldbl-96/s_setpayloadsigl.c
@@ -1,3 +1,4 @@
 #define SIG 1
-#define FUNC setpayloadsigl
+#define FUNC __setpayloadsigl
 #include <s_setpayloadl_main.c>
+weak_alias (__setpayloadsigl, setpayloadsigl)
diff --git a/sysdeps/ieee754/ldbl-96/s_totalorderl.c b/sysdeps/ieee754/ldbl-96/s_totalorderl.c
index 16accad1ff..2d3b3b7d05 100644
--- a/sysdeps/ieee754/ldbl-96/s_totalorderl.c
+++ b/sysdeps/ieee754/ldbl-96/s_totalorderl.c
@@ -23,7 +23,7 @@
 #include <stdint.h>
 
 int
-totalorderl (long double x, long double y)
+__totalorderl (long double x, long double y)
 {
   int16_t expx, expy;
   uint32_t hx, hy;
@@ -55,3 +55,4 @@ totalorderl (long double x, long double y)
   ly ^= y_sign;
   return expx < expy || (expx == expy && (hx < hy || (hx == hy && lx <= ly)));
 }
+weak_alias (__totalorderl, totalorderl)
diff --git a/sysdeps/ieee754/ldbl-96/s_totalordermagl.c b/sysdeps/ieee754/ldbl-96/s_totalordermagl.c
index 6b370b2ade..2d22a0c518 100644
--- a/sysdeps/ieee754/ldbl-96/s_totalordermagl.c
+++ b/sysdeps/ieee754/ldbl-96/s_totalordermagl.c
@@ -23,7 +23,7 @@
 #include <stdint.h>
 
 int
-totalordermagl (long double x, long double y)
+__totalordermagl (long double x, long double y)
 {
   uint16_t expx, expy;
   uint32_t hx, hy;
@@ -49,3 +49,4 @@ totalordermagl (long double x, long double y)
 #endif
   return expx < expy || (expx == expy && (hx < hy || (hx == hy && lx <= ly)));
 }
+weak_alias (__totalordermagl, totalordermagl)
diff --git a/sysdeps/ieee754/ldbl-96/s_ufromfpl.c b/sysdeps/ieee754/ldbl-96/s_ufromfpl.c
index c686daa4a7..2176aa0cdd 100644
--- a/sysdeps/ieee754/ldbl-96/s_ufromfpl.c
+++ b/sysdeps/ieee754/ldbl-96/s_ufromfpl.c
@@ -1,4 +1,5 @@
 #define UNSIGNED 1
 #define INEXACT 0
-#define FUNC ufromfpl
+#define FUNC __ufromfpl
 #include <s_fromfpl_main.c>
+weak_alias (__ufromfpl, ufromfpl)
diff --git a/sysdeps/ieee754/ldbl-96/s_ufromfpxl.c b/sysdeps/ieee754/ldbl-96/s_ufromfpxl.c
index 906066c83c..2901151312 100644
--- a/sysdeps/ieee754/ldbl-96/s_ufromfpxl.c
+++ b/sysdeps/ieee754/ldbl-96/s_ufromfpxl.c
@@ -1,4 +1,5 @@
 #define UNSIGNED 1
 #define INEXACT 1
-#define FUNC ufromfpxl
+#define FUNC __ufromfpxl
 #include <s_fromfpl_main.c>
+weak_alias (__ufromfpxl, ufromfpxl)