This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Clean up powerpc fegetround / __fegetround inlines

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!

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]