+2014-12-30 Joseph Myers <joseph@codesourcery.com>
+
+ [BZ #17723]
+ * include/fenv.h (__feraiseexcept): Use libm_hidden_proto.
+ * math/fraiseexcpt.c (__feraiseexcept): Use libm_hidden_def.
+ * sysdeps/aarch64/fpu/fraiseexcpt.c (feraiseexcept): Rename to
+ __feraiseexcept and define as weak alias of __feraiseexcept. Use
+ libm_hidden_weak.
+ * sysdeps/arm/fraiseexcpt.c (feraiseexcept): Likewise.
+ * sysdeps/hppa/fpu/fraiseexcpt.c (feraiseexcept): Likewise.
+ * sysdeps/i386/fpu/fraiseexcpt.c (__feraiseexcept): Use
+ libm_hidden_def.
+ * sysdeps/ia64/fpu/fraiseexcpt.c (feraiseexcept): Rename to
+ __feraiseexcept and define as weak alias of __feraiseexcept. Use
+ libm_hidden_weak.
+ * sysdeps/m68k/coldfire/fpu/fraiseexcpt.c (feraiseexcept):
+ Likewise.
+ * sysdeps/microblaze/math_private.h (__feraiseexcept): New macro.
+ * sysdeps/mips/fpu/fraiseexcpt.c (feraiseexcept): Rename to
+ __feraiseexcept and define as weak alias of __feraiseexcept. Use
+ libm_hidden_weak.
+ * sysdeps/powerpc/fpu/fraiseexcpt.c (__feraiseexcept): Use
+ libm_hidden_def.
+ * sysdeps/powerpc/nofpu/fraiseexcpt.c (__feraiseexcept): Likewise.
+ * sysdeps/powerpc/powerpc32/e500/nofpu/fraiseexcpt.c
+ (__feraiseexcept): Likewise.
+ * sysdeps/s390/fpu/fraiseexcpt.c (feraiseexcept): Rename to
+ __feraiseexcept and define as weak alias of __feraiseexcept. Use
+ libm_hidden_weak.
+ * sysdeps/sh/sh4/fpu/fraiseexcpt.c (feraiseexcept): Likewise.
+ * sysdeps/sparc/fpu/fraiseexcpt.c (__feraiseexcept): Use
+ libm_hidden_def.
+ * sysdeps/tile/math_private.h (__feraiseexcept): New macro.
+ * sysdeps/unix/sysv/linux/alpha/fraiseexcpt.S (__feraiseexcept):
+ Use libm_hidden_def.
+ * sysdeps/x86_64/fpu/fraiseexcpt.c (__feraiseexcept): Use
+ libm_hidden_def.
+ (feraiseexcept): Define as weak not strong alias. Use
+ libm_hidden_weak.
+ * sysdeps/x86/fpu/bits/fenv.h (__feraiseexcept_invalid_divbyzero):
+ New inline function. Factored out of ...
+ (feraiseexcept): ... here. Use __feraiseexcept_invalid_divbyzero.
+ * sysdeps/x86/fpu/include/bits/fenv.h: New file.
+ * math/e_scalb.c (invalid_fn): Call __feraiseexcept instead of
+ feraiseexcept.
+ * math/w_acos.c (__acos): Likewise.
+ * math/w_asin.c (__asin): Likewise.
+ * math/w_ilogb.c (__ilogb): Likewise.
+ * math/w_j0.c (y0): Likewise.
+ * math/w_j1.c (y1): Likewise.
+ * math/w_jn.c (yn): Likewise.
+ * math/w_log.c (__log): Likewise.
+ * math/w_log10.c (__log10): Likewise.
+ * sysdeps/aarch64/fpu/feupdateenv.c (feupdateenv): Likewise.
+ * sysdeps/aarch64/fpu/math_private.h
+ (libc_feupdateenv_test_aarch64): Likewise.
+ * sysdeps/alpha/fpu/feupdateenv.c (__feupdateenv): Likewise.
+ * sysdeps/arm/fenv_private.h (libc_feupdateenv_test_vfp): Likewise.
+ * sysdeps/arm/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/fpu/e_sqrt.c (__slow_ieee754_sqrt): Likewise.
+ * sysdeps/s390/fpu/feupdateenv.c (feupdateenv): Likewise.
+ * sysdeps/sh/sh4/fpu/feupdateenv.c (feupdateenv): Likewise.
+ * sysdeps/sparc/fpu/feupdateenv.c (__feupdateenv): Likewise.
+
2014-12-30 H.J. Lu <hongjiu.lu@intel.com>
[BZ #17732]
17522, 17555, 17570, 17571, 17572, 17573, 17574, 17581, 17582, 17583,
17584, 17585, 17589, 17594, 17601, 17608, 17616, 17625, 17630, 17633,
17634, 17647, 17653, 17657, 17664, 17665, 17668, 17682, 17717, 17719,
- 17722, 17724, 17725, 17732, 17733, 17744, 17745, 17746, 17747.
+ 17722, 17723, 17724, 17725, 17732, 17733, 17744, 17745, 17746, 17747.
* CVE-2104-7817 The wordexp function could ignore the WRDE_NOCMD flag
under certain input conditions resulting in the execution of a shell for
extern int __feupdateenv (const fenv_t *__envp);
libm_hidden_proto (feraiseexcept)
+libm_hidden_proto (__feraiseexcept)
libm_hidden_proto (fegetenv)
libm_hidden_proto (fegetround)
libm_hidden_proto (fesetenv)
{
if (__rint (fn) != fn)
{
- feraiseexcept (FE_INVALID);
+ __feraiseexcept (FE_INVALID);
return __nan ("");
}
else if (fn > 65000.0)
strong_alias (__feraiseexcept, __old_feraiseexcept)
compat_symbol (libm, __old_feraiseexcept, feraiseexcept, GLIBC_2_1);
#endif
+libm_hidden_def (__feraiseexcept)
libm_hidden_ver (__feraiseexcept, feraiseexcept)
versioned_symbol (libm, __feraiseexcept, feraiseexcept, GLIBC_2_2);
&& _LIB_VERSION != _IEEE_)
{
/* acos(|x|>1) */
- feraiseexcept (FE_INVALID);
+ __feraiseexcept (FE_INVALID);
return __kernel_standard (x, x, 1);
}
&& _LIB_VERSION != _IEEE_)
{
/* asin(|x|>1) */
- feraiseexcept (FE_INVALID);
+ __feraiseexcept (FE_INVALID);
return __kernel_standard (x, x, 2);
}
|| __builtin_expect (r == INT_MAX, 0))
{
__set_errno (EDOM);
- feraiseexcept (FE_INVALID);
+ __feraiseexcept (FE_INVALID);
}
return r;
}
if (x < 0.0)
{
/* d = zero/(x-x) */
- feraiseexcept (FE_INVALID);
+ __feraiseexcept (FE_INVALID);
return __kernel_standard (x, x, 9);
}
else if (x == 0.0)
{
/* d = -one/(x-x) */
- feraiseexcept (FE_DIVBYZERO);
+ __feraiseexcept (FE_DIVBYZERO);
return __kernel_standard (x, x, 8);
}
else if (_LIB_VERSION != _POSIX_)
if (x < 0.0)
{
/* d = zero/(x-x) */
- feraiseexcept (FE_INVALID);
+ __feraiseexcept (FE_INVALID);
return __kernel_standard (x, x, 11);
}
else if (x == 0.0)
{
/* d = -one/(x-x) */
- feraiseexcept (FE_DIVBYZERO);
+ __feraiseexcept (FE_DIVBYZERO);
return __kernel_standard (x, x, 10);
}
else if (_LIB_VERSION != _POSIX_)
if (x < 0.0)
{
/* d = zero/(x-x) */
- feraiseexcept (FE_INVALID);
+ __feraiseexcept (FE_INVALID);
return __kernel_standard (n, x, 13);
}
else if (x == 0.0)
{
/* d = -one/(x-x) */
- feraiseexcept (FE_DIVBYZERO);
+ __feraiseexcept (FE_DIVBYZERO);
return __kernel_standard (n, x, 12);
}
else if (_LIB_VERSION != _POSIX_)
{
if (x == 0.0)
{
- feraiseexcept (FE_DIVBYZERO);
+ __feraiseexcept (FE_DIVBYZERO);
return __kernel_standard (x, x, 16); /* log(0) */
}
else
{
- feraiseexcept (FE_INVALID);
+ __feraiseexcept (FE_INVALID);
return __kernel_standard (x, x, 17); /* log(x<0) */
}
}
{
if (x == 0.0)
{
- feraiseexcept (FE_DIVBYZERO);
+ __feraiseexcept (FE_DIVBYZERO);
return __kernel_standard (x, x, 18); /* log10(0) */
}
else
{
- feraiseexcept (FE_INVALID);
+ __feraiseexcept (FE_INVALID);
return __kernel_standard (x, x, 19); /* log10(x<0) */
}
}
_FPU_SETFPSR (fpsr_new);
if (excepts & (fpcr_new >> FE_EXCEPT_SHIFT))
- return feraiseexcept (excepts);
+ return __feraiseexcept (excepts);
return 0;
}
}
if (excepts & (fpcr_new >> FE_EXCEPT_SHIFT))
- return feraiseexcept (excepts);
+ return __feraiseexcept (excepts);
return 0;
}
#include <float.h>
int
-feraiseexcept (int excepts)
+__feraiseexcept (int excepts)
{
int fpsr;
const float fp_zero = 0.0;
return 0;
}
-libm_hidden_def (feraiseexcept)
+libm_hidden_def (__feraiseexcept)
+weak_alias (__feraiseexcept, feraiseexcept)
+libm_hidden_weak (feraiseexcept)
/* Raise the exceptions if enabled in the new FP state. */
if (__glibc_unlikely (excepts & (new_fpcr >> FE_EXCEPT_SHIFT)))
- feraiseexcept (excepts);
+ __feraiseexcept (excepts);
return excepts & ex;
}
/* 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. */
- feraiseexcept (tmp & SWCR_STATUS_MASK);
+ __feraiseexcept (tmp & SWCR_STATUS_MASK);
/* Success. */
return 0;
/* Raise the exceptions if enabled in the new FP state. */
if (__glibc_unlikely (excepts & (new_fpscr >> FE_EXCEPT_SHIFT)))
- feraiseexcept (excepts);
+ __feraiseexcept (excepts);
return excepts & ex;
}
/* Raise the exceptions if enabled in the new FP state. */
if (excepts & (new_fpscr >> FE_EXCEPT_SHIFT))
- return feraiseexcept (excepts);
+ return __feraiseexcept (excepts);
return 0;
}
/* Raise the exceptions if enabled in the new FP state. */
if (excepts & (new_fpscr >> FE_EXCEPT_SHIFT))
- return feraiseexcept (excepts);
+ return __feraiseexcept (excepts);
return 0;
}
int
-feraiseexcept (int excepts)
+__feraiseexcept (int excepts)
{
/* Fail if a VFP unit isn't present unless nothing needs to be done. */
if (!ARM_HAVE_VFP)
return 0;
}
}
-libm_hidden_def (feraiseexcept)
+libm_hidden_def (__feraiseexcept)
+weak_alias (__feraiseexcept, feraiseexcept)
+libm_hidden_weak (feraiseexcept)
page 10-5 "Delayed Trapping" in the PA-RISC 2.0 Architecture manual */
int
-feraiseexcept (int excepts)
+__feraiseexcept (int excepts)
{
/* Raise exceptions represented by EXCEPTS. But we must raise only one
signal at a time. It is important that if the overflow/underflow
/* Success. */
return 0;
}
-libm_hidden_def (feraiseexcept)
+libm_hidden_def (__feraiseexcept)
+weak_alias (__feraiseexcept, feraiseexcept)
+libm_hidden_weak (feraiseexcept)
compat_symbol (libm, __old_feraiseexcept, feraiseexcept, GLIBC_2_1);
#endif
+libm_hidden_def (__feraiseexcept)
libm_hidden_ver (__feraiseexcept, feraiseexcept)
versioned_symbol (libm, __feraiseexcept, feraiseexcept, GLIBC_2_2);
fesetenv (envp);
/* Raise the saved exceptions. */
- feraiseexcept ((int) (fpsr >> 13) & FE_ALL_EXCEPT);
+ __feraiseexcept ((int) (fpsr >> 13) & FE_ALL_EXCEPT);
/* Success. */
return 0;
#include <unistd.h>
int
-feraiseexcept (int excepts)
+__feraiseexcept (int excepts)
{
double tmp;
double dummy;
/* Success. */
return 0;
}
-libm_hidden_def (feraiseexcept)
+libm_hidden_def (__feraiseexcept)
+weak_alias (__feraiseexcept, feraiseexcept)
+libm_hidden_weak (feraiseexcept)
#include <math.h>
int
-feraiseexcept (int excepts)
+__feraiseexcept (int excepts)
{
/* Raise exceptions represented by EXCEPTS. But we must raise only one
signal at a time. It is important that if the overflow/underflow
/* Success. */
return 0;
}
-libm_hidden_def (feraiseexcept)
+libm_hidden_def (__feraiseexcept)
+weak_alias (__feraiseexcept, feraiseexcept)
+libm_hidden_weak (feraiseexcept)
/* 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. */
- feraiseexcept ((int) fpsr);
+ __feraiseexcept ((int) fpsr);
/* Success. */
return 0;
#include_next <math_private.h>
#define feraiseexcept(excepts) ({ 0; })
+#define __feraiseexcept(excepts) ({ 0; })
#define feclearexcept(exc) ({ 0; })
#endif
/* Raise the safed 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. */
- feraiseexcept (temp);
+ __feraiseexcept (temp);
/* Success. */
return 0;
#include <fpu_control.h>
int
-feraiseexcept (int excepts)
+__feraiseexcept (int excepts)
{
fpu_control_t cw;
return 0;
}
-libm_hidden_def (feraiseexcept)
+libm_hidden_def (__feraiseexcept)
+weak_alias (__feraiseexcept, feraiseexcept)
+libm_hidden_weak (feraiseexcept)
/* For some reason, some PowerPC32 processors don't implement
FE_INVALID_SQRT. */
#ifdef FE_INVALID_SQRT
- feraiseexcept (FE_INVALID_SQRT);
+ __feraiseexcept (FE_INVALID_SQRT);
fenv_union_t u = { .fenv = fegetenv_register () };
if ((u.l & FE_INVALID) == 0)
#endif
- feraiseexcept (FE_INVALID);
+ __feraiseexcept (FE_INVALID);
x = a_nan.value;
}
return f_wash (x);
compat_symbol (libm, __old_feraiseexcept, feraiseexcept, GLIBC_2_1);
#endif
+libm_hidden_def (__feraiseexcept)
libm_hidden_ver (__feraiseexcept, feraiseexcept)
versioned_symbol (libm, __feraiseexcept, feraiseexcept, GLIBC_2_2);
compat_symbol (libm, __old_feraiseexcept, feraiseexcept, GLIBC_2_1);
#endif
+libm_hidden_def (__feraiseexcept)
libm_hidden_ver (__feraiseexcept, feraiseexcept)
versioned_symbol (libm, __feraiseexcept, feraiseexcept, GLIBC_2_2);
compat_symbol (libm, __old_feraiseexcept, feraiseexcept, GLIBC_2_1);
#endif
+libm_hidden_def (__feraiseexcept)
libm_hidden_ver (__feraiseexcept, feraiseexcept)
versioned_symbol (libm, __feraiseexcept, feraiseexcept, GLIBC_2_2);
/* Raise the exceptions since the last call to feholdenv */
/* re install saved environment. */
fesetenv (envp);
- feraiseexcept ((int) temp);
+ __feraiseexcept ((int) temp);
/* Success. */
return 0;
int
-feraiseexcept (int excepts)
+__feraiseexcept (int excepts)
{
/* Raise exceptions represented by EXPECTS. But we must raise only
one signal at a time. It is important that if the overflow/underflow
/* Success. */
return 0;
}
-libm_hidden_def (feraiseexcept)
+libm_hidden_def (__feraiseexcept)
+weak_alias (__feraiseexcept, feraiseexcept)
+libm_hidden_weak (feraiseexcept)
defined format of the values in objects of type fexcept_t is the
same as the ones specified using the FE_* constants. */
fesetenv (envp);
- feraiseexcept ((int) temp);
+ __feraiseexcept ((int) temp);
return 0;
}
#include <math.h>
int
-feraiseexcept (int excepts)
+__feraiseexcept (int excepts)
{
if (excepts == 0)
return 0;
return 0;
}
-libm_hidden_def (feraiseexcept)
+libm_hidden_def (__feraiseexcept)
+weak_alias (__feraiseexcept, feraiseexcept)
+libm_hidden_weak (feraiseexcept)
/* Raise the safed 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. */
- feraiseexcept ((int) tmp);
+ __feraiseexcept ((int) tmp);
/* Success. */
return 0;
compat_symbol (libm, __old_feraiseexcept, feraiseexcept, GLIBC_2_1);
#endif
+libm_hidden_def (__feraiseexcept)
libm_hidden_ver (__feraiseexcept, feraiseexcept)
versioned_symbol (libm, __feraiseexcept, feraiseexcept, GLIBC_2_2);
#include_next <math_private.h>
#define feraiseexcept(excepts) ({ 0; })
+#define __feraiseexcept(excepts) ({ 0; })
#define feclearexcept(exc) ({ 0; })
#define fetestexcept(exc) ({ 0; })
extern inline int fegetenv (fenv_t *__e) { return 0; }
strong_alias (__feraiseexcept, __old_feraiseexcept)
compat_symbol (libm, __old_feraiseexcept, feraiseexcept, GLIBC_2_1);
# endif
+libm_hidden_def (__feraiseexcept)
libm_hidden_ver (__feraiseexcept, feraiseexcept)
versioned_symbol (libm, __feraiseexcept, feraiseexcept, GLIBC_2_2);
#endif
/* Optimized versions. */
extern int __REDIRECT_NTH (__feraiseexcept_renamed, (int), feraiseexcept);
-__extern_inline int
-__NTH (feraiseexcept (int __excepts))
+__extern_always_inline void
+__NTH (__feraiseexcept_invalid_divbyzero (int __excepts))
{
- if (__builtin_constant_p (__excepts)
- && (__excepts & ~(FE_INVALID | FE_DIVBYZERO)) == 0)
+ if ((FE_INVALID & __excepts) != 0)
{
- if ((FE_INVALID & __excepts) != 0)
- {
- /* One example of an invalid operation is 0.0 / 0.0. */
- float __f = 0.0;
+ /* One example of an invalid operation is 0.0 / 0.0. */
+ float __f = 0.0;
# ifdef __SSE_MATH__
- __asm__ __volatile__ ("divss %0, %0 " : : "x" (__f));
+ __asm__ __volatile__ ("divss %0, %0 " : : "x" (__f));
# else
- __asm__ __volatile__ ("fdiv %%st, %%st(0); fwait"
- : "=t" (__f) : "0" (__f));
+ __asm__ __volatile__ ("fdiv %%st, %%st(0); fwait"
+ : "=t" (__f) : "0" (__f));
# endif
- (void) &__f;
- }
- if ((FE_DIVBYZERO & __excepts) != 0)
- {
- float __f = 1.0;
- float __g = 0.0;
+ (void) &__f;
+ }
+ if ((FE_DIVBYZERO & __excepts) != 0)
+ {
+ float __f = 1.0;
+ float __g = 0.0;
# ifdef __SSE_MATH__
- __asm__ __volatile__ ("divss %1, %0" : : "x" (__f), "x" (__g));
+ __asm__ __volatile__ ("divss %1, %0" : : "x" (__f), "x" (__g));
# else
- __asm__ __volatile__ ("fdivp %%st, %%st(1); fwait"
- : "=t" (__f) : "0" (__f), "u" (__g) : "st(1)");
+ __asm__ __volatile__ ("fdivp %%st, %%st(1); fwait"
+ : "=t" (__f) : "0" (__f), "u" (__g) : "st(1)");
# endif
- (void) &__f;
- }
-
+ (void) &__f;
+ }
+}
+__extern_inline int
+__NTH (feraiseexcept (int __excepts))
+{
+ if (__builtin_constant_p (__excepts)
+ && (__excepts & ~(FE_INVALID | FE_DIVBYZERO)) == 0)
+ {
+ __feraiseexcept_invalid_divbyzero (__excepts);
return 0;
}
--- /dev/null
+/* Wrapper for x86 bits/fenv.h for use when building glibc.
+ Copyright (C) 1997-2014 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include_next <bits/fenv.h>
+
+/* Ensure __feraiseexcept calls in glibc are optimized the same as
+ feraiseexcept calls. */
+
+#ifdef __USE_EXTERN_INLINES
+__BEGIN_DECLS
+
+extern int __REDIRECT_NTH (____feraiseexcept_renamed, (int), __feraiseexcept);
+__extern_inline int
+__NTH (__feraiseexcept (int __excepts))
+{
+ if (__builtin_constant_p (__excepts)
+ && (__excepts & ~(FE_INVALID | FE_DIVBYZERO)) == 0)
+ {
+ __feraiseexcept_invalid_divbyzero (__excepts);
+ return 0;
+ }
+
+ return ____feraiseexcept_renamed (__excepts);
+}
+
+__END_DECLS
+#endif
/* Success. */
return 0;
}
-strong_alias (__feraiseexcept, feraiseexcept)
-libm_hidden_def (feraiseexcept)
+libm_hidden_def (__feraiseexcept)
+weak_alias (__feraiseexcept, feraiseexcept)
+libm_hidden_weak (feraiseexcept)