aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2014-12-31 22:07:52 +0000
committerJoseph Myers <joseph@codesourcery.com>2014-12-31 22:07:52 +0000
commit73a268c75996b92e4a5e72bf9fdf6adc20390614 (patch)
treef3b158beef9b1494dfd26e2e7113218c74161d01
parent0bd956720c457ff054325b48f26ac7c91cb060e8 (diff)
downloadglibc-73a268c75996b92e4a5e72bf9fdf6adc20390614.zip
glibc-73a268c75996b92e4a5e72bf9fdf6adc20390614.tar.gz
glibc-73a268c75996b92e4a5e72bf9fdf6adc20390614.tar.bz2
Fix libm fegetenv namespace (bug 17748).
Some C90 libm functions call fegetenv via libc_feholdsetround* functions in math_private.h. This patch makes them call __fegetenv instead, making fegetenv into a weak alias for __fegetenv as needed. Tested for x86_64 (testsuite, and that disassembly of installed shared libraries is unchanged by the patch). Also tested for ARM (soft-float) that fegetenv failures disappear from the linknamespace test failures (however, similar fixes will also be needed for fegetround, feholdexcept, fesetenv, fesetround and feupdateenv before this set of namespace issues covered by bug 17748 is fully fixed and those linknamespace tests start passing). [BZ #17748] * include/fenv.h (__fegetenv): Use libm_hidden_proto. * math/fegetenv.c (__fegetenv): Use libm_hidden_def. * sysdeps/aarch64/fpu/fegetenv.c (fegetenv): Rename to __fegetenv and define as weak alias of __fegetenv. Use libm_hidden_weak. * sysdeps/alpha/fpu/fegetenv.c (__fegetenv): Use libm_hidden_def. * sysdeps/arm/fegetenv.c (fegetenv): Rename to __fegetenv and define as weak alias of __fegetenv. Use libm_hidden_weak. * sysdeps/hppa/fpu/fegetenv.c (fegetenv): Likewise. * sysdeps/i386/fpu/fegetenv.c (__fegetenv): Use libm_hidden_def. * sysdeps/ia64/fpu/fegetenv.c (fegetenv): Rename to __fegetenv and define as weak alias of __fegetenv. Use libm_hidden_weak. * sysdeps/m68k/fpu/fegetenv.c (__fegetenv): Use libm_hidden_def. * sysdeps/mips/fpu/fegetenv.c (fegetenv): Rename to __fegetenv and define as weak alias of __fegetenv. Use libm_hidden_weak. * sysdeps/powerpc/fpu/fegetenv.c (__fegetenv): Use libm_hidden_def. * sysdeps/powerpc/nofpu/fegetenv.c (__fegetenv): Likewise. * sysdeps/powerpc/powerpc32/e500/nofpu/fegetenv.c (__fegetenv): Likewise. * sysdeps/s390/fpu/fegetenv.c (fegetenv): Rename to __fegetenv and define as weak alias of __fegetenv. Use libm_hidden_weak. * sysdeps/sh/sh4/fpu/fegetenv.c (fegetenv): Likewise. * sysdeps/sparc/fpu/fegetenv.c (__fegetenv): Use libm_hidden_def. * sysdeps/tile/math_private.h (__fegetenv): New inline function. * sysdeps/x86_64/fpu/fegetenv.c (fegetenv): Rename to __fegetenv and define as weak alias of __fegetenv. Use libm_hidden_weak. * sysdeps/generic/math_private.h (libc_feholdsetround_ctx): Use __fegetenv instead of fegetenv. (libc_feholdsetround_noex_ctx): Likewise.
-rw-r--r--ChangeLog33
-rw-r--r--include/fenv.h1
-rw-r--r--math/fegetenv.c1
-rw-r--r--sysdeps/aarch64/fpu/fegetenv.c6
-rw-r--r--sysdeps/alpha/fpu/fegetenv.c1
-rw-r--r--sysdeps/arm/fegetenv.c6
-rw-r--r--sysdeps/generic/math_private.h4
-rw-r--r--sysdeps/hppa/fpu/fegetenv.c6
-rw-r--r--sysdeps/i386/fpu/fegetenv.c1
-rw-r--r--sysdeps/ia64/fpu/fegetenv.c6
-rw-r--r--sysdeps/m68k/fpu/fegetenv.c1
-rw-r--r--sysdeps/mips/fpu/fegetenv.c6
-rw-r--r--sysdeps/powerpc/fpu/fegetenv.c1
-rw-r--r--sysdeps/powerpc/nofpu/fegetenv.c1
-rw-r--r--sysdeps/powerpc/powerpc32/e500/nofpu/fegetenv.c1
-rw-r--r--sysdeps/s390/fpu/fegetenv.c6
-rw-r--r--sysdeps/sh/sh4/fpu/fegetenv.c6
-rw-r--r--sysdeps/sparc/fpu/fegetenv.c1
-rw-r--r--sysdeps/tile/math_private.h1
-rw-r--r--sysdeps/x86_64/fpu/fegetenv.c6
20 files changed, 77 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index d9d6790..fc7a34e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,36 @@
+2014-12-31 Joseph Myers <joseph@codesourcery.com>
+
+ [BZ #17748]
+ * include/fenv.h (__fegetenv): Use libm_hidden_proto.
+ * math/fegetenv.c (__fegetenv): Use libm_hidden_def.
+ * sysdeps/aarch64/fpu/fegetenv.c (fegetenv): Rename to __fegetenv
+ and define as weak alias of __fegetenv. Use libm_hidden_weak.
+ * sysdeps/alpha/fpu/fegetenv.c (__fegetenv): Use libm_hidden_def.
+ * sysdeps/arm/fegetenv.c (fegetenv): Rename to __fegetenv and
+ define as weak alias of __fegetenv. Use libm_hidden_weak.
+ * sysdeps/hppa/fpu/fegetenv.c (fegetenv): Likewise.
+ * sysdeps/i386/fpu/fegetenv.c (__fegetenv): Use libm_hidden_def.
+ * sysdeps/ia64/fpu/fegetenv.c (fegetenv): Rename to __fegetenv and
+ define as weak alias of __fegetenv. Use libm_hidden_weak.
+ * sysdeps/m68k/fpu/fegetenv.c (__fegetenv): Use libm_hidden_def.
+ * sysdeps/mips/fpu/fegetenv.c (fegetenv): Rename to __fegetenv and
+ define as weak alias of __fegetenv. Use libm_hidden_weak.
+ * sysdeps/powerpc/fpu/fegetenv.c (__fegetenv): Use
+ libm_hidden_def.
+ * sysdeps/powerpc/nofpu/fegetenv.c (__fegetenv): Likewise.
+ * sysdeps/powerpc/powerpc32/e500/nofpu/fegetenv.c (__fegetenv):
+ Likewise.
+ * sysdeps/s390/fpu/fegetenv.c (fegetenv): Rename to __fegetenv and
+ define as weak alias of __fegetenv. Use libm_hidden_weak.
+ * sysdeps/sh/sh4/fpu/fegetenv.c (fegetenv): Likewise.
+ * sysdeps/sparc/fpu/fegetenv.c (__fegetenv): Use libm_hidden_def.
+ * sysdeps/tile/math_private.h (__fegetenv): New inline function.
+ * sysdeps/x86_64/fpu/fegetenv.c (fegetenv): Rename to __fegetenv
+ and define as weak alias of __fegetenv. Use libm_hidden_weak.
+ * sysdeps/generic/math_private.h (libc_feholdsetround_ctx): Use
+ __fegetenv instead of fegetenv.
+ (libc_feholdsetround_noex_ctx): Likewise.
+
2014-12-31 Matthew Fortune <matthew.fortune@imgtec.com>
* elf/elf.h (PT_MIPS_ABIFLAGS): Define.
diff --git a/include/fenv.h b/include/fenv.h
index 0cfbacd..bc8f759 100644
--- a/include/fenv.h
+++ b/include/fenv.h
@@ -17,6 +17,7 @@ extern int __feupdateenv (const fenv_t *__envp);
libm_hidden_proto (feraiseexcept)
libm_hidden_proto (__feraiseexcept)
libm_hidden_proto (fegetenv)
+libm_hidden_proto (__fegetenv)
libm_hidden_proto (fegetround)
libm_hidden_proto (fesetenv)
libm_hidden_proto (fesetround)
diff --git a/math/fegetenv.c b/math/fegetenv.c
index c031488..39b843b 100644
--- a/math/fegetenv.c
+++ b/math/fegetenv.c
@@ -30,6 +30,7 @@ __fegetenv (fenv_t *envp)
strong_alias (__fegetenv, __old_fegetenv)
compat_symbol (libm, __old_fegetenv, fegetenv, GLIBC_2_1);
#endif
+libm_hidden_def (__fegetenv)
libm_hidden_ver (__fegetenv, fegetenv)
versioned_symbol (libm, __fegetenv, fegetenv, GLIBC_2_2);
diff --git a/sysdeps/aarch64/fpu/fegetenv.c b/sysdeps/aarch64/fpu/fegetenv.c
index 4c88fbf..ae75f39 100644
--- a/sysdeps/aarch64/fpu/fegetenv.c
+++ b/sysdeps/aarch64/fpu/fegetenv.c
@@ -20,7 +20,7 @@
#include <fpu_control.h>
int
-fegetenv (fenv_t *envp)
+__fegetenv (fenv_t *envp)
{
fpu_control_t fpcr;
fpu_fpsr_t fpsr;
@@ -30,4 +30,6 @@ fegetenv (fenv_t *envp)
envp->__fpsr = fpsr;
return 0;
}
-libm_hidden_def (fegetenv)
+libm_hidden_def (__fegetenv)
+weak_alias (__fegetenv, fegetenv)
+libm_hidden_weak (fegetenv)
diff --git a/sysdeps/alpha/fpu/fegetenv.c b/sysdeps/alpha/fpu/fegetenv.c
index ef688f2..36baf41 100644
--- a/sysdeps/alpha/fpu/fegetenv.c
+++ b/sysdeps/alpha/fpu/fegetenv.c
@@ -43,5 +43,6 @@ strong_alias (__fegetenv, __old_fegetenv)
compat_symbol (libm, __old_fegetenv, fegetenv, GLIBC_2_1);
#endif
+libm_hidden_def (__fegetenv)
versioned_symbol (libm, __fegetenv, fegetenv, GLIBC_2_2);
libm_hidden_ver(__fegetenv, fegetenv)
diff --git a/sysdeps/arm/fegetenv.c b/sysdeps/arm/fegetenv.c
index f390c0f..ec38a51 100644
--- a/sysdeps/arm/fegetenv.c
+++ b/sysdeps/arm/fegetenv.c
@@ -22,7 +22,7 @@
int
-fegetenv (fenv_t *envp)
+__fegetenv (fenv_t *envp)
{
fpu_control_t fpscr;
@@ -34,4 +34,6 @@ fegetenv (fenv_t *envp)
envp->__cw = fpscr;
return 0;
}
-libm_hidden_def (fegetenv)
+libm_hidden_def (__fegetenv)
+weak_alias (__fegetenv, fegetenv)
+libm_hidden_weak (fegetenv)
diff --git a/sysdeps/generic/math_private.h b/sysdeps/generic/math_private.h
index 94c1e4a..2b07f20 100644
--- a/sysdeps/generic/math_private.h
+++ b/sysdeps/generic/math_private.h
@@ -598,7 +598,7 @@ libc_feholdsetround_ctx (struct rm_ctx *ctx, int round)
if (__glibc_unlikely (round != get_rounding_mode ()))
{
ctx->updated_status = true;
- fegetenv (&ctx->env);
+ __fegetenv (&ctx->env);
fesetround (round);
}
}
@@ -615,7 +615,7 @@ static __always_inline void
libc_feholdsetround_noex_ctx (struct rm_ctx *ctx, int round)
{
/* Save exception flags and rounding mode. */
- fegetenv (&ctx->env);
+ __fegetenv (&ctx->env);
/* Update rounding mode only if different. */
if (__glibc_unlikely (round != get_rounding_mode ()))
diff --git a/sysdeps/hppa/fpu/fegetenv.c b/sysdeps/hppa/fpu/fegetenv.c
index 7028fe4..ee7fa16 100644
--- a/sysdeps/hppa/fpu/fegetenv.c
+++ b/sysdeps/hppa/fpu/fegetenv.c
@@ -21,7 +21,7 @@
#include <string.h>
int
-fegetenv (fenv_t *envp)
+__fegetenv (fenv_t *envp)
{
unsigned long long buf[4], *bufptr = buf;
@@ -32,4 +32,6 @@ fegetenv (fenv_t *envp)
memcpy(envp, buf, sizeof (*envp));
return 0;
}
-libm_hidden_def (fegetenv)
+libm_hidden_def (__fegetenv)
+weak_alias (__fegetenv, fegetenv)
+libm_hidden_weak (fegetenv)
diff --git a/sysdeps/i386/fpu/fegetenv.c b/sysdeps/i386/fpu/fegetenv.c
index 8c45b6b..b578703 100644
--- a/sysdeps/i386/fpu/fegetenv.c
+++ b/sysdeps/i386/fpu/fegetenv.c
@@ -44,5 +44,6 @@ strong_alias (__fegetenv, __old_fegetenv)
compat_symbol (libm, __old_fegetenv, fegetenv, GLIBC_2_1);
#endif
+libm_hidden_def (__fegetenv)
libm_hidden_ver (__fegetenv, fegetenv)
versioned_symbol (libm, __fegetenv, fegetenv, GLIBC_2_2);
diff --git a/sysdeps/ia64/fpu/fegetenv.c b/sysdeps/ia64/fpu/fegetenv.c
index d337dda..8d46e23 100644
--- a/sysdeps/ia64/fpu/fegetenv.c
+++ b/sysdeps/ia64/fpu/fegetenv.c
@@ -20,10 +20,12 @@
#include <fenv.h>
int
-fegetenv (fenv_t *envp)
+__fegetenv (fenv_t *envp)
{
__asm__ __volatile__ ("mov.m %0=ar.fpsr" : "=r" (*envp));
return 0;
}
-libm_hidden_def (fegetenv)
+libm_hidden_def (__fegetenv)
+weak_alias (__fegetenv, fegetenv)
+libm_hidden_weak (fegetenv)
diff --git a/sysdeps/m68k/fpu/fegetenv.c b/sysdeps/m68k/fpu/fegetenv.c
index 7feac64..c31a5f5 100644
--- a/sysdeps/m68k/fpu/fegetenv.c
+++ b/sysdeps/m68k/fpu/fegetenv.c
@@ -40,5 +40,6 @@ strong_alias (__fegetenv, __old_fegetenv)
compat_symbol (libm, __old_fegetenv, fegetenv, GLIBC_2_1);
#endif
+libm_hidden_def (__fegetenv)
libm_hidden_ver (__fegetenv, fegetenv)
versioned_symbol (libm, __fegetenv, fegetenv, GLIBC_2_2);
diff --git a/sysdeps/mips/fpu/fegetenv.c b/sysdeps/mips/fpu/fegetenv.c
index b87d35f..d52c9de 100644
--- a/sysdeps/mips/fpu/fegetenv.c
+++ b/sysdeps/mips/fpu/fegetenv.c
@@ -21,11 +21,13 @@
#include <fpu_control.h>
int
-fegetenv (fenv_t *envp)
+__fegetenv (fenv_t *envp)
{
_FPU_GETCW (*envp);
/* Success. */
return 0;
}
-libm_hidden_def (fegetenv)
+libm_hidden_def (__fegetenv)
+weak_alias (__fegetenv, fegetenv)
+libm_hidden_weak (fegetenv)
diff --git a/sysdeps/powerpc/fpu/fegetenv.c b/sysdeps/powerpc/fpu/fegetenv.c
index 3e552bc..69c48de 100644
--- a/sysdeps/powerpc/fpu/fegetenv.c
+++ b/sysdeps/powerpc/fpu/fegetenv.c
@@ -33,5 +33,6 @@ strong_alias (__fegetenv, __old_fegetenv)
compat_symbol (libm, __old_fegetenv, fegetenv, GLIBC_2_1);
#endif
+libm_hidden_def (__fegetenv)
libm_hidden_ver (__fegetenv, fegetenv)
versioned_symbol (libm, __fegetenv, fegetenv, GLIBC_2_2);
diff --git a/sysdeps/powerpc/nofpu/fegetenv.c b/sysdeps/powerpc/nofpu/fegetenv.c
index 8501a05..032778a 100644
--- a/sysdeps/powerpc/nofpu/fegetenv.c
+++ b/sysdeps/powerpc/nofpu/fegetenv.c
@@ -40,5 +40,6 @@ strong_alias (__fegetenv, __old_fegetenv)
compat_symbol (libm, __old_fegetenv, fegetenv, GLIBC_2_1);
#endif
+libm_hidden_def (__fegetenv)
libm_hidden_ver (__fegetenv, fegetenv)
versioned_symbol (libm, __fegetenv, fegetenv, GLIBC_2_2);
diff --git a/sysdeps/powerpc/powerpc32/e500/nofpu/fegetenv.c b/sysdeps/powerpc/powerpc32/e500/nofpu/fegetenv.c
index 5faabe8..67b0e54 100644
--- a/sysdeps/powerpc/powerpc32/e500/nofpu/fegetenv.c
+++ b/sysdeps/powerpc/powerpc32/e500/nofpu/fegetenv.c
@@ -43,6 +43,7 @@ __fegetenv (fenv_t *envp)
strong_alias (__fegetenv, __old_fegetenv)
compat_symbol (libm, __old_fegetenv, fegetenv, GLIBC_2_1);
#endif
+libm_hidden_def (__fegetenv)
libm_hidden_ver (__fegetenv, fegetenv)
versioned_symbol (libm, __fegetenv, fegetenv, GLIBC_2_2);
diff --git a/sysdeps/s390/fpu/fegetenv.c b/sysdeps/s390/fpu/fegetenv.c
index 7e68ceb..cfbc5ce 100644
--- a/sysdeps/s390/fpu/fegetenv.c
+++ b/sysdeps/s390/fpu/fegetenv.c
@@ -21,11 +21,13 @@
#include <fpu_control.h>
int
-fegetenv (fenv_t *envp)
+__fegetenv (fenv_t *envp)
{
_FPU_GETCW (envp->__fpc);
/* Success. */
return 0;
}
-libm_hidden_def (fegetenv)
+libm_hidden_def (__fegetenv)
+weak_alias (__fegetenv, fegetenv)
+libm_hidden_weak (fegetenv)
diff --git a/sysdeps/sh/sh4/fpu/fegetenv.c b/sysdeps/sh/sh4/fpu/fegetenv.c
index 2dc2696..c97cfbd 100644
--- a/sysdeps/sh/sh4/fpu/fegetenv.c
+++ b/sysdeps/sh/sh4/fpu/fegetenv.c
@@ -20,7 +20,7 @@
#include <fpu_control.h>
int
-fegetenv (fenv_t *envp)
+__fegetenv (fenv_t *envp)
{
fpu_control_t temp;
_FPU_GETCW (temp);
@@ -29,4 +29,6 @@ fegetenv (fenv_t *envp)
return 0;
}
-libm_hidden_def (fegetenv)
+libm_hidden_def (__fegetenv)
+weak_alias (__fegetenv, fegetenv)
+libm_hidden_weak (fegetenv)
diff --git a/sysdeps/sparc/fpu/fegetenv.c b/sysdeps/sparc/fpu/fegetenv.c
index 55600d5..b987359 100644
--- a/sysdeps/sparc/fpu/fegetenv.c
+++ b/sysdeps/sparc/fpu/fegetenv.c
@@ -33,5 +33,6 @@ strong_alias (__fegetenv, __old_fegetenv)
compat_symbol (libm, __old_fegetenv, fegetenv, GLIBC_2_1);
#endif
+libm_hidden_def (__fegetenv)
libm_hidden_ver (__fegetenv, fegetenv)
versioned_symbol (libm, __fegetenv, fegetenv, GLIBC_2_2);
diff --git a/sysdeps/tile/math_private.h b/sysdeps/tile/math_private.h
index 035a83f..70e4fb2 100644
--- a/sysdeps/tile/math_private.h
+++ b/sysdeps/tile/math_private.h
@@ -30,6 +30,7 @@
#define feclearexcept(exc) ({ 0; })
#define fetestexcept(exc) ({ 0; })
extern inline int fegetenv (fenv_t *__e) { return 0; }
+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; }
diff --git a/sysdeps/x86_64/fpu/fegetenv.c b/sysdeps/x86_64/fpu/fegetenv.c
index 0e0c269..d150e8f 100644
--- a/sysdeps/x86_64/fpu/fegetenv.c
+++ b/sysdeps/x86_64/fpu/fegetenv.c
@@ -19,7 +19,7 @@
#include <fenv.h>
int
-fegetenv (fenv_t *envp)
+__fegetenv (fenv_t *envp)
{
__asm__ ("fnstenv %0\n"
/* fnstenv changes the exception mask, so load back the
@@ -30,4 +30,6 @@ fegetenv (fenv_t *envp)
/* Success. */
return 0;
}
-libm_hidden_def (fegetenv)
+libm_hidden_def (__fegetenv)
+weak_alias (__fegetenv, fegetenv)
+libm_hidden_weak (fegetenv)