This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Use floor functions not __floor functions in glibc libm
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Wilco Dijkstra <Wilco dot Dijkstra at arm dot com>
- Cc: nd <nd at arm dot com>, "libc-alpha at sourceware dot org" <libc-alpha at sourceware dot org>
- Date: Mon, 17 Sep 2018 21:14:38 +0000
- Subject: Re: Use floor functions not __floor functions in glibc libm
- References: <HE1PR08MB1035234F4C64C1263009541B83190@HE1PR08MB1035.eurprd08.prod.outlook.com>
On Fri, 14 Sep 2018, Wilco Dijkstra wrote:
> Looks great, thanks for doing this! The more general mechanism means
> it should be much easier to do this for the remaining functions. Yes it
> sounds like a good idea to do this for copysign too.
One thing to consider is whether we actually need this mechanism for these
functions after all, or whether we can use libm_hidden_proto /
libm_hidden_def instead.
Using this mechanism actually results in smaller and simpler patches (even
if it looks like a lot of floor etc. implementations are getting changed),
because only C implementations of the functions need to get
NO_MATH_REDIRECT added, whereas .S implementations would also need to get
libm_hidden_def added (and handling libm_hidden_* may also be more
complicated in IFUNC cases than simply disabling the redirection with
NO_MATH_REDIRECT is). For sqrt, the special mechanism is needed because,
for static linking (when libm_hidden_proto / libm_hidden_def does
nothing), we still want non-inlined calls to go to __ieee754_sqrt, not
through the wrapper that sets errno. But for the other functions, there
are no wrappers and no reason to add such wrappers (although in principle
if we do something like this for lrint or fma, while those don't have
wrappers at present there are also open bugs for missing errno setting for
those functions).
If you use libm_hidden_*, you need to consider namespace issues for static
linking. Those certainly don't apply for floor or ceil because those are
C90 functions. For rint / round / trunc you'd need to be more careful
about any uses from C90 functions (and the possibility that someone might
want to add such a use in future and run into namespace difficulties, even
if there aren't such uses at present). (In theory that applies for
copysign as well and there are even __copysign uses from C90 functions at
present in glibc - but copysign functions are in fact always inlined
except for some IBM long double cases, and long double libm functions were
only added in C99, so there wouldn't actually be namespace issues from
using libm_hidden_* for copysign functions (although also being in libc
complicates things there).)
--
Joseph S. Myers
joseph@codesourcery.com