http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19520
Richard Guenther <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target| |x86_64-*-*, i?86-*-* CC| |hubicka at gcc dot gnu.org, | |rth at gcc dot gnu.org, | |uros at gcc dot gnu.org --- Comment #28 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-19 13:36:28 UTC --- Final conclusion: We need to resolve to the executables PLT consistently, even from inside the shared object where the function binds locally. This is because of references to the function from the executables .rodata section which we can't relocate (and thus have to point to the executables PLT entry). Thus, this is a GCC target bug. __attribute__((visibility("protected"))) void * foo () { return foo; } needs to return the address of foo via a load from the GOT. HJs patch isn't correct as this is really a target ABI choice (another ABI may choose to resolve all references to the functions start address with the cost of having to put the constants into a .rel.rodata section).