Patch to improve MIPS %hi/%lo matching

Richard Sandiford rsandifo@redhat.com
Sat Jul 3 15:09:00 GMT 2004


Thiemo Seufer <ica2_ts@csv.ica.uni-stuttgart.de> writes:
> Richard Sandiford wrote:
> [snip]
>> 	* config/tc-mips.c (HAVE_IN_PLACE_ADDENDS): New macro.
>> 	(reloc_needs_lo_p): Only return true if HAVE_IN_PLACE_ADDENDS.
>> 	(mips_frob_file): Rework so that only a single pass through the
>> 	relocs is needed.  Allow %lo()s to have higher offsets than their
>> 	corresponding %hi()s or %got()s.
>> 
>> testsuite/
>> 	* gas/mips/elf{,el}-rel.d: Adjust so that the earliest %hi() matches
>> 	the earliest %lo().
>> 	* gas/mips/elf-rel9.[sd]: Fix typo in %lo() expression.
>> 	* gas/mips/elf-rel11.d: Don't expect the relocs to be reordered.
>> 	* gas/mips/elf-rel20.[sd]: New test.
>> 	* gas/mips/mips.exp: Run it.
>
> Ok.

Thanks.

>> !       /* If we found a match, remove the high-part relocation from its
>> ! 	 current position and insert it before the low-part relocation.
>> ! 	 Make the offsets match so that fixup_has_matching_lo_p()
>> ! 	 will return true.
>> ! 
>> ! 	 We don't warn about unmatched high-part relocations since some
>> ! 	 versions of gcc have been known to emit dead "lui ...%hi(...)"
>> ! 	 instructions.  */
>
> Which versions of gcc exactly? Or is the "have been known" part
> actually true? :-)

Good question ;)  That was really just a rewording of:

#if 0 /* GCC code motion plus incomplete dead code elimination
	 can leave a %hi without a %lo.  */
	  if (pass == 1)
	    as_warn_where (l->fixp->fx_file, l->fixp->fx_line,
			   _("Unmatched %%hi reloc"));
#endif

but I've no idea which version it applies to.  I certainly _hope_
modern gccs aren't affected...

Richard



More information about the Binutils mailing list