http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19520
--- Comment #29 from H.J. Lu <hjl.tools at gmail dot com> 2012-01-19 18:29:39 UTC --- (In reply to comment #28) > 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 It only applies when we take an address of a protected function. Branch to a protected function doesn't need to go through PLT.