RFA: A small mips gas patch

H. J. Lu hjl@lucon.org
Tue May 6 00:29:00 GMT 2003


On Mon, May 05, 2003 at 05:10:28PM -0700, Eric Christopher wrote:
> 
> > 
> > It will be subtracted twice only if howto->partial_inplace is true. In
> > md_apply_fix3, there are
> > 
> > 	value -= symval;
> > 	howto = bfd_reloc_type_lookup (stdoutput, fixP->fx_r_type);
> > 	if (value != 0 && howto && howto->partial_inplace
> > 				   ^^^^^^^^^^^^^^^^^^^^^
> > 	    && (! fixP->fx_pcrel || howto->pcrel_offset))
> > 	  {
> > 	    ...
> > 	    value -= symval;
> > 	    ...
> > 	  }
> > 
> > If howto->partial_inplace is false, it will be only subtracted once.
> > Did I miss something here?
> 
> Nope. I did.
> 

This is what I checked in.

Thanks.

2003-05-05  H.J. Lu <hjl@gnu.org>

	* config/tc-mips.c (tc_gen_reloc): Add addend just once if
	howto->partial_inplace is false.

--- config/tc-mips.c.orig	Mon Apr 28 09:49:27 2003
+++ config/tc-mips.c	Mon May  5 17:18:17 2003
@@ -13931,7 +13931,15 @@ tc_gen_reloc (section, fixp)
       && (code == BFD_RELOC_GPREL16 || code == BFD_RELOC_MIPS16_GPREL)
       && reloc->addend != 0
       && mips_need_elf_addend_fixup (fixp))
-    reloc->addend += S_GET_VALUE (fixp->fx_addsy);
+    {
+      /* If howto->partial_inplace is false, md_apply_fix3 will only
+	 subtract it once.  */
+      reloc_howto_type *howto;
+
+      howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
+      if (howto->partial_inplace)
+	reloc->addend += S_GET_VALUE (fixp->fx_addsy);
+    }
 #endif
 
   /* To support a PC relative reloc when generating embedded PIC code



More information about the Binutils mailing list