aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2015-01-02 20:44:42 +0000
committerJoseph Myers <joseph@codesourcery.com>2015-01-02 20:44:42 +0000
commitb93c2205ec57af3c0491cdb608b53a9b4d7ff57e (patch)
tree3682a0c3612c9acf4f4e9f38a9d20c5ff098798c
parent253a59ccb571dc67b6dc303192d8d99378a35c75 (diff)
downloadglibc-b93c2205ec57af3c0491cdb608b53a9b4d7ff57e.tar
glibc-b93c2205ec57af3c0491cdb608b53a9b4d7ff57e.tar.gz
glibc-b93c2205ec57af3c0491cdb608b53a9b4d7ff57e.tar.bz2
glibc-b93c2205ec57af3c0491cdb608b53a9b4d7ff57e.zip
Fix libm fegetround namespace (bug 17748).
Continuing the fixes for C90 libm functions calling C99 fe* functions, this patch fixes the case of fegetround by making it a weak alias of __fegetround and making the affected code call __fegetround. Tested for x86_64 (testsuite, and that disassembly of installed shared libraries is unchanged by the patch). Also tested for ARM (soft-float) that fegetround failures disappear from the linknamespace test failures (feholdexcept, fesetenv, fesetround and feupdateenv remain to be addressed before bug 17748 is fully fixed, although this patch may suffice to fix the failures in some cases, when the libc_fe* functions are implemented but there is no architecture-specific sqrt implementation in use so there were failures from fegetround used by sqrt but no other such failures). [BZ #17748] * include/fenv.h (__fegetround): Declare. Use libm_hidden_proto. * math/fegetround.c (fegetround): Rename to __fegetround and define as weak alias of __fegetround. Use libm_hidden_weak. * sysdeps/aarch64/fpu/fegetround.c (fegetround): Likewise. * sysdeps/alpha/fpu/fegetround.c (fegetround): Likewise. * sysdeps/arm/fegetround.c (fegetround): Likewise. * sysdeps/hppa/fpu/fegetround.c (fegetround): Likewise. * sysdeps/i386/fpu/fegetround.c (fegetround): Likewise. * sysdeps/ia64/fpu/fegetround.c (fegetround): Likewise. * sysdeps/m68k/fpu/fegetround.c (fegetround): Likewise. * sysdeps/mips/fpu/fegetround.c (fegetround): Likewise. * sysdeps/powerpc/fpu/fegetround.c (fegetround): Likewise. Undefine after rather than before function definition; use parentheses around function name in definition. (__fegetround): Also undefine macro after function definition. * sysdeps/powerpc/nofpu/fegetround.c (fegetround): Rename to __fegetround and define as weak alias of __fegetround. Use libm_hidden_weak. Do not undefine as macro. * sysdeps/powerpc/powerpc32/e500/nofpu/fegetround.c (fegetround): Likewise. * sysdeps/s390/fpu/fegetround.c (fegetround): Rename to __fegetround and define as weak alias of __fegetround. Use libm_hidden_weak. * sysdeps/sh/sh4/fpu/fegetround.c (fegetround): Likewise. * sysdeps/sparc/fpu/fegetround.c (fegetround): Likewise. * sysdeps/tile/math_private.h (__fegetround): New inline function. * sysdeps/x86_64/fpu/fegetround.c (fegetround): Rename to __fegetround and define as weak alias of __fegetround. Use libm_hidden_weak. * sysdeps/ieee754/dbl-64/e_sqrt.c (__ieee754_sqrt): Use __fegetround instead of fegetround.
-rw-r--r--ChangeLog33
-rw-r--r--include/fenv.h2
-rw-r--r--math/fegetround.c6
-rw-r--r--sysdeps/aarch64/fpu/fegetround.c6
-rw-r--r--sysdeps/alpha/fpu/fegetround.c6
-rw-r--r--sysdeps/arm/fegetround.c6
-rw-r--r--sysdeps/hppa/fpu/fegetround.c6
-rw-r--r--sysdeps/i386/fpu/fegetround.c6
-rw-r--r--sysdeps/ia64/fpu/fegetround.c6
-rw-r--r--sysdeps/ieee754/dbl-64/e_sqrt.c2
-rw-r--r--sysdeps/m68k/fpu/fegetround.c6
-rw-r--r--sysdeps/mips/fpu/fegetround.c6
-rw-r--r--sysdeps/powerpc/fpu/fegetround.c9
-rw-r--r--sysdeps/powerpc/nofpu/fegetround.c7
-rw-r--r--sysdeps/powerpc/powerpc32/e500/nofpu/fegetround.c7
-rw-r--r--sysdeps/s390/fpu/fegetround.c6
-rw-r--r--sysdeps/sh/sh4/fpu/fegetround.c6
-rw-r--r--sysdeps/sparc/fpu/fegetround.c6
-rw-r--r--sysdeps/tile/math_private.h1
-rw-r--r--sysdeps/x86_64/fpu/fegetround.c6
20 files changed, 103 insertions, 36 deletions
diff --git a/ChangeLog b/ChangeLog
index eb1909d437..1b08fb4a10 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,38 @@
2015-01-02 Joseph Myers <joseph@codesourcery.com>
+ [BZ #17748]
+ * include/fenv.h (__fegetround): Declare. Use libm_hidden_proto.
+ * math/fegetround.c (fegetround): Rename to __fegetround and
+ define as weak alias of __fegetround. Use libm_hidden_weak.
+ * sysdeps/aarch64/fpu/fegetround.c (fegetround): Likewise.
+ * sysdeps/alpha/fpu/fegetround.c (fegetround): Likewise.
+ * sysdeps/arm/fegetround.c (fegetround): Likewise.
+ * sysdeps/hppa/fpu/fegetround.c (fegetround): Likewise.
+ * sysdeps/i386/fpu/fegetround.c (fegetround): Likewise.
+ * sysdeps/ia64/fpu/fegetround.c (fegetround): Likewise.
+ * sysdeps/m68k/fpu/fegetround.c (fegetround): Likewise.
+ * sysdeps/mips/fpu/fegetround.c (fegetround): Likewise.
+ * sysdeps/powerpc/fpu/fegetround.c (fegetround): Likewise.
+ Undefine after rather than before function definition; use
+ parentheses around function name in definition.
+ (__fegetround): Also undefine macro after function definition.
+ * sysdeps/powerpc/nofpu/fegetround.c (fegetround): Rename to
+ __fegetround and define as weak alias of __fegetround. Use
+ libm_hidden_weak. Do not undefine as macro.
+ * sysdeps/powerpc/powerpc32/e500/nofpu/fegetround.c (fegetround):
+ Likewise.
+ * sysdeps/s390/fpu/fegetround.c (fegetround): Rename to
+ __fegetround and define as weak alias of __fegetround. Use
+ libm_hidden_weak.
+ * sysdeps/sh/sh4/fpu/fegetround.c (fegetround): Likewise.
+ * sysdeps/sparc/fpu/fegetround.c (fegetround): Likewise.
+ * sysdeps/tile/math_private.h (__fegetround): New inline function.
+ * sysdeps/x86_64/fpu/fegetround.c (fegetround): Rename to
+ __fegetround and define as weak alias of __fegetround. Use
+ libm_hidden_weak.
+ * sysdeps/ieee754/dbl-64/e_sqrt.c (__ieee754_sqrt): Use
+ __fegetround instead of fegetround.
+
[BZ #17782]
* sysdeps/unix/sysv/linux/mips/bits/termios.h (TIOCSER_TEMT):
Condition macro definition on [__USE_MISC].
diff --git a/include/fenv.h b/include/fenv.h
index bc8f759e17..b29b246089 100644
--- a/include/fenv.h
+++ b/include/fenv.h
@@ -13,12 +13,14 @@ extern int __fesetexceptflag (const fexcept_t *__flagp, int __excepts);
extern int __fegetenv (fenv_t *__envp);
extern int __fesetenv (const fenv_t *__envp);
extern int __feupdateenv (const fenv_t *__envp);
+extern __typeof (fegetround) __fegetround;
libm_hidden_proto (feraiseexcept)
libm_hidden_proto (__feraiseexcept)
libm_hidden_proto (fegetenv)
libm_hidden_proto (__fegetenv)
libm_hidden_proto (fegetround)
+libm_hidden_proto (__fegetround)
libm_hidden_proto (fesetenv)
libm_hidden_proto (fesetround)
libm_hidden_proto (feholdexcept)
diff --git a/math/fegetround.c b/math/fegetround.c
index 665268e359..7c150ec7bc 100644
--- a/math/fegetround.c
+++ b/math/fegetround.c
@@ -20,7 +20,7 @@
#include <fenv.h>
int
-fegetround (void)
+__fegetround (void)
{
#ifdef FE_TONEAREST
return FE_TONEAREST;
@@ -28,5 +28,7 @@ fegetround (void)
return 0;
#endif
}
-libm_hidden_def (fegetround)
+libm_hidden_def (__fegetround)
+weak_alias (__fegetround, fegetround)
+libm_hidden_weak (fegetround)
stub_warning (fegetround)
diff --git a/sysdeps/aarch64/fpu/fegetround.c b/sysdeps/aarch64/fpu/fegetround.c
index 4c81845ba2..5af36f7715 100644
--- a/sysdeps/aarch64/fpu/fegetround.c
+++ b/sysdeps/aarch64/fpu/fegetround.c
@@ -20,8 +20,10 @@
#include <get-rounding-mode.h>
int
-fegetround (void)
+__fegetround (void)
{
return get_rounding_mode ();
}
-libm_hidden_def (fegetround)
+libm_hidden_def (__fegetround)
+weak_alias (__fegetround, fegetround)
+libm_hidden_weak (fegetround)
diff --git a/sysdeps/alpha/fpu/fegetround.c b/sysdeps/alpha/fpu/fegetround.c
index 613110bbe4..d346decd95 100644
--- a/sysdeps/alpha/fpu/fegetround.c
+++ b/sysdeps/alpha/fpu/fegetround.c
@@ -20,7 +20,7 @@
#include <fenv_libc.h>
int
-fegetround (void)
+__fegetround (void)
{
unsigned long fpcr;
@@ -28,4 +28,6 @@ fegetround (void)
return (fpcr >> FPCR_ROUND_SHIFT) & 3;
}
-libm_hidden_def (fegetround)
+libm_hidden_def (__fegetround)
+weak_alias (__fegetround, fegetround)
+libm_hidden_weak (fegetround)
diff --git a/sysdeps/arm/fegetround.c b/sysdeps/arm/fegetround.c
index bd03667665..348c23ee49 100644
--- a/sysdeps/arm/fegetround.c
+++ b/sysdeps/arm/fegetround.c
@@ -20,8 +20,10 @@
int
-fegetround (void)
+__fegetround (void)
{
return get_rounding_mode ();
}
-libm_hidden_def (fegetround)
+libm_hidden_def (__fegetround)
+weak_alias (__fegetround, fegetround)
+libm_hidden_weak (fegetround)
diff --git a/sysdeps/hppa/fpu/fegetround.c b/sysdeps/hppa/fpu/fegetround.c
index fc4cbed39a..aae88b7b1a 100644
--- a/sysdeps/hppa/fpu/fegetround.c
+++ b/sysdeps/hppa/fpu/fegetround.c
@@ -20,8 +20,10 @@
#include <get-rounding-mode.h>
int
-fegetround (void)
+__fegetround (void)
{
return get_rounding_mode ();
}
-libm_hidden_def (fegetround)
+libm_hidden_def (__fegetround)
+weak_alias (__fegetround, fegetround)
+libm_hidden_weak (fegetround)
diff --git a/sysdeps/i386/fpu/fegetround.c b/sysdeps/i386/fpu/fegetround.c
index 1b25c32589..1662e2e66e 100644
--- a/sysdeps/i386/fpu/fegetround.c
+++ b/sysdeps/i386/fpu/fegetround.c
@@ -20,7 +20,7 @@
#include <fenv.h>
int
-fegetround (void)
+__fegetround (void)
{
int cw;
@@ -28,4 +28,6 @@ fegetround (void)
return cw & 0xc00;
}
-libm_hidden_def (fegetround)
+libm_hidden_def (__fegetround)
+weak_alias (__fegetround, fegetround)
+libm_hidden_weak (fegetround)
diff --git a/sysdeps/ia64/fpu/fegetround.c b/sysdeps/ia64/fpu/fegetround.c
index 38f769f735..cf2991194a 100644
--- a/sysdeps/ia64/fpu/fegetround.c
+++ b/sysdeps/ia64/fpu/fegetround.c
@@ -20,8 +20,10 @@
#include <get-rounding-mode.h>
int
-fegetround (void)
+__fegetround (void)
{
return get_rounding_mode ();
}
-libm_hidden_def (fegetround)
+libm_hidden_def (__fegetround)
+weak_alias (__fegetround, fegetround)
+libm_hidden_weak (fegetround)
diff --git a/sysdeps/ieee754/dbl-64/e_sqrt.c b/sysdeps/ieee754/dbl-64/e_sqrt.c
index 3b34e54634..fff6d148fe 100644
--- a/sysdeps/ieee754/dbl-64/e_sqrt.c
+++ b/sysdeps/ieee754/dbl-64/e_sqrt.c
@@ -66,7 +66,7 @@ __ieee754_sqrt (double x)
/*----------------- 2^-1022 <= | x |< 2^1024 -----------------*/
if (k > 0x000fffff && k < 0x7ff00000)
{
- int rm = fegetround ();
+ int rm = __fegetround ();
fenv_t env;
libc_feholdexcept_setround (&env, FE_TONEAREST);
double ret;
diff --git a/sysdeps/m68k/fpu/fegetround.c b/sysdeps/m68k/fpu/fegetround.c
index b0302e1c7b..0777657833 100644
--- a/sysdeps/m68k/fpu/fegetround.c
+++ b/sysdeps/m68k/fpu/fegetround.c
@@ -20,7 +20,7 @@
#include <fenv.h>
int
-fegetround (void)
+__fegetround (void)
{
int fpcr;
@@ -28,4 +28,6 @@ fegetround (void)
return fpcr & FE_UPWARD;
}
-libm_hidden_def (fegetround)
+libm_hidden_def (__fegetround)
+weak_alias (__fegetround, fegetround)
+libm_hidden_weak (fegetround)
diff --git a/sysdeps/mips/fpu/fegetround.c b/sysdeps/mips/fpu/fegetround.c
index 99403cd54b..bfe9130f60 100644
--- a/sysdeps/mips/fpu/fegetround.c
+++ b/sysdeps/mips/fpu/fegetround.c
@@ -21,7 +21,7 @@
#include <fpu_control.h>
int
-fegetround (void)
+__fegetround (void)
{
int cw;
@@ -30,4 +30,6 @@ fegetround (void)
return cw & _FPU_RC_MASK;
}
-libm_hidden_def (fegetround)
+libm_hidden_def (__fegetround)
+weak_alias (__fegetround, fegetround)
+libm_hidden_weak (fegetround)
diff --git a/sysdeps/powerpc/fpu/fegetround.c b/sysdeps/powerpc/fpu/fegetround.c
index a18be8306f..af97f72c6c 100644
--- a/sysdeps/powerpc/fpu/fegetround.c
+++ b/sysdeps/powerpc/fpu/fegetround.c
@@ -18,10 +18,13 @@
#include <fenv_libc.h>
-#undef fegetround
int
-fegetround (void)
+(__fegetround) (void)
{
return __fegetround();
}
-libm_hidden_def (fegetround)
+#undef fegetround
+#undef __fegetround
+libm_hidden_def (__fegetround)
+weak_alias (__fegetround, fegetround)
+libm_hidden_weak (fegetround)
diff --git a/sysdeps/powerpc/nofpu/fegetround.c b/sysdeps/powerpc/nofpu/fegetround.c
index 9de326cc0f..311b2d5749 100644
--- a/sysdeps/powerpc/nofpu/fegetround.c
+++ b/sysdeps/powerpc/nofpu/fegetround.c
@@ -20,10 +20,11 @@
#include "soft-fp.h"
#include "soft-supp.h"
-#undef fegetround
int
-fegetround (void)
+__fegetround (void)
{
return __sim_round_mode_thread;
}
-libm_hidden_def (fegetround)
+libm_hidden_def (__fegetround)
+weak_alias (__fegetround, fegetround)
+libm_hidden_weak (fegetround)
diff --git a/sysdeps/powerpc/powerpc32/e500/nofpu/fegetround.c b/sysdeps/powerpc/powerpc32/e500/nofpu/fegetround.c
index c71a8fc627..bbdeba70b1 100644
--- a/sysdeps/powerpc/powerpc32/e500/nofpu/fegetround.c
+++ b/sysdeps/powerpc/powerpc32/e500/nofpu/fegetround.c
@@ -18,13 +18,14 @@
#include <fenv_libc.h>
-#undef fegetround
int
-fegetround (void)
+__fegetround (void)
{
unsigned long fpescr;
fpescr = fegetenv_register ();
return fpescr & 3;
}
-libm_hidden_def (fegetround)
+libm_hidden_def (__fegetround)
+weak_alias (__fegetround, fegetround)
+libm_hidden_weak (fegetround)
diff --git a/sysdeps/s390/fpu/fegetround.c b/sysdeps/s390/fpu/fegetround.c
index dd4e81ff73..f60821457c 100644
--- a/sysdeps/s390/fpu/fegetround.c
+++ b/sysdeps/s390/fpu/fegetround.c
@@ -21,7 +21,7 @@
#include <fpu_control.h>
int
-fegetround (void)
+__fegetround (void)
{
fexcept_t cw;
@@ -29,4 +29,6 @@ fegetround (void)
return cw & FPC_RM_MASK;
}
-libm_hidden_def (fegetround)
+libm_hidden_def (__fegetround)
+weak_alias (__fegetround, fegetround)
+libm_hidden_weak (fegetround)
diff --git a/sysdeps/sh/sh4/fpu/fegetround.c b/sysdeps/sh/sh4/fpu/fegetround.c
index 639b7c2f7e..f227564846 100644
--- a/sysdeps/sh/sh4/fpu/fegetround.c
+++ b/sysdeps/sh/sh4/fpu/fegetround.c
@@ -21,7 +21,7 @@
#include <fpu_control.h>
int
-fegetround (void)
+__fegetround (void)
{
fpu_control_t cw;
@@ -30,4 +30,6 @@ fegetround (void)
return cw & 0x1;
}
-libm_hidden_def (fegetround)
+libm_hidden_def (__fegetround)
+weak_alias (__fegetround, fegetround)
+libm_hidden_weak (fegetround)
diff --git a/sysdeps/sparc/fpu/fegetround.c b/sysdeps/sparc/fpu/fegetround.c
index 9eba970b67..ebcf21ca35 100644
--- a/sysdeps/sparc/fpu/fegetround.c
+++ b/sysdeps/sparc/fpu/fegetround.c
@@ -19,7 +19,7 @@
#include <fenv.h>
int
-fegetround (void)
+__fegetround (void)
{
fenv_t tmp;
@@ -27,4 +27,6 @@ fegetround (void)
return tmp & __FE_ROUND_MASK;
}
-libm_hidden_def (fegetround)
+libm_hidden_def (__fegetround)
+weak_alias (__fegetround, fegetround)
+libm_hidden_weak (fegetround)
diff --git a/sysdeps/tile/math_private.h b/sysdeps/tile/math_private.h
index 70e4fb2060..6b9e7618dd 100644
--- a/sysdeps/tile/math_private.h
+++ b/sysdeps/tile/math_private.h
@@ -34,6 +34,7 @@ extern inline int __fegetenv (fenv_t *__e) { return 0; }
extern inline int fesetenv (const fenv_t *__e) { return 0; }
extern inline int feupdateenv (const fenv_t *__e) { return 0; }
extern inline int fegetround (void) { return FE_TONEAREST; }
+extern inline int __fegetround (void) { return FE_TONEAREST; }
extern inline int fesetround (int __d) { return 0; }
#endif
diff --git a/sysdeps/x86_64/fpu/fegetround.c b/sysdeps/x86_64/fpu/fegetround.c
index 4796e80db2..b515d8afe7 100644
--- a/sysdeps/x86_64/fpu/fegetround.c
+++ b/sysdeps/x86_64/fpu/fegetround.c
@@ -20,7 +20,7 @@
#include <fenv.h>
int
-fegetround (void)
+__fegetround (void)
{
int cw;
/* We only check the x87 FPU unit. The SSE unit should be the same
@@ -30,4 +30,6 @@ fegetround (void)
return cw & 0xc00;
}
-libm_hidden_def (fegetround)
+libm_hidden_def (__fegetround)
+weak_alias (__fegetround, fegetround)
+libm_hidden_weak (fegetround)