[PATCH] Gas fixes for BFD_RELOC_MIPS16_LO16 relocations

Maciej W. Rozycki macro@mips.com
Thu Mar 17 19:19:00 GMT 2005


Hello,

 We've discovered two problems with recently added BFD_RELOC_MIPS16_LO16 
relocations:

1. Relocation adjustment in mergeable sections is not inhibited which 
   makes them not pair with their corresponding BFD_RELOC_MIPS16_HI16_S 
   ones.

2. Matching with the corresponding BFD_RELOC_MIPS16_HI16_S relocations is 
   not enabled.

These relocations should behave like BFD_RELOC_LO16 ones in these cases.

 The following fix has been tested successfully with the HEAD for the 
"mips64-linux-gnu", "mipsel-linux-gnu", "mips64el-elf" and "mips64-elf" 
targets with no regressions.

2005-03-17  Maciej W. Rozycki  <macro@mips.com>

	* config/tc-mips.c (mips_frob_file): Sort BFD_RELOC_MIPS16_LO16
	relocations correctly as well.
	(mips_fix_adjustable): Don't make BFD_RELOC_MIPS16_LO16
	relocations in mergeable sections section-relative either.

 OK to apply?  As it's a bug fix -- OK for 2.16, too?

  Maciej

binutils-2.16.90-20050317-mips16-hilo-fix.patch
diff -up --recursive --new-file binutils-2.16.90-20050317.macro/gas/config/tc-mips.c binutils-2.16.90-20050317/gas/config/tc-mips.c
--- binutils-2.16.90-20050317.macro/gas/config/tc-mips.c	2005-03-17 11:29:25.000000000 +0000
+++ binutils-2.16.90-20050317/gas/config/tc-mips.c	2005-03-17 13:25:27.000000000 +0000
@@ -10748,7 +10748,8 @@ mips_frob_file (void)
 	  if (*pos == l->fixp)
 	    hi_pos = pos;
 
-	  if ((*pos)->fx_r_type == BFD_RELOC_LO16
+	  if (((*pos)->fx_r_type == BFD_RELOC_LO16
+	       || (*pos)->fx_r_type == BFD_RELOC_MIPS16_LO16)
 	      && (*pos)->fx_addsy == l->fixp->fx_addsy
 	      && (*pos)->fx_offset >= l->fixp->fx_offset
 	      && (lo_pos == NULL
@@ -12689,7 +12690,9 @@ mips_fix_adjustable (fixS *fixp)
      placed anywhere.  Rather than break backwards compatibility by changing
      this, it seems better not to force the issue, and instead keep the
      original symbol.  This will work with either linker behavior.  */
-  if ((fixp->fx_r_type == BFD_RELOC_LO16 || reloc_needs_lo_p (fixp->fx_r_type))
+  if ((fixp->fx_r_type == BFD_RELOC_LO16
+       || fixp->fx_r_type == BFD_RELOC_MIPS16_LO16
+       || reloc_needs_lo_p (fixp->fx_r_type))
       && HAVE_IN_PLACE_ADDENDS
       && (S_GET_SEGMENT (fixp->fx_addsy)->flags & SEC_MERGE) != 0)
     return 0;



More information about the Binutils mailing list