diff options
author | Joseph Myers <joseph@codesourcery.com> | 2015-01-07 00:41:23 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2015-01-07 00:41:23 +0000 |
commit | 01238691bb03f0110455b663439eecf9a58c8f83 (patch) | |
tree | 8d113f83a27b4a5ecb08de1a6fff7f2b6e2be6e6 /sysdeps | |
parent | cd42798aef204592b0165bcfacef975ff3ce2973 (diff) | |
download | glibc-01238691bb03f0110455b663439eecf9a58c8f83.tar.gz |
Fix libm fesetround namespace (bug 17748).
Continuing the fixes for C90 libm functions calling C99 fe* functions,
this patch fixes the case of fesetround by making it a weak alias of
__fesetround and making the affected code call __fesetround. An
existing __fesetround function in fenv_libc.h for powerpc is renamed
to __fesetround_inline.
Tested for x86_64 (testsuite, and that disassembly of installed shared
libraries is unchanged by the patch). Also tested for ARM
(soft-float) that fesetround failures disappear from the linknamespace
test results (feupdateenv remains to be addressed to complete fixing
bug 17748).
[BZ #17748]
* include/fenv.h (__fesetround): Declare. Use libm_hidden_proto.
* math/fesetround.c (fesetround): Rename to __fesetround and
define as weak alias of __fesetround. Use libm_hidden_weak.
* sysdeps/aarch64/fpu/fesetround.c (fesetround): Likewise.
* sysdeps/alpha/fpu/fesetround.c (fesetround): Likewise.
* sysdeps/arm/fesetround.c (fesetround): Likewise.
* sysdeps/hppa/fpu/fesetround.c (fesetround): Likewise.
* sysdeps/i386/fpu/fesetround.c (fesetround): Likewise.
* sysdeps/ia64/fpu/fesetround.c (fesetround): Likewise.
* sysdeps/m68k/fpu/fesetround.c (fesetround): Likewise.
* sysdeps/mips/fpu/fesetround.c (fesetround): Likewise.
* sysdeps/powerpc/fpu/fenv_libc.h (__fesetround): Rename to
__fesetround_inline.
* sysdeps/powerpc/fpu/fenv_private.h (libc_fesetround_ppc): Call
__fesetround_inline instead of __fesetround.
* sysdeps/powerpc/fpu/fesetround.c (fesetround): Rename to
__fesetround and define as weak alias of __fesetround. Use
libm_hidden_weak. Call __fesetround_inline instead of
__fesetround.
* sysdeps/powerpc/nofpu/fesetround.c (fesetround): Rename to
__fesetround and define as weak alias of __fesetround. Use
libm_hidden_weak.
* sysdeps/powerpc/powerpc32/e500/nofpu/fesetround.c (fesetround):
Likewise.
* sysdeps/s390/fpu/fesetround.c (fesetround): Likewise.
* sysdeps/sh/sh4/fpu/fesetround.c (fesetround): Likewise.
* sysdeps/sparc/fpu/fesetround.c (fesetround): Likewise.
* sysdeps/tile/math_private.h (__fesetround): New inline function.
* sysdeps/x86_64/fpu/fesetround.c (fesetround): Rename to
__fesetround and define as weak alias of __fesetround. Use
libm_hidden_weak.
* sysdeps/generic/math_private.h (default_libc_fesetround): Call
__fesetround instead of fesetround.
(default_libc_feholdexcept_setround): Likewise.
(libc_feholdsetround_ctx): Likewise.
(libc_feholdsetround_noex_ctx): Likewise.
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/aarch64/fpu/fesetround.c | 6 | ||||
-rw-r--r-- | sysdeps/alpha/fpu/fesetround.c | 6 | ||||
-rw-r--r-- | sysdeps/arm/fesetround.c | 6 | ||||
-rw-r--r-- | sysdeps/generic/math_private.h | 8 | ||||
-rw-r--r-- | sysdeps/hppa/fpu/fesetround.c | 6 | ||||
-rw-r--r-- | sysdeps/i386/fpu/fesetround.c | 6 | ||||
-rw-r--r-- | sysdeps/ia64/fpu/fesetround.c | 6 | ||||
-rw-r--r-- | sysdeps/m68k/fpu/fesetround.c | 6 | ||||
-rw-r--r-- | sysdeps/mips/fpu/fesetround.c | 6 | ||||
-rw-r--r-- | sysdeps/powerpc/fpu/fenv_libc.h | 2 | ||||
-rw-r--r-- | sysdeps/powerpc/fpu/fenv_private.h | 2 | ||||
-rw-r--r-- | sysdeps/powerpc/fpu/fesetround.c | 8 | ||||
-rw-r--r-- | sysdeps/powerpc/nofpu/fesetround.c | 6 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc32/e500/nofpu/fesetround.c | 6 | ||||
-rw-r--r-- | sysdeps/s390/fpu/fesetround.c | 6 | ||||
-rw-r--r-- | sysdeps/sh/sh4/fpu/fesetround.c | 6 | ||||
-rw-r--r-- | sysdeps/sparc/fpu/fesetround.c | 6 | ||||
-rw-r--r-- | sysdeps/tile/math_private.h | 1 | ||||
-rw-r--r-- | sysdeps/x86_64/fpu/fesetround.c | 6 |
19 files changed, 68 insertions, 37 deletions
diff --git a/sysdeps/aarch64/fpu/fesetround.c b/sysdeps/aarch64/fpu/fesetround.c index 915cdd3100..257dba13db 100644 --- a/sysdeps/aarch64/fpu/fesetround.c +++ b/sysdeps/aarch64/fpu/fesetround.c @@ -21,7 +21,7 @@ #include <fpu_control.h> int -fesetround (int round) +__fesetround (int round) { if (round & ~_FPU_FPCR_RM_MASK) return 1; @@ -29,4 +29,6 @@ fesetround (int round) libc_fesetround_aarch64 (round); return 0; } -libm_hidden_def (fesetround) +libm_hidden_def (__fesetround) +weak_alias (__fesetround, fesetround) +libm_hidden_weak (fesetround) diff --git a/sysdeps/alpha/fpu/fesetround.c b/sysdeps/alpha/fpu/fesetround.c index b0c8a01de7..c17b005ede 100644 --- a/sysdeps/alpha/fpu/fesetround.c +++ b/sysdeps/alpha/fpu/fesetround.c @@ -20,7 +20,7 @@ #include <fenv_libc.h> int -fesetround (int round) +__fesetround (int round) { unsigned long fpcr; @@ -39,4 +39,6 @@ fesetround (int round) return 0; } -libm_hidden_def (fesetround) +libm_hidden_def (__fesetround) +weak_alias (__fesetround, fesetround) +libm_hidden_weak (fesetround) diff --git a/sysdeps/arm/fesetround.c b/sysdeps/arm/fesetround.c index f6a7c794e4..412311c79b 100644 --- a/sysdeps/arm/fesetround.c +++ b/sysdeps/arm/fesetround.c @@ -21,7 +21,7 @@ int -fesetround (int round) +__fesetround (int round) { /* FE_TONEAREST is the only supported rounding mode if a VFP unit isn't present. */ @@ -34,4 +34,6 @@ fesetround (int round) libc_fesetround_vfp (round); return 0; } -libm_hidden_def (fesetround) +libm_hidden_def (__fesetround) +weak_alias (__fesetround, fesetround) +libm_hidden_weak (fesetround) diff --git a/sysdeps/generic/math_private.h b/sysdeps/generic/math_private.h index 3d987383e9..24e2babd61 100644 --- a/sysdeps/generic/math_private.h +++ b/sysdeps/generic/math_private.h @@ -415,7 +415,7 @@ default_libc_feholdexcept (fenv_t *e) static __always_inline void default_libc_fesetround (int r) { - (void) fesetround (r); + (void) __fesetround (r); } #ifndef libc_fesetround @@ -432,7 +432,7 @@ static __always_inline void default_libc_feholdexcept_setround (fenv_t *e, int r) { __feholdexcept (e); - fesetround (r); + __fesetround (r); } #ifndef libc_feholdexcept_setround @@ -599,7 +599,7 @@ libc_feholdsetround_ctx (struct rm_ctx *ctx, int round) { ctx->updated_status = true; __fegetenv (&ctx->env); - fesetround (round); + __fesetround (round); } } @@ -619,7 +619,7 @@ libc_feholdsetround_noex_ctx (struct rm_ctx *ctx, int round) /* Update rounding mode only if different. */ if (__glibc_unlikely (round != get_rounding_mode ())) - fesetround (round); + __fesetround (round); } static __always_inline void diff --git a/sysdeps/hppa/fpu/fesetround.c b/sysdeps/hppa/fpu/fesetround.c index 297a62a6bd..414ef9192f 100644 --- a/sysdeps/hppa/fpu/fesetround.c +++ b/sysdeps/hppa/fpu/fesetround.c @@ -20,7 +20,7 @@ #include <fenv.h> int -fesetround (int round) +__fesetround (int round) { union { unsigned long long l; unsigned int sw[2]; } s; @@ -37,4 +37,6 @@ fesetround (int round) return 0; } -libm_hidden_def (fesetround) +libm_hidden_def (__fesetround) +weak_alias (__fesetround, fesetround) +libm_hidden_weak (fesetround) diff --git a/sysdeps/i386/fpu/fesetround.c b/sysdeps/i386/fpu/fesetround.c index 3a5b7755b2..69f8b3efbd 100644 --- a/sysdeps/i386/fpu/fesetround.c +++ b/sysdeps/i386/fpu/fesetround.c @@ -23,7 +23,7 @@ #include <dl-procinfo.h> int -fesetround (int round) +__fesetround (int round) { unsigned short int cw; @@ -49,4 +49,6 @@ fesetround (int round) return 0; } -libm_hidden_def (fesetround) +libm_hidden_def (__fesetround) +weak_alias (__fesetround, fesetround) +libm_hidden_weak (fesetround) diff --git a/sysdeps/ia64/fpu/fesetround.c b/sysdeps/ia64/fpu/fesetround.c index 383e1c5b89..7fce0f7044 100644 --- a/sysdeps/ia64/fpu/fesetround.c +++ b/sysdeps/ia64/fpu/fesetround.c @@ -20,7 +20,7 @@ #include <fenv.h> int -fesetround (int round) +__fesetround (int round) { fenv_t fpsr; @@ -38,4 +38,6 @@ fesetround (int round) return 0; } -libm_hidden_def (fesetround) +libm_hidden_def (__fesetround) +weak_alias (__fesetround, fesetround) +libm_hidden_weak (fesetround) diff --git a/sysdeps/m68k/fpu/fesetround.c b/sysdeps/m68k/fpu/fesetround.c index b55ff156d4..9e6f4346c5 100644 --- a/sysdeps/m68k/fpu/fesetround.c +++ b/sysdeps/m68k/fpu/fesetround.c @@ -20,7 +20,7 @@ #include <fenv.h> int -fesetround (int round) +__fesetround (int round) { fexcept_t fpcr; @@ -35,4 +35,6 @@ fesetround (int round) return 0; } -libm_hidden_def (fesetround); +libm_hidden_def (__fesetround) +weak_alias (__fesetround, fesetround) +libm_hidden_weak (fesetround) diff --git a/sysdeps/mips/fpu/fesetround.c b/sysdeps/mips/fpu/fesetround.c index 929d373c24..61892542a3 100644 --- a/sysdeps/mips/fpu/fesetround.c +++ b/sysdeps/mips/fpu/fesetround.c @@ -21,7 +21,7 @@ #include <fpu_control.h> int -fesetround (int round) +__fesetround (int round) { fpu_control_t cw; @@ -41,4 +41,6 @@ fesetround (int round) return 0; } -libm_hidden_def (fesetround) +libm_hidden_def (__fesetround) +weak_alias (__fesetround, fesetround) +libm_hidden_weak (fesetround) diff --git a/sysdeps/powerpc/fpu/fenv_libc.h b/sysdeps/powerpc/fpu/fenv_libc.h index c52310ca2f..9118d6f4ab 100644 --- a/sysdeps/powerpc/fpu/fenv_libc.h +++ b/sysdeps/powerpc/fpu/fenv_libc.h @@ -76,7 +76,7 @@ typedef union static inline int -__fesetround (int round) +__fesetround_inline (int round) { if ((unsigned int) round < 2) { diff --git a/sysdeps/powerpc/fpu/fenv_private.h b/sysdeps/powerpc/fpu/fenv_private.h index 37f629f965..a87c95cdc9 100644 --- a/sysdeps/powerpc/fpu/fenv_private.h +++ b/sysdeps/powerpc/fpu/fenv_private.h @@ -57,7 +57,7 @@ libc_feholdexcept_ppc (fenv_t *envp) static __always_inline void libc_fesetround_ppc (int r) { - __fesetround (r); + __fesetround_inline (r); } static __always_inline void diff --git a/sysdeps/powerpc/fpu/fesetround.c b/sysdeps/powerpc/fpu/fesetround.c index 99404c9c11..2191852a36 100644 --- a/sysdeps/powerpc/fpu/fesetround.c +++ b/sysdeps/powerpc/fpu/fesetround.c @@ -21,11 +21,13 @@ #undef fesetround int -fesetround (int round) +__fesetround (int round) { if ((unsigned int) round > 3) return 1; else - return __fesetround(round); + return __fesetround_inline(round); } -libm_hidden_def (fesetround) +libm_hidden_def (__fesetround) +weak_alias (__fesetround, fesetround) +libm_hidden_weak (fesetround) diff --git a/sysdeps/powerpc/nofpu/fesetround.c b/sysdeps/powerpc/nofpu/fesetround.c index c62637f3aa..96b387deb7 100644 --- a/sysdeps/powerpc/nofpu/fesetround.c +++ b/sysdeps/powerpc/nofpu/fesetround.c @@ -21,7 +21,7 @@ #include "soft-supp.h" int -fesetround (int round) +__fesetround (int round) { if ((unsigned int) round > FE_DOWNWARD) return 1; @@ -31,4 +31,6 @@ fesetround (int round) return 0; } -libm_hidden_def (fesetround) +libm_hidden_def (__fesetround) +weak_alias (__fesetround, fesetround) +libm_hidden_weak (fesetround) diff --git a/sysdeps/powerpc/powerpc32/e500/nofpu/fesetround.c b/sysdeps/powerpc/powerpc32/e500/nofpu/fesetround.c index 64b5675411..f1e57eb47e 100644 --- a/sysdeps/powerpc/powerpc32/e500/nofpu/fesetround.c +++ b/sysdeps/powerpc/powerpc32/e500/nofpu/fesetround.c @@ -19,7 +19,7 @@ #include <fenv_libc.h> int -fesetround (int round) +__fesetround (int round) { unsigned long fpescr; @@ -32,4 +32,6 @@ fesetround (int round) return 0; } -libm_hidden_def (fesetround) +libm_hidden_def (__fesetround) +weak_alias (__fesetround, fesetround) +libm_hidden_weak (fesetround) diff --git a/sysdeps/s390/fpu/fesetround.c b/sysdeps/s390/fpu/fesetround.c index 91b1a3c753..d6eedcee00 100644 --- a/sysdeps/s390/fpu/fesetround.c +++ b/sysdeps/s390/fpu/fesetround.c @@ -21,7 +21,7 @@ #include <fpu_control.h> int -fesetround (int round) +__fesetround (int round) { if ((round|FPC_RM_MASK) != FPC_RM_MASK) { @@ -34,4 +34,6 @@ fesetround (int round) return 0; } -libm_hidden_def (fesetround) +libm_hidden_def (__fesetround) +weak_alias (__fesetround, fesetround) +libm_hidden_weak (fesetround) diff --git a/sysdeps/sh/sh4/fpu/fesetround.c b/sysdeps/sh/sh4/fpu/fesetround.c index 2f7e5f73c0..0f8213e392 100644 --- a/sysdeps/sh/sh4/fpu/fesetround.c +++ b/sysdeps/sh/sh4/fpu/fesetround.c @@ -21,7 +21,7 @@ #include <fpu_control.h> int -fesetround (int round) +__fesetround (int round) { fpu_control_t cw; @@ -40,4 +40,6 @@ fesetround (int round) return 0; } -libm_hidden_def (fesetround) +libm_hidden_def (__fesetround) +weak_alias (__fesetround, fesetround) +libm_hidden_weak (fesetround) diff --git a/sysdeps/sparc/fpu/fesetround.c b/sysdeps/sparc/fpu/fesetround.c index 1ab033a86f..b01447ca7f 100644 --- a/sysdeps/sparc/fpu/fesetround.c +++ b/sysdeps/sparc/fpu/fesetround.c @@ -19,7 +19,7 @@ #include <fenv.h> int -fesetround (int round) +__fesetround (int round) { fenv_t tmp; @@ -34,4 +34,6 @@ fesetround (int round) return 0; } -libm_hidden_def (fesetround) +libm_hidden_def (__fesetround) +weak_alias (__fesetround, fesetround) +libm_hidden_weak (fesetround) diff --git a/sysdeps/tile/math_private.h b/sysdeps/tile/math_private.h index 8ff1435f17..b06e3a321d 100644 --- a/sysdeps/tile/math_private.h +++ b/sysdeps/tile/math_private.h @@ -37,5 +37,6 @@ 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; } extern inline int fesetround (int __d) { return 0; } +extern inline int __fesetround (int __d) { return 0; } #endif diff --git a/sysdeps/x86_64/fpu/fesetround.c b/sysdeps/x86_64/fpu/fesetround.c index 9cd5d75a86..2a9c351142 100644 --- a/sysdeps/x86_64/fpu/fesetround.c +++ b/sysdeps/x86_64/fpu/fesetround.c @@ -19,7 +19,7 @@ #include <fenv.h> int -fesetround (int round) +__fesetround (int round) { unsigned short int cw; int mxcsr; @@ -43,4 +43,6 @@ fesetround (int round) return 0; } -libm_hidden_def (fesetround) +libm_hidden_def (__fesetround) +weak_alias (__fesetround, fesetround) +libm_hidden_weak (fesetround) |