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:
> GLIBC uses non-standard names internally for math calls. As a result
> even basic functions like sqrt and fabs are not inlined by default.
> I recently posted patches to inline sqrt and fabs. In order for this to work
> in cases GCC doesn't inline, asm redirects and conditional defines
> are needed.
> 
> 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.
> 
> It seems much cleaner to do it this way, so my question is, are there
> any issues with this approach? 

Yes, you would need to post-process libc.so to change protected
visibility to default, otherwise LLD will fail to link non-PIE
executables that need PLT slots for such protected functions.  Their
position is that otherwise those functions may have two different addresses:
from the point of view of libc.so (the address of the implementation)
and any other loaded module (the address of the PLT slot in the executable),
and the linker should not allow that by default.

https://bugs.llvm.org/show_bug.cgi?id=32425

Alexander


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