This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/19520] protected function pointer doesn't work right
- From: "hjl.tools at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 19 Jan 2012 18:29:39 +0000
- Subject: [Bug target/19520] protected function pointer doesn't work right
- Auto-submitted: auto-generated
- References: <bug-19520-4@http.gcc.gnu.org/bugzilla/>
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.