This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug target/51643] Incorrect code produced for tail-call of weak function with -O2/-O3 option


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51643

--- Comment #14 from Richard Earnshaw <rearnsha at gcc dot gnu.org> 2011-12-22 23:27:29 UTC ---
Because the ABI says it only works for bare metal.

On a system with shared libraries, you can't tell at static link time if a weak
symbol will be resolved by a shared library, so it has to left up to the
dynamic linker which will fill in a PLT stub.  Once you have those, it's pretty
hard to make the call become a stub (and even if it were, it wouldn't be a NOP
(the linker would have to turn the call into something that simply returned as
the PLT sequence can't be patched).  Tail-calling PLT sequences is perfectly
safe, so there's no reason not to perform the optimization.


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