From patchwork Wed Jan 7 00:42:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 4535 Received: (qmail 3141 invoked by alias); 7 Jan 2015 00:42:20 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 3130 invoked by uid 89); 7 Jan 2015 00:42:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL, BAYES_50, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Date: Wed, 7 Jan 2015 00:42:10 +0000 From: Joseph Myers To: Subject: Fix libm fesetround namespace (bug 17748) [committed] Message-ID: User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 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). Committed. 2015-01-07 Joseph Myers [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. diff --git a/include/fenv.h b/include/fenv.h index 1f30baa..c496d10 100644 --- a/include/fenv.h +++ b/include/fenv.h @@ -15,6 +15,7 @@ extern int __fesetenv (const fenv_t *__envp); extern int __feupdateenv (const fenv_t *__envp); extern __typeof (fegetround) __fegetround; extern __typeof (feholdexcept) __feholdexcept; +extern __typeof (fesetround) __fesetround; libm_hidden_proto (feraiseexcept) libm_hidden_proto (__feraiseexcept) @@ -25,6 +26,7 @@ libm_hidden_proto (__fegetround) libm_hidden_proto (fesetenv) libm_hidden_proto (__fesetenv) libm_hidden_proto (fesetround) +libm_hidden_proto (__fesetround) libm_hidden_proto (feholdexcept) libm_hidden_proto (__feholdexcept) libm_hidden_proto (feupdateenv) diff --git a/math/fesetround.c b/math/fesetround.c index 0c11cae..52a811b 100644 --- a/math/fesetround.c +++ b/math/fesetround.c @@ -20,7 +20,7 @@ #include int -fesetround (int round) +__fesetround (int round) { #ifdef FE_TONEAREST return (round == FE_TONEAREST) ? 0 : 1; @@ -28,5 +28,7 @@ fesetround (int round) return 1; /* Signal we are unable to set the direction. */ #endif } -libm_hidden_def (fesetround) +libm_hidden_def (__fesetround) +weak_alias (__fesetround, fesetround) +libm_hidden_weak (fesetround) stub_warning (fesetround) diff --git a/sysdeps/aarch64/fpu/fesetround.c b/sysdeps/aarch64/fpu/fesetround.c index 915cdd3..257dba1 100644 --- a/sysdeps/aarch64/fpu/fesetround.c +++ b/sysdeps/aarch64/fpu/fesetround.c @@ -21,7 +21,7 @@ #include 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 b0c8a01..c17b005 100644 --- a/sysdeps/alpha/fpu/fesetround.c +++ b/sysdeps/alpha/fpu/fesetround.c @@ -20,7 +20,7 @@ #include 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 f6a7c79..412311c 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 3d98738..24e2bab 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 297a62a..414ef91 100644 --- a/sysdeps/hppa/fpu/fesetround.c +++ b/sysdeps/hppa/fpu/fesetround.c @@ -20,7 +20,7 @@ #include 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 3a5b775..69f8b3e 100644 --- a/sysdeps/i386/fpu/fesetround.c +++ b/sysdeps/i386/fpu/fesetround.c @@ -23,7 +23,7 @@ #include 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 383e1c5..7fce0f7 100644 --- a/sysdeps/ia64/fpu/fesetround.c +++ b/sysdeps/ia64/fpu/fesetround.c @@ -20,7 +20,7 @@ #include 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 b55ff15..9e6f434 100644 --- a/sysdeps/m68k/fpu/fesetround.c +++ b/sysdeps/m68k/fpu/fesetround.c @@ -20,7 +20,7 @@ #include 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 929d373..6189254 100644 --- a/sysdeps/mips/fpu/fesetround.c +++ b/sysdeps/mips/fpu/fesetround.c @@ -21,7 +21,7 @@ #include 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 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) diff --git a/sysdeps/s390/fpu/fesetround.c b/sysdeps/s390/fpu/fesetround.c index 91b1a3c..d6eedce 100644 --- a/sysdeps/s390/fpu/fesetround.c +++ b/sysdeps/s390/fpu/fesetround.c @@ -21,7 +21,7 @@ #include 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 2f7e5f7..0f8213e 100644 --- a/sysdeps/sh/sh4/fpu/fesetround.c +++ b/sysdeps/sh/sh4/fpu/fesetround.c @@ -21,7 +21,7 @@ #include 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 1ab033a..b01447c 100644 --- a/sysdeps/sparc/fpu/fesetround.c +++ b/sysdeps/sparc/fpu/fesetround.c @@ -19,7 +19,7 @@ #include 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 8ff1435..b06e3a3 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 9cd5d75..2a9c351 100644 --- a/sysdeps/x86_64/fpu/fesetround.c +++ b/sysdeps/x86_64/fpu/fesetround.c @@ -19,7 +19,7 @@ #include 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)