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/57260] Generated R_MIPS_GOT_MIPS relocation for direct function call while compiling with -O2 on MIPS N64


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

rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2013-05-14
                 CC|                            |rsandifo at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |rsandifo at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #10 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
Confirmed.

As discusseded on the binutils list, this is definitely a bug IMO.
It's a QoI requirement that we use lazy binding for direct calls.
I don't think I'd realised quite how important that is when
I implemented sibling calls for PIC way back when.

As for why GCC is using %got_disp for sibling calls: the problem
is that lazy-binding stubs require $gp to be valid on entry.
And $gp is call-saved on n32 and n64, so functions must restore
the _caller's_ value of $gp before returning from a function.
This means that $gp might hold the wrong value on entry to a
sibcalled stub.

I think the fix is simply to disable direct sibling calls for
n32 and n64 non-PLT abicalls.  (o32 is OK, because $gp is call-clobbered
there.)  It's unfortunate that we lose optimisation for a once-per-run
thing, but I don't think there's any alternative.


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