Fix libm feholdexcept namespace (bug 17748).

Continuing the fixes for C90 libm functions calling C99 fe* functions,
this patch fixes the case of feholdexcept by making it a weak alias of
__feholdexcept and making the affected code call __feholdexcept.

Tested for x86_64 (testsuite, and that disassembly of installed shared
libraries is unchanged by the patch).  Also tested for ARM
(soft-float) that feholdexcept failures disappear from the
linknamespace test failures (fesetenv, fsetround and feupdateenv
remain to be addressed to complete fixing bug 17748).

	[BZ #17748]
	* include/fenv.h (__feholdexcept): Declare.  Use
	libm_hidden_proto.
	* math/feholdexcpt.c (feholdexcept): Rename to __feholdexcept and
	define as weak alias of __feholdexcept.  Use libm_hidden_weak.
	* sysdeps/aarch64/fpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/alpha/fpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/arm/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/hppa/fpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/i386/fpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/ia64/fpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/m68k/fpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/mips/fpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/powerpc/fpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/powerpc/nofpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/powerpc/powerpc32/e500/nofpu/feholdexcpt.c
	(feholdexcept): Likewise.
	* sysdeps/s390/fpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/sh/sh4/fpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/sparc/fpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/x86_64/fpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/generic/math_private.h (default_libc_feholdexcept): Use
	__feholdexcept instead of feholdexcept.
	(default_libc_feholdexcept_setround): Likewise.
This commit is contained in:
Joseph Myers 2015-01-05 23:06:14 +00:00
parent 882c4b9f1d
commit ef9faf1385
19 changed files with 95 additions and 34 deletions

View File

@ -1,3 +1,30 @@
2015-01-05 Joseph Myers <joseph@codesourcery.com>
[BZ #17748]
* include/fenv.h (__feholdexcept): Declare. Use
libm_hidden_proto.
* math/feholdexcpt.c (feholdexcept): Rename to __feholdexcept and
define as weak alias of __feholdexcept. Use libm_hidden_weak.
* sysdeps/aarch64/fpu/feholdexcpt.c (feholdexcept): Likewise.
* sysdeps/alpha/fpu/feholdexcpt.c (feholdexcept): Likewise.
* sysdeps/arm/feholdexcpt.c (feholdexcept): Likewise.
* sysdeps/hppa/fpu/feholdexcpt.c (feholdexcept): Likewise.
* sysdeps/i386/fpu/feholdexcpt.c (feholdexcept): Likewise.
* sysdeps/ia64/fpu/feholdexcpt.c (feholdexcept): Likewise.
* sysdeps/m68k/fpu/feholdexcpt.c (feholdexcept): Likewise.
* sysdeps/mips/fpu/feholdexcpt.c (feholdexcept): Likewise.
* sysdeps/powerpc/fpu/feholdexcpt.c (feholdexcept): Likewise.
* sysdeps/powerpc/nofpu/feholdexcpt.c (feholdexcept): Likewise.
* sysdeps/powerpc/powerpc32/e500/nofpu/feholdexcpt.c
(feholdexcept): Likewise.
* sysdeps/s390/fpu/feholdexcpt.c (feholdexcept): Likewise.
* sysdeps/sh/sh4/fpu/feholdexcpt.c (feholdexcept): Likewise.
* sysdeps/sparc/fpu/feholdexcpt.c (feholdexcept): Likewise.
* sysdeps/x86_64/fpu/feholdexcpt.c (feholdexcept): Likewise.
* sysdeps/generic/math_private.h (default_libc_feholdexcept): Use
__feholdexcept instead of feholdexcept.
(default_libc_feholdexcept_setround): Likewise.
2015-01-05 Steve Ellcey <sellcey@imgtec.com>
* sysdeps/mips/memcpy.S: Add support for mips32r6/mips64r6.

View File

@ -14,6 +14,7 @@ extern int __fegetenv (fenv_t *__envp);
extern int __fesetenv (const fenv_t *__envp);
extern int __feupdateenv (const fenv_t *__envp);
extern __typeof (fegetround) __fegetround;
extern __typeof (feholdexcept) __feholdexcept;
libm_hidden_proto (feraiseexcept)
libm_hidden_proto (__feraiseexcept)
@ -24,6 +25,7 @@ libm_hidden_proto (__fegetround)
libm_hidden_proto (fesetenv)
libm_hidden_proto (fesetround)
libm_hidden_proto (feholdexcept)
libm_hidden_proto (__feholdexcept)
libm_hidden_proto (feupdateenv)
libm_hidden_proto (fetestexcept)
libm_hidden_proto (feclearexcept)

View File

@ -20,10 +20,12 @@
#include <fenv.h>
int
feholdexcept (fenv_t *envp)
__feholdexcept (fenv_t *envp)
{
/* No exception traps to disable and no state to save. */
return 0;
}
libm_hidden_def (feholdexcept)
libm_hidden_def (__feholdexcept)
weak_alias (__feholdexcept, feholdexcept)
libm_hidden_weak (feholdexcept)
stub_warning (feholdexcept)

View File

@ -20,9 +20,11 @@
#include <math_private.h>
int
feholdexcept (fenv_t *envp)
__feholdexcept (fenv_t *envp)
{
libc_feholdexcept_aarch64 (envp);
return 0;
}
libm_hidden_def (feholdexcept)
libm_hidden_def (__feholdexcept)
weak_alias (__feholdexcept, feholdexcept)
libm_hidden_weak (feholdexcept)

View File

@ -20,7 +20,7 @@
#include <fenv_libc.h>
int
feholdexcept (fenv_t *envp)
__feholdexcept (fenv_t *envp)
{
/* Save the current state. */
fegetenv(envp);
@ -30,4 +30,6 @@ feholdexcept (fenv_t *envp)
return 0;
}
libm_hidden_def (feholdexcept)
libm_hidden_def (__feholdexcept)
weak_alias (__feholdexcept, feholdexcept)
libm_hidden_weak (feholdexcept)

View File

@ -21,7 +21,7 @@
int
feholdexcept (fenv_t *envp)
__feholdexcept (fenv_t *envp)
{
/* Fail if a VFP unit isn't present. */
if (!ARM_HAVE_VFP)
@ -30,4 +30,6 @@ feholdexcept (fenv_t *envp)
libc_feholdexcept_vfp (envp);
return 0;
}
libm_hidden_def (feholdexcept)
libm_hidden_def (__feholdexcept)
weak_alias (__feholdexcept, feholdexcept)
libm_hidden_weak (feholdexcept)

View File

@ -399,7 +399,7 @@ extern long double __gamma_productl (long double x, long double x_eps,
static __always_inline void
default_libc_feholdexcept (fenv_t *e)
{
(void) feholdexcept (e);
(void) __feholdexcept (e);
}
#ifndef libc_feholdexcept
@ -431,7 +431,7 @@ default_libc_fesetround (int r)
static __always_inline void
default_libc_feholdexcept_setround (fenv_t *e, int r)
{
feholdexcept (e);
__feholdexcept (e);
fesetround (r);
}

View File

@ -21,7 +21,7 @@
#include <string.h>
int
feholdexcept (fenv_t *envp)
__feholdexcept (fenv_t *envp)
{
union { unsigned long long buf[4]; fenv_t env; } clear;
unsigned long long *bufptr;
@ -50,4 +50,6 @@ feholdexcept (fenv_t *envp)
return 0;
}
libm_hidden_def (feholdexcept)
libm_hidden_def (__feholdexcept)
weak_alias (__feholdexcept, feholdexcept)
libm_hidden_weak (feholdexcept)

View File

@ -23,7 +23,7 @@
#include <dl-procinfo.h>
int
feholdexcept (fenv_t *envp)
__feholdexcept (fenv_t *envp)
{
/* Store the environment. Recall that fnstenv has a side effect of
masking all exceptions. Then clear all exceptions. */
@ -45,4 +45,6 @@ feholdexcept (fenv_t *envp)
return 0;
}
libm_hidden_def (feholdexcept)
libm_hidden_def (__feholdexcept)
weak_alias (__feholdexcept, feholdexcept)
libm_hidden_weak (feholdexcept)

View File

@ -20,7 +20,7 @@
#include <fenv.h>
int
feholdexcept (fenv_t *envp)
__feholdexcept (fenv_t *envp)
{
fenv_t fpsr;
/* Save the current state. */
@ -38,4 +38,6 @@ feholdexcept (fenv_t *envp)
/* Success. */
return 0;
}
libm_hidden_def (feholdexcept)
libm_hidden_def (__feholdexcept)
weak_alias (__feholdexcept, feholdexcept)
libm_hidden_weak (feholdexcept)

View File

@ -20,7 +20,7 @@
#include <fenv.h>
int
feholdexcept (fenv_t *envp)
__feholdexcept (fenv_t *envp)
{
fexcept_t fpcr, fpsr;
@ -42,4 +42,6 @@ feholdexcept (fenv_t *envp)
return 0;
}
libm_hidden_def (feholdexcept);
libm_hidden_def (__feholdexcept)
weak_alias (__feholdexcept, feholdexcept)
libm_hidden_weak (feholdexcept)

View File

@ -21,7 +21,7 @@
#include <fpu_control.h>
int
feholdexcept (fenv_t *envp)
__feholdexcept (fenv_t *envp)
{
fpu_control_t cw;
@ -36,4 +36,6 @@ feholdexcept (fenv_t *envp)
return 0;
}
libm_hidden_def (feholdexcept)
libm_hidden_def (__feholdexcept)
weak_alias (__feholdexcept, feholdexcept)
libm_hidden_weak (feholdexcept)

View File

@ -21,7 +21,7 @@
#define _FPU_MASK_ALL (_FPU_MASK_ZM | _FPU_MASK_OM | _FPU_MASK_UM | _FPU_MASK_XM | _FPU_MASK_IM)
int
feholdexcept (fenv_t *envp)
__feholdexcept (fenv_t *envp)
{
fenv_union_t old, new;
@ -46,4 +46,6 @@ feholdexcept (fenv_t *envp)
return 0;
}
libm_hidden_def (feholdexcept)
libm_hidden_def (__feholdexcept)
weak_alias (__feholdexcept, feholdexcept)
libm_hidden_weak (feholdexcept)

View File

@ -22,7 +22,7 @@
#include "soft-supp.h"
int
feholdexcept (fenv_t *envp)
__feholdexcept (fenv_t *envp)
{
fenv_union_t u;
@ -40,4 +40,6 @@ feholdexcept (fenv_t *envp)
return 0;
}
libm_hidden_def (feholdexcept)
libm_hidden_def (__feholdexcept)
weak_alias (__feholdexcept, feholdexcept)
libm_hidden_weak (feholdexcept)

View File

@ -22,7 +22,7 @@
#include <sys/prctl.h>
int
feholdexcept (fenv_t *envp)
__feholdexcept (fenv_t *envp)
{
fenv_union_t u;
INTERNAL_SYSCALL_DECL (err);
@ -54,4 +54,6 @@ feholdexcept (fenv_t *envp)
return 0;
}
libm_hidden_def (feholdexcept)
libm_hidden_def (__feholdexcept)
weak_alias (__feholdexcept, feholdexcept)
libm_hidden_weak (feholdexcept)

View File

@ -20,7 +20,7 @@
#include <fenv_libc.h>
#include <fpu_control.h>
int feholdexcept (fenv_t *envp)
int __feholdexcept (fenv_t *envp)
{
fexcept_t fpc;
/* Store the environment. */
@ -32,4 +32,6 @@ int feholdexcept (fenv_t *envp)
_FPU_SETCW ((fpc & ~(FE_ALL_EXCEPT << FPC_EXCEPTION_MASK_SHIFT)));
return 0;
}
libm_hidden_def (feholdexcept)
libm_hidden_def (__feholdexcept)
weak_alias (__feholdexcept, feholdexcept)
libm_hidden_weak (feholdexcept)

View File

@ -20,7 +20,7 @@
#include <fpu_control.h>
int
feholdexcept (fenv_t *envp)
__feholdexcept (fenv_t *envp)
{
fpu_control_t temp;
@ -39,4 +39,6 @@ feholdexcept (fenv_t *envp)
/* Success. */
return 0;
}
libm_hidden_def (feholdexcept)
libm_hidden_def (__feholdexcept)
weak_alias (__feholdexcept, feholdexcept)
libm_hidden_weak (feholdexcept)

View File

@ -19,7 +19,7 @@
#include <fenv.h>
int
feholdexcept (fenv_t *envp)
__feholdexcept (fenv_t *envp)
{
fenv_t tmp;
@ -32,4 +32,6 @@ feholdexcept (fenv_t *envp)
return 0;
}
libm_hidden_def (feholdexcept)
libm_hidden_def (__feholdexcept)
weak_alias (__feholdexcept, feholdexcept)
libm_hidden_weak (feholdexcept)

View File

@ -19,7 +19,7 @@
#include <fenv.h>
int
feholdexcept (fenv_t *envp)
__feholdexcept (fenv_t *envp)
{
unsigned int mxcsr;
@ -36,4 +36,6 @@ feholdexcept (fenv_t *envp)
return 0;
}
libm_hidden_def (feholdexcept)
libm_hidden_def (__feholdexcept)
weak_alias (__feholdexcept, feholdexcept)
libm_hidden_weak (feholdexcept)