This is the mail archive of the gcc@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]

Re: Where is the splitting of MIPS %hi and %lo relocations handled?


Ian Lance Taylor wrote:
David Daney <ddaney@avtrex.com> writes:


Ian Lance Taylor wrote:

David Daney <ddaney@avtrex.com> writes:


I am going to try to fix:

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

Which is a problem where a %lo relocation gets separated from its
corresponding %hi.

What is the mechanism that tries to prevent this from happening?  And
where is it implemented?

This implemented by having the assembler sort the relocations so that each %lo relocations follows the appropriate set of %hi relocations. It is implemented in gas/config/tc-mips.c in append_insn. Look for reloc_needs_lo_p and mips_frob_file. At first glance the assembler does appear to handle %got correctly, so I'm not sure why it is failing for you.

Did you look at the assembly fragment in the PR?


Is it correct in that there is a pair of %got/%lo in the middle of
another %got/%lo pair?


Sure, why not?  They can be disambiguated by looking at which symbol
the %got/%lo applies to.  That is just what the assembler reloc
sorting implements in mips_frob_file.  (Or, at least, is supposed to
implement, though apparently something is going wrong in your case.)
The assembler sorts the relocations so that the linker always see the
%lo reloc immediately after the corresponding %got reloc(s).

OK, thanks.


I will look at the assembler. It will not be the first binutils bug that has affected the MIPS GCC.

David Daney


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