glibc/sysdeps
Joseph Myers 4a3d39994e Clean up powerpc fegetround / __fegetround inlines.
The natural fix for some linknamespace test failures, where C90 libm
functions call C99 <fenv.h> functions, is to make fe* into weak
aliases for __fe* and call __fe* from within libm as needed.

To do this, the __fe* names need to be available for that purpose -
that is, they must not be used for something other than aliases of
fe*.  On powerpc, however, __fegetround is an inline function in
fenv_libc.h, with no corresponding fegetround inline function;
fegetround has an equivalent macro expansion in bits/fenvinline.h, but
that is disabled if __NO_MATH_INLINES (which is defined for building
libm).

I see no need for that disabling; it's not even clear that
__NO_MATH_INLINES should affect <fenv.h>, and the results of
fegetround are completely defined so there is no semantic effect of
that disabling at all outside glibc.  The x86 inline feraiseexcept is
conditioned on __USE_EXTERN_INLINES not __NO_MATH_INLINES (but that's
an inline function rather than a macro).

This patch removes the __NO_MATH_INLINES conditional on that
fegetround macro, so resulting in it being expanded inline inside
glibc.  In turn, this means that direct calls to __fegetround from C99
functions in ldbl-128ibm can be changed to calls to fegetround, so
that nofpu fenv_libc.h files don't need to define __fegetround at all
and, by changing ldbl-128ibm files to use <fenv.h> not <fenv_libc.h>,
non-e500 nofpu no longer needs an fenv_libc.h file.

The other macros in fenvinline.h are left conditional on
__NO_MATH_INLINES, although since the only case where this should make
a difference is one involving undefined behavior (if the argument to
the function is not a valid exception macro).

The out-of-line definition for fegetround uses __fegetround (the
inline function removed by this patch).  So this continues to work,
the fenvinline.h header is made to define __fegetround, and then to
define fegetround to call __fegetround.

Tested for powerpc32 (hard float) that installed stripped shared
libraries are unchanged by this patch; also tested that powerpc-nofpu
build still works.  (This patch does not itself fix any bugs; it
simply cleans things up in preparation for separate bug fixes.)

	* sysdeps/powerpc/bits/fenvinline.h (fegetround): Rename macro to
	__fegetround and redefine to call __fegetround.  Remove condition
	on [!__NO_MATH_INLINES].
	* sysdeps/powerpc/fpu/fenv_libc.h (__fegetround): Remove inline
	function.
	* sysdeps/powerpc/nofpu/fenv_libc.h: Remove file.
	* sysdeps/powerpc/powerpc32/e500/nofpu/fenv_libc.h (__fegetround):
	Remove macro.
	* sysdeps/ieee754/ldbl-128ibm/s_llrintl.c: Include <fenv.h>
	instead of <fenv_libc.h>.
	(__llrintl): Call fegetround instead of __fegetround.
	* sysdeps/ieee754/ldbl-128ibm/s_llroundl.c: Include <fenv.h>
	instead of <fenv_libc.h>.
	* sysdeps/ieee754/ldbl-128ibm/s_lrintl.c: Likewise.
	(__lrintl): Call fegetround instead of __fegetround.
	* sysdeps/ieee754/ldbl-128ibm/s_lroundl.c: Include <fenv.h>
	instead of <fenv_libc.h>.
	* sysdeps/ieee754/ldbl-128ibm/s_rintl.c: Likewise.
	(__rintl): Call fegetround instead of __fegetround.
2014-12-31 19:16:34 +00:00
..
aarch64 Fix libm feraiseexcept namespace (bug 17723). 2014-12-30 17:08:09 +00:00
alpha Fix libm feraiseexcept namespace (bug 17723). 2014-12-30 17:08:09 +00:00
arm Fix libm feraiseexcept namespace (bug 17723). 2014-12-30 17:08:09 +00:00
generic Add hidden __tls_get_addr/___tls_get_addr alias 2014-12-21 09:27:11 -08:00
gnu Use PTR_MANGLE on libgcc unwinder function pointers. 2014-12-16 15:47:53 -08:00
hppa Fix libm feraiseexcept namespace (bug 17723). 2014-12-30 17:08:09 +00:00
i386 Don't check PI_STATIC_AND_HIDDEN in i386 dl-machine.h 2014-12-30 14:31:58 -08:00
ia64 Fix libm feraiseexcept namespace (bug 17723). 2014-12-30 17:08:09 +00:00
ieee754 Clean up powerpc fegetround / __fegetround inlines. 2014-12-31 19:16:34 +00:00
init_array Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
m68k Fix libm feraiseexcept namespace (bug 17723). 2014-12-30 17:08:09 +00:00
mach Fix resolver if_* namespace (bug 17717). 2014-12-16 18:18:49 +00:00
microblaze Fix libm feraiseexcept namespace (bug 17723). 2014-12-30 17:08:09 +00:00
mips Fix libm feraiseexcept namespace (bug 17723). 2014-12-30 17:08:09 +00:00
nptl NPTL: Move fork state variables to initializer files. 2014-12-17 14:33:28 -08:00
posix Use posix-conf-vars.list to generate spec array 2014-12-29 19:56:27 +05:30
powerpc Clean up powerpc fegetround / __fegetround inlines. 2014-12-31 19:16:34 +00:00
pthread Replace %ld with %jd and cast to intmax_t 2014-12-30 08:09:06 -08:00
s390 Fix libm feraiseexcept namespace (bug 17723). 2014-12-30 17:08:09 +00:00
sh Fix libm feraiseexcept namespace (bug 17723). 2014-12-30 17:08:09 +00:00
sparc Fix libm feraiseexcept namespace (bug 17723). 2014-12-30 17:08:09 +00:00
tile Fix libm feraiseexcept namespace (bug 17723). 2014-12-30 17:08:09 +00:00
unix i386: Fix build by GCC 5.0 2014-12-30 11:37:41 -08:00
wordsize-32 Remove NOT_IN_libc 2014-11-24 15:03:45 +05:30
wordsize-64 Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
x86 Fix libm feraiseexcept namespace (bug 17723). 2014-12-30 17:08:09 +00:00
x86_64 Fix libm feraiseexcept namespace (bug 17723). 2014-12-30 17:08:09 +00:00