diff options
author | Joseph Myers <joseph@codesourcery.com> | 2015-01-06 23:36:20 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2015-01-06 23:36:20 +0000 |
commit | cd42798aef204592b0165bcfacef975ff3ce2973 (patch) | |
tree | 24fe686b4bdc0d9fa774d4dea971a33c37b476f5 /sysdeps | |
parent | 500bfbd4922902ea278adab06e58b77eb355ba82 (diff) | |
download | glibc-cd42798aef204592b0165bcfacef975ff3ce2973.tar.gz glibc-cd42798aef204592b0165bcfacef975ff3ce2973.tar.xz glibc-cd42798aef204592b0165bcfacef975ff3ce2973.zip |
Fix libm fesetenv namespace (bug 17748).
Continuing the fixes for C90 libm functions calling C99 fe* functions, this patch fixes the case of fesetenv by making it a weak alias of __fesetenv and making the affected code (including various copies of feupdateenv which also gets called from C90 functions) call __fesetenv. Tested for x86_64 (testsuite, and that disassembly of installed shared libraries is unchanged by the patch). Also tested for ARM (soft-float) that fesetenv failures disappear from the linknamespace test results (fsetround and feupdateenv remain to be addressed to complete fixing bug 17748). [BZ #17748] * include/fenv.h (__fesetenv): Use libm_hidden_proto. * math/fesetenv.c (__fesetenv): Use libm_hidden_def. * sysdeps/aarch64/fpu/fesetenv.c (fesetenv): Rename to __fesetenv and define as weak alias of __fesetenv. Use libm_hidden_weak. * sysdeps/alpha/fpu/fesetenv.c (__fesetenv): Use libm_hidden_def. * sysdeps/arm/fesetenv.c (fesetenv): Rename to __fesetenv and define as weak alias of __fesetenv. Use libm_hidden_weak. * sysdeps/hppa/fpu/fesetenv.c (fesetenv): Likewise. * sysdeps/i386/fpu/fesetenv.c (__fesetenv): Use libm_hidden_def. * sysdeps/ia64/fpu/fesetenv.c (fesetenv): Rename to __fesetenv and define as weak alias of __fesetenv. Use libm_hidden_weak. * sysdeps/m68k/fpu/fesetenv.c (__fesetenv): Use libm_hidden_def. * sysdeps/mips/fpu/fesetenv.c (fesetenv): Rename to __fesetenv and define as weak alias of __fesetenv. Use libm_hidden_weak. * sysdeps/powerpc/fpu/fesetenv.c (__fesetenv): Use libm_hidden_def. * sysdeps/powerpc/nofpu/fesetenv.c (__fesetenv): Likewise. * sysdeps/powerpc/powerpc32/e500/nofpu/fesetenv.c (__fesetenv): Likewise. * sysdeps/s390/fpu/fesetenv.c (fesetenv): Rename to __fesetenv and define as weak alias of __fesetenv. Use libm_hidden_weak. * sysdeps/sh/sh4/fpu/fesetenv.c (fesetenv): Likewise. * sysdeps/sparc/fpu/fesetenv.c (__fesetenv): Use libm_hidden_def. * sysdeps/tile/math_private.h (__fesetenv): New inline function. * sysdeps/x86_64/fpu/fesetenv.c (fesetenv): Rename to __fesetenv and define as weak alias of __fesetenv. Use libm_hidden_weak. * sysdeps/generic/math_private.h (default_libc_fesetenv): Use __fesetenv instead of fesetenv. (libc_feresetround_noex_ctx): Likewise. * sysdeps/alpha/fpu/feupdateenv.c (__feupdateenv): Likewise. * sysdeps/hppa/fpu/feupdateenv.c (feupdateenv): Likewise. * sysdeps/i386/fpu/feupdateenv.c (__feupdateenv): Likewise. * sysdeps/ia64/fpu/feupdateenv.c (feupdateenv): Likewise. * sysdeps/m68k/fpu/feupdateenv.c (__feupdateenv): Likewise. * sysdeps/mips/fpu/feupdateenv.c (feupdateenv): Likewise. * sysdeps/powerpc/nofpu/feupdateenv.c (__feupdateenv): Likewise. * sysdeps/powerpc/powerpc32/e500/nofpu/feupdateenv.c (__feupdateenv): Likewise. * sysdeps/s390/fpu/feupdateenv.c (feupdateenv): Likewise. * sysdeps/sh/sh4/fpu/feupdateenv.c (feupdateenv): Likewise. * sysdeps/sparc/fpu/feupdateenv.c (__feupdateenv): Likewise. * sysdeps/x86_64/fpu/feupdateenv.c (__feupdateenv): Likewise.
Diffstat (limited to 'sysdeps')
29 files changed, 54 insertions, 30 deletions
diff --git a/sysdeps/aarch64/fpu/fesetenv.c b/sysdeps/aarch64/fpu/fesetenv.c index fef5f84185..f47115fd91 100644 --- a/sysdeps/aarch64/fpu/fesetenv.c +++ b/sysdeps/aarch64/fpu/fesetenv.c @@ -20,7 +20,7 @@ #include <fpu_control.h> int -fesetenv (const fenv_t *envp) +__fesetenv (const fenv_t *envp) { fpu_control_t fpcr; fpu_control_t fpcr_new; @@ -67,4 +67,6 @@ fesetenv (const fenv_t *envp) return 0; } -libm_hidden_def (fesetenv) +libm_hidden_def (__fesetenv) +weak_alias (__fesetenv, fesetenv) +libm_hidden_weak (fesetenv) diff --git a/sysdeps/alpha/fpu/fesetenv.c b/sysdeps/alpha/fpu/fesetenv.c index 02b79d58bd..c87a23c99e 100644 --- a/sysdeps/alpha/fpu/fesetenv.c +++ b/sysdeps/alpha/fpu/fesetenv.c @@ -52,5 +52,6 @@ strong_alias (__fesetenv, __old_fesetenv) compat_symbol (libm, __old_fesetenv, fesetenv, GLIBC_2_1); #endif +libm_hidden_def (__fesetenv) libm_hidden_ver (__fesetenv, fesetenv) versioned_symbol (libm, __fesetenv, fesetenv, GLIBC_2_2); diff --git a/sysdeps/alpha/fpu/feupdateenv.c b/sysdeps/alpha/fpu/feupdateenv.c index 063785b6e4..8b521454de 100644 --- a/sysdeps/alpha/fpu/feupdateenv.c +++ b/sysdeps/alpha/fpu/feupdateenv.c @@ -28,7 +28,7 @@ __feupdateenv (const fenv_t *envp) tmp = __ieee_get_fp_control (); /* Install new environment. */ - fesetenv (envp); + __fesetenv (envp); /* Raise the saved exception. Incidently for us the implementation defined format of the values in objects of type fexcept_t is the diff --git a/sysdeps/arm/fesetenv.c b/sysdeps/arm/fesetenv.c index 3b79ea18ef..fc24e2f1f1 100644 --- a/sysdeps/arm/fesetenv.c +++ b/sysdeps/arm/fesetenv.c @@ -22,7 +22,7 @@ int -fesetenv (const fenv_t *envp) +__fesetenv (const fenv_t *envp) { fpu_control_t fpscr, new_fpscr, updated_fpscr; @@ -61,4 +61,6 @@ fesetenv (const fenv_t *envp) return 0; } -libm_hidden_def (fesetenv) +libm_hidden_def (__fesetenv) +weak_alias (__fesetenv, fesetenv) +libm_hidden_weak (fesetenv) diff --git a/sysdeps/generic/math_private.h b/sysdeps/generic/math_private.h index 3a080d8721..3d987383e9 100644 --- a/sysdeps/generic/math_private.h +++ b/sysdeps/generic/math_private.h @@ -462,7 +462,7 @@ default_libc_feholdexcept_setround (fenv_t *e, int r) static __always_inline void default_libc_fesetenv (fenv_t *e) { - (void) fesetenv (e); + (void) __fesetenv (e); } #ifndef libc_fesetenv @@ -626,7 +626,7 @@ static __always_inline void libc_feresetround_noex_ctx (struct rm_ctx *ctx) { /* Restore exception flags and rounding mode. */ - fesetenv (&ctx->env); + __fesetenv (&ctx->env); } # define libc_feholdsetroundf_ctx libc_feholdsetround_ctx diff --git a/sysdeps/hppa/fpu/fesetenv.c b/sysdeps/hppa/fpu/fesetenv.c index 2d28446e12..5b33ad6102 100644 --- a/sysdeps/hppa/fpu/fesetenv.c +++ b/sysdeps/hppa/fpu/fesetenv.c @@ -22,7 +22,7 @@ #include <fenv.h> int -fesetenv (const fenv_t *envp) +__fesetenv (const fenv_t *envp) { union { unsigned long long buf[4]; fenv_t env; } temp; unsigned long long *bufptr; @@ -60,4 +60,6 @@ fesetenv (const fenv_t *envp) /* Success. */ return 0; } -libm_hidden_def (fesetenv) +libm_hidden_def (__fesetenv) +weak_alias (__fesetenv, fesetenv) +libm_hidden_weak (fesetenv) diff --git a/sysdeps/hppa/fpu/feupdateenv.c b/sysdeps/hppa/fpu/feupdateenv.c index 60c0f11611..e6a07c31f4 100644 --- a/sysdeps/hppa/fpu/feupdateenv.c +++ b/sysdeps/hppa/fpu/feupdateenv.c @@ -33,7 +33,7 @@ feupdateenv (const fenv_t *envp) /* Currently raised exceptions not cleared */ temp.__status_word |= s.sw[0] & (FE_ALL_EXCEPT << 27); /* Install new environment. */ - fesetenv (&temp); + __fesetenv (&temp); /* Success. */ return 0; } diff --git a/sysdeps/i386/fpu/fesetenv.c b/sysdeps/i386/fpu/fesetenv.c index d692a9378f..9566e092ca 100644 --- a/sysdeps/i386/fpu/fesetenv.c +++ b/sysdeps/i386/fpu/fesetenv.c @@ -102,5 +102,6 @@ strong_alias (__fesetenv, __old_fesetenv) compat_symbol (libm, __old_fesetenv, fesetenv, GLIBC_2_1); #endif +libm_hidden_def (__fesetenv) libm_hidden_ver (__fesetenv, fesetenv) versioned_symbol (libm, __fesetenv, fesetenv, GLIBC_2_2); diff --git a/sysdeps/i386/fpu/feupdateenv.c b/sysdeps/i386/fpu/feupdateenv.c index c96708bc02..2f58ab39ff 100644 --- a/sysdeps/i386/fpu/feupdateenv.c +++ b/sysdeps/i386/fpu/feupdateenv.c @@ -38,7 +38,7 @@ __feupdateenv (const fenv_t *envp) temp = (temp | xtemp) & FE_ALL_EXCEPT; /* Install new environment. */ - fesetenv (envp); + __fesetenv (envp); /* Raise the saved exception. Incidently for us the implementation defined format of the values in objects of type fexcept_t is the diff --git a/sysdeps/ia64/fpu/fesetenv.c b/sysdeps/ia64/fpu/fesetenv.c index f35f62c000..62152f5bd7 100644 --- a/sysdeps/ia64/fpu/fesetenv.c +++ b/sysdeps/ia64/fpu/fesetenv.c @@ -20,7 +20,7 @@ #include <fenv.h> int -fesetenv (const fenv_t *envp) +__fesetenv (const fenv_t *envp) { fenv_t env; @@ -38,4 +38,6 @@ fesetenv (const fenv_t *envp) return 0; } -libm_hidden_def (fesetenv) +libm_hidden_def (__fesetenv) +weak_alias (__fesetenv, fesetenv) +libm_hidden_weak (fesetenv) diff --git a/sysdeps/ia64/fpu/feupdateenv.c b/sysdeps/ia64/fpu/feupdateenv.c index 3047f91dca..c6415ed38b 100644 --- a/sysdeps/ia64/fpu/feupdateenv.c +++ b/sysdeps/ia64/fpu/feupdateenv.c @@ -29,7 +29,7 @@ feupdateenv (const fenv_t *envp) __asm__ __volatile__ ("mov.m %0=ar.fpsr" : "=r" (fpsr)); /* Install new environment. */ - fesetenv (envp); + __fesetenv (envp); /* Raise the saved exceptions. */ __feraiseexcept ((int) (fpsr >> 13) & FE_ALL_EXCEPT); diff --git a/sysdeps/m68k/fpu/fesetenv.c b/sysdeps/m68k/fpu/fesetenv.c index dd642428db..5351ae99b5 100644 --- a/sysdeps/m68k/fpu/fesetenv.c +++ b/sysdeps/m68k/fpu/fesetenv.c @@ -70,5 +70,6 @@ strong_alias (__fesetenv, __old_fesetenv) compat_symbol (libm, __old_fesetenv, fesetenv, GLIBC_2_1); #endif +libm_hidden_def (__fesetenv) libm_hidden_ver (__fesetenv, fesetenv) versioned_symbol (libm, __fesetenv, fesetenv, GLIBC_2_2); diff --git a/sysdeps/m68k/fpu/feupdateenv.c b/sysdeps/m68k/fpu/feupdateenv.c index 5d733cb692..80bd59322e 100644 --- a/sysdeps/m68k/fpu/feupdateenv.c +++ b/sysdeps/m68k/fpu/feupdateenv.c @@ -29,7 +29,7 @@ __feupdateenv (const fenv_t *envp) fpsr &= FE_ALL_EXCEPT; /* Install new environment. */ - fesetenv (envp); + __fesetenv (envp); /* Raise the saved exception. Incidently for us the implementation defined format of the values in objects of type fexcept_t is the diff --git a/sysdeps/mips/fpu/fesetenv.c b/sysdeps/mips/fpu/fesetenv.c index 1470e9ce40..e1629aa1e9 100644 --- a/sysdeps/mips/fpu/fesetenv.c +++ b/sysdeps/mips/fpu/fesetenv.c @@ -21,7 +21,7 @@ #include <fpu_control.h> int -fesetenv (const fenv_t *envp) +__fesetenv (const fenv_t *envp) { fpu_control_t cw; @@ -39,4 +39,6 @@ fesetenv (const fenv_t *envp) return 0; } -libm_hidden_def (fesetenv) +libm_hidden_def (__fesetenv) +weak_alias (__fesetenv, fesetenv) +libm_hidden_weak (fesetenv) diff --git a/sysdeps/mips/fpu/feupdateenv.c b/sysdeps/mips/fpu/feupdateenv.c index 4b3bda9388..2fe8ebe60c 100644 --- a/sysdeps/mips/fpu/feupdateenv.c +++ b/sysdeps/mips/fpu/feupdateenv.c @@ -30,7 +30,7 @@ feupdateenv (const fenv_t *envp) temp &= FE_ALL_EXCEPT; /* Install new environment. */ - fesetenv (envp); + __fesetenv (envp); /* Raise the safed exception. Incidently for us the implementation defined format of the values in objects of type fexcept_t is the diff --git a/sysdeps/powerpc/fpu/fesetenv.c b/sysdeps/powerpc/fpu/fesetenv.c index 4ce41a6fd0..e7407cd31f 100644 --- a/sysdeps/powerpc/fpu/fesetenv.c +++ b/sysdeps/powerpc/fpu/fesetenv.c @@ -58,5 +58,6 @@ strong_alias (__fesetenv, __old_fesetenv) compat_symbol (libm, __old_fesetenv, fesetenv, GLIBC_2_1); #endif +libm_hidden_def (__fesetenv) libm_hidden_ver (__fesetenv, fesetenv) versioned_symbol (libm, __fesetenv, fesetenv, GLIBC_2_2); diff --git a/sysdeps/powerpc/nofpu/fesetenv.c b/sysdeps/powerpc/nofpu/fesetenv.c index e9ffb62955..0385d21d9b 100644 --- a/sysdeps/powerpc/nofpu/fesetenv.c +++ b/sysdeps/powerpc/nofpu/fesetenv.c @@ -42,5 +42,6 @@ strong_alias (__fesetenv, __old_fesetenv) compat_symbol (libm, __old_fesetenv, fesetenv, GLIBC_2_1); #endif +libm_hidden_def (__fesetenv) libm_hidden_ver (__fesetenv, fesetenv) versioned_symbol (libm, __fesetenv, fesetenv, GLIBC_2_2); diff --git a/sysdeps/powerpc/nofpu/feupdateenv.c b/sysdeps/powerpc/nofpu/feupdateenv.c index 3afe548efe..892e463727 100644 --- a/sysdeps/powerpc/nofpu/feupdateenv.c +++ b/sysdeps/powerpc/nofpu/feupdateenv.c @@ -31,7 +31,7 @@ __feupdateenv (const fenv_t *envp) saved_exceptions = __sim_exceptions_thread; /* Set environment. */ - fesetenv (envp); + __fesetenv (envp); /* Raise old exceptions. */ __sim_exceptions_thread |= saved_exceptions; diff --git a/sysdeps/powerpc/powerpc32/e500/nofpu/fesetenv.c b/sysdeps/powerpc/powerpc32/e500/nofpu/fesetenv.c index 2e3acbe238..f0ee1f0a5a 100644 --- a/sysdeps/powerpc/powerpc32/e500/nofpu/fesetenv.c +++ b/sysdeps/powerpc/powerpc32/e500/nofpu/fesetenv.c @@ -45,5 +45,6 @@ strong_alias (__fesetenv, __old_fesetenv) compat_symbol (libm, __old_fesetenv, fesetenv, GLIBC_2_1); #endif +libm_hidden_def (__fesetenv) libm_hidden_ver (__fesetenv, fesetenv) versioned_symbol (libm, __fesetenv, fesetenv, GLIBC_2_2); diff --git a/sysdeps/powerpc/powerpc32/e500/nofpu/feupdateenv.c b/sysdeps/powerpc/powerpc32/e500/nofpu/feupdateenv.c index 6132c7ed19..cb6a1487ac 100644 --- a/sysdeps/powerpc/powerpc32/e500/nofpu/feupdateenv.c +++ b/sysdeps/powerpc/powerpc32/e500/nofpu/feupdateenv.c @@ -28,7 +28,7 @@ __feupdateenv (const fenv_t *envp) exc = fegetenv_register () & SPEFSCR_ALL_EXCEPT; /* Install new environment. */ - fesetenv (envp); + __fesetenv (envp); /* Raise (if appropriate) saved exceptions. */ __feraiseexcept_spe (exc); diff --git a/sysdeps/s390/fpu/fesetenv.c b/sysdeps/s390/fpu/fesetenv.c index d675febeca..467716a2ae 100644 --- a/sysdeps/s390/fpu/fesetenv.c +++ b/sysdeps/s390/fpu/fesetenv.c @@ -25,7 +25,7 @@ #include <unistd.h> int -fesetenv (const fenv_t *envp) +__fesetenv (const fenv_t *envp) { fenv_t env; @@ -47,4 +47,6 @@ fesetenv (const fenv_t *envp) /* Success. */ return 0; } -libm_hidden_def (fesetenv) +libm_hidden_def (__fesetenv) +weak_alias (__fesetenv, fesetenv) +libm_hidden_weak (fesetenv) diff --git a/sysdeps/s390/fpu/feupdateenv.c b/sysdeps/s390/fpu/feupdateenv.c index 662b0dfca1..957c8fe9ad 100644 --- a/sysdeps/s390/fpu/feupdateenv.c +++ b/sysdeps/s390/fpu/feupdateenv.c @@ -31,7 +31,7 @@ feupdateenv (const fenv_t *envp) /* Raise the exceptions since the last call to feholdenv */ /* re install saved environment. */ - fesetenv (envp); + __fesetenv (envp); __feraiseexcept ((int) temp); /* Success. */ diff --git a/sysdeps/sh/sh4/fpu/fesetenv.c b/sysdeps/sh/sh4/fpu/fesetenv.c index 846e819865..e4bfbe8c45 100644 --- a/sysdeps/sh/sh4/fpu/fesetenv.c +++ b/sysdeps/sh/sh4/fpu/fesetenv.c @@ -20,7 +20,7 @@ #include <fpu_control.h> int -fesetenv (const fenv_t *envp) +__fesetenv (const fenv_t *envp) { if (envp == FE_DFL_ENV) _FPU_SETCW (_FPU_DEFAULT); @@ -31,4 +31,6 @@ fesetenv (const fenv_t *envp) } return 0; } -libm_hidden_def (fesetenv) +libm_hidden_def (__fesetenv) +weak_alias (__fesetenv, fesetenv) +libm_hidden_weak (fesetenv) diff --git a/sysdeps/sh/sh4/fpu/feupdateenv.c b/sysdeps/sh/sh4/fpu/feupdateenv.c index 97d524bf6e..25729d9c1f 100644 --- a/sysdeps/sh/sh4/fpu/feupdateenv.c +++ b/sysdeps/sh/sh4/fpu/feupdateenv.c @@ -31,7 +31,7 @@ feupdateenv (const fenv_t *envp) /* Raise the saved exception. Incidently for us the implementation defined format of the values in objects of type fexcept_t is the same as the ones specified using the FE_* constants. */ - fesetenv (envp); + __fesetenv (envp); __feraiseexcept ((int) temp); return 0; diff --git a/sysdeps/sparc/fpu/fesetenv.c b/sysdeps/sparc/fpu/fesetenv.c index 11954beeb2..3f89ab7411 100644 --- a/sysdeps/sparc/fpu/fesetenv.c +++ b/sysdeps/sparc/fpu/fesetenv.c @@ -50,5 +50,6 @@ strong_alias (__fesetenv, __old_fesetenv) compat_symbol (libm, __old_fesetenv, fesetenv, GLIBC_2_1); #endif +libm_hidden_def (__fesetenv) libm_hidden_ver (__fesetenv, fesetenv) versioned_symbol (libm, __fesetenv, fesetenv, GLIBC_2_2); diff --git a/sysdeps/sparc/fpu/feupdateenv.c b/sysdeps/sparc/fpu/feupdateenv.c index db5f382a34..cb001e19c8 100644 --- a/sysdeps/sparc/fpu/feupdateenv.c +++ b/sysdeps/sparc/fpu/feupdateenv.c @@ -29,7 +29,7 @@ __feupdateenv (const fenv_t *envp) tmp &= FE_ALL_EXCEPT; /* Install new environment. */ - fesetenv (envp); + __fesetenv (envp); /* Raise the safed exception. Incidently for us the implementation defined format of the values in objects of type fexcept_t is the diff --git a/sysdeps/tile/math_private.h b/sysdeps/tile/math_private.h index 6b9e7618dd..8ff1435f17 100644 --- a/sysdeps/tile/math_private.h +++ b/sysdeps/tile/math_private.h @@ -32,6 +32,7 @@ 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 __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; } diff --git a/sysdeps/x86_64/fpu/fesetenv.c b/sysdeps/x86_64/fpu/fesetenv.c index 40428a6754..3e3fd8492d 100644 --- a/sysdeps/x86_64/fpu/fesetenv.c +++ b/sysdeps/x86_64/fpu/fesetenv.c @@ -21,7 +21,7 @@ int -fesetenv (const fenv_t *envp) +__fesetenv (const fenv_t *envp) { fenv_t temp; @@ -85,4 +85,6 @@ fesetenv (const fenv_t *envp) /* Success. */ return 0; } -libm_hidden_def (fesetenv) +libm_hidden_def (__fesetenv) +weak_alias (__fesetenv, fesetenv) +libm_hidden_weak (fesetenv) diff --git a/sysdeps/x86_64/fpu/feupdateenv.c b/sysdeps/x86_64/fpu/feupdateenv.c index aaff4d2a1d..7aab1ad2ca 100644 --- a/sysdeps/x86_64/fpu/feupdateenv.c +++ b/sysdeps/x86_64/fpu/feupdateenv.c @@ -30,7 +30,7 @@ __feupdateenv (const fenv_t *envp) temp = (temp | xtemp) & FE_ALL_EXCEPT; /* Install new environment. */ - fesetenv (envp); + __fesetenv (envp); /* Raise the saved exception. Incidently for us the implementation defined format of the values in objects of type fexcept_t is the |