about summary refs log tree commit diff
path: root/sysdeps/generic
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2014-12-31 22:07:52 +0000
committerJoseph Myers <joseph@codesourcery.com>2014-12-31 22:07:52 +0000
commit73a268c75996b92e4a5e72bf9fdf6adc20390614 (patch)
treef3b158beef9b1494dfd26e2e7113218c74161d01 /sysdeps/generic
parent0bd956720c457ff054325b48f26ac7c91cb060e8 (diff)
downloadglibc-73a268c75996b92e4a5e72bf9fdf6adc20390614.tar.gz
glibc-73a268c75996b92e4a5e72bf9fdf6adc20390614.tar.xz
glibc-73a268c75996b92e4a5e72bf9fdf6adc20390614.zip
Fix libm fegetenv namespace (bug 17748).
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.
Diffstat (limited to 'sysdeps/generic')
-rw-r--r--sysdeps/generic/math_private.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/sysdeps/generic/math_private.h b/sysdeps/generic/math_private.h
index 94c1e4a192..2b07f20a6f 100644
--- a/sysdeps/generic/math_private.h
+++ b/sysdeps/generic/math_private.h
@@ -598,7 +598,7 @@ libc_feholdsetround_ctx (struct rm_ctx *ctx, int round)
   if (__glibc_unlikely (round != get_rounding_mode ()))
     {
       ctx->updated_status = true;
-      fegetenv (&ctx->env);
+      __fegetenv (&ctx->env);
       fesetround (round);
     }
 }
@@ -615,7 +615,7 @@ static __always_inline void
 libc_feholdsetround_noex_ctx (struct rm_ctx *ctx, int round)
 {
   /* Save exception flags and rounding mode.  */
-  fegetenv (&ctx->env);
+  __fegetenv (&ctx->env);
 
   /* Update rounding mode only if different.  */
   if (__glibc_unlikely (round != get_rounding_mode ()))