[Bug target/57260] Generated R_MIPS_GOT_MIPS relocation for direct function call while compiling with -O2 on MIPS N64

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon May 13 09:15:00 GMT 2013


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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |normal

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #3)
> Looks like sibcalls are incorrectly done.

Or maybe not since it is no longer a call but rather a sibcall which means it
can never be using call16 here since it is not a real call. 

Smallest testcase:
int shouldbecall16(void);
int g(void) { return shouldbecall16(); }
---- CUT ---

        lui     $3,%hi(%neg(%gp_rel(g)))
        daddu   $3,$3,$25
        daddiu  $3,$3,%lo(%neg(%gp_rel(g)))
        ld      $25,%got_disp(shouldbecall16)($3)
        .reloc  1f,R_MIPS_JALR,shouldbecall16
1:      jr      $25
        nop


Notice it is a jr rather than a jalr.

I think this is correct behavior either way really.  I think Xorg's sources are
depending on undefined behavior dealing with undefined symbols.



More information about the Gcc-bugs mailing list