mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-10 15:20:10 +00:00
73a268c759
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.
40 lines
1.7 KiB
C
40 lines
1.7 KiB
C
#ifndef _MATH_PRIVATE_H
|
|
|
|
/* Internally, we suppress any use of exception or rounding other
|
|
than what is supported by the hardware. This does mean that some
|
|
code will silently fail to report exceptions, set rounding mode
|
|
as expected, etc., but it allows math code to compile that otherwise
|
|
wouldn't (such as math/s_fma.c) and so is valuable.
|
|
|
|
We intentionally ignore the "exception" arguments of functions that
|
|
take an exception, since we can't even evaluate the argument
|
|
without causing a build failure. The extra level of statement
|
|
expression wrapping avoids "statement with no effect" warnings.
|
|
Since the callers don't check for errors anyway, we just claim
|
|
success in every case.
|
|
|
|
The overrides for libc_ functions must happen before we include
|
|
the generic math_private.h, and the overrides for regular
|
|
<fenv.h> functions must happen afterwards, to avoid clashing with
|
|
the declarations of those functions. */
|
|
|
|
#define libc_fesetround(rnd) ({ 0; })
|
|
#define libc_fetestexcept(exc) ({ 0; })
|
|
#define libc_feholdexcept_setround(env, exc) ({ (void) (env); 0; })
|
|
#define libc_feupdateenv_test(env, exc) ({ (void) (env); 0; })
|
|
|
|
#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; }
|
|
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; }
|
|
extern inline int fesetround (int __d) { return 0; }
|
|
|
|
#endif
|