From 01238691bb03f0110455b663439eecf9a58c8f83 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Wed, 7 Jan 2015 00:41:23 +0000 Subject: 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. --- sysdeps/powerpc/fpu/fenv_libc.h | 2 +- sysdeps/powerpc/fpu/fenv_private.h | 2 +- sysdeps/powerpc/fpu/fesetround.c | 8 +++++--- sysdeps/powerpc/nofpu/fesetround.c | 6 ++++-- sysdeps/powerpc/powerpc32/e500/nofpu/fesetround.c | 6 ++++-- 5 files changed, 15 insertions(+), 9 deletions(-) (limited to 'sysdeps/powerpc') diff --git a/sysdeps/powerpc/fpu/fenv_libc.h b/sysdeps/powerpc/fpu/fenv_libc.h index c52310c..9118d6f 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 37f629f..a87c95c 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 99404c9..2191852 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 c62637f..96b387d 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 64b5675..f1e57eb 100644 --- a/sysdeps/powerpc/powerpc32/e500/nofpu/fesetround.c +++ b/sysdeps/powerpc/powerpc32/e500/nofpu/fesetround.c @@ -19,7 +19,7 @@ #include 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) -- cgit v1.1