This is the mail archive of the libc-alpha@sourceware.org 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: [RFC] Using protected for math symbols


On Fri, 29 Sep 2017, Wilco Dijkstra wrote:

> An alternative approach to this is to completely remove the __sqrt
> variants and use protected symbol visibility. This means math functions
> are defined using their real name, internal calls use the real name and
> don't generate PLT calls, and no more weak/redirect magic is needed.

Protected visibility is best avoided in general.

https://www.airs.com/blog/archives/307

> -__sqrt (double x)
> +sqrt (double x)
>  {
>    if (__builtin_expect (isless (x, 0.0), 0) && _LIB_VERSION != _IEEE_)
>      return __kernel_standard (x, x, 26); /* sqrt(negative) */
>  
>    return __ieee754_sqrt (x);
>  }
> -libm_alias_double (__sqrt, sqrt)

Having names such as __sqrt is convenient even if they aren't called 
anywhere, as it allows libm_alias_double to be used as a uniform way of 
getting sqrt, sqrtl (in long double = double case), sqrtl compat symbol 
(in case where long double used to = double), sqrtf64 (in future) and 
sqrtf32x (in future) all defined at once.

-- 
Joseph S. Myers
joseph@codesourcery.com


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