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

Oleg Endo <olegendo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kkojima at gcc dot gnu.org

--- Comment #1 from Oleg Endo <olegendo at gcc dot gnu.org> ---
In sh.c, above the function 'sh_function_ok_for_sibcall', which implements
TARGET_FUNCTION_OK_FOR_SIBCALL there is a comment:

/* If PIC, we cannot make sibling calls to global functions
   because the PLT requires r12 to be live.  */

PLT entries use r12 and expect it to be a valid GOT pointer.
Because r12 must be preserved across function calls, it will have to be
restored before doing the tail call, like

    ...
    braf
    mov.l   @r15+,r12

If the PIC function was invoked by a non-PIC function, the contents of r12
might not be necessarily a valid GOT pointer.

Kaz, could you please confirm or refute this?

Reply via email to