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.
This commit is contained in:
Joseph Myers 2015-01-06 23:36:20 +00:00
parent 500bfbd492
commit cd42798aef
32 changed files with 102 additions and 30 deletions

View File

@ -1,3 +1,49 @@
2015-01-06 Joseph Myers <joseph@codesourcery.com>
[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.
2015-01-06 Aurelien Jarno <aurelien@aurel32.net>
[BZ #17806]

View File

@ -23,6 +23,7 @@ libm_hidden_proto (__fegetenv)
libm_hidden_proto (fegetround)
libm_hidden_proto (__fegetround)
libm_hidden_proto (fesetenv)
libm_hidden_proto (__fesetenv)
libm_hidden_proto (fesetround)
libm_hidden_proto (feholdexcept)
libm_hidden_proto (__feholdexcept)

View File

@ -34,6 +34,7 @@ __fesetenv (const fenv_t *envp)
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);

View File

@ -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)

View File

@ -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);

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -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;
}

View File

@ -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);

View File

@ -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

View File

@ -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)

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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)

View File

@ -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. */

View File

@ -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)

View File

@ -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;

View File

@ -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);

View File

@ -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

View File

@ -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; }

View File

@ -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)

View File

@ -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