This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v2 1/3] Cleanup __ieee754_sqrt(f/l)
Another observation on the use of -fno-math-errno for building libm:
ldbl-opt configurations build libnldbl_nonshared.a, a library of wrappers
such as nldbl-sqrt.c:
#include "nldbl-compat.h"
double
attribute_hidden
sqrtl (double x)
{
return sqrt (x);
}
These are intended for use with compilers that are (a) using 64-bit long
double in such a configuration and (b) do not support asm redirection, so
that a call to sqrtl actually ends up calling sqrtl in the object file and
so needs such a wrapper to end up calling the double function (whereas
with asm redirection support, math.h arranges for long double function
calls to be redirected to call the double functions). Thus, this sqrtl
wrapper needs to call the public sqrt function, both without inlining that
assumes no-math-errno and without any redirection of either sqrtl or sqrt
to corresponding __ieee754_* names. So it needs to disable redirection,
*and* the whole of libnldbl_nonshared.a needs to be built with
-fmath-errno because it's meant to be calling public errno-setting
functions. And when other libm functions such as floor get redirection,
the libnldbl_nonshared.a versions of those need to disable it as well (not
because of any errno setting issues, but because nldbl-floor.c needs to
provide the public symbol floorl, and to call the symbol floor, if not
inlined, rather than the symbol __floor which is not exported from
libm.so).
(It may be that we should declare support for asm redirection a required
feature for compilers used with installed glibc headers, which would both
allow some header cleanup and allow removing libnldbl_nonshared.a - I
think it makes sense to have an official list of required compiler
features, beyond C90/C++98, and to include this on that list, and suspect
that actually compilers without asm redirection support already don't work
with installed headers, generally or in this particular case. But while
we haven't declared that a required feature, certain libm changes need to
allow for libnldbl_nonshared.a.)
--
Joseph S. Myers
joseph@codesourcery.com