This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Clean up powerpc fegetround / __fegetround inlines
- From: Adhemerval Zanella <azanella at linux dot vnet dot ibm dot com>
- To: libc-alpha at sourceware dot org
- Date: Wed, 31 Dec 2014 16:59:29 -0200
- Subject: Re: Clean up powerpc fegetround / __fegetround inlines
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot DEB dot 2 dot 10 dot 1412301944240 dot 17381 at digraph dot polyomino dot org dot uk>
On 30-12-2014 17:45, Joseph Myers wrote:
> 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.)
LGTM, I checked on powerpc64 and powerpc64le and saw no regressions. Thanks!