mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-21 12:30:06 +00:00
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.
This commit is contained in:
parent
0bd956720c
commit
73a268c759
33
ChangeLog
33
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.
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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 ()))
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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; }
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user