2002-09-29 H.J. Lu <hjl@gnu.org>
authorH.J. Lu <hjl.tools@gmail.com>
Mon, 30 Sep 2002 06:32:00 +0000 (06:32 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Mon, 30 Sep 2002 06:32:00 +0000 (06:32 +0000)
* config/tc-mips.c (md_apply_fix3): Subtract the symbol value
twice if howto->pcrel_offset is true.

gas/ChangeLog
gas/config/tc-mips.c

index cf754ab3a6fca8e792863213c50ab1a44546357a..13ed1e8545aeb4640ef77c442398b1bf0435ec86 100644 (file)
@@ -1,3 +1,8 @@
+2002-09-29  H.J. Lu <hjl@gnu.org>
+
+       * config/tc-mips.c (md_apply_fix3): Subtract the symbol value
+       twice if howto->pcrel_offset is true.
+
 2002-09-28  Matt Thomas  <matt@3am-software.com>
             Jason Thorpe  <thorpej@wasabisystems.com>
 
index 6d0c13f3d261a561ebf63ef06f1040ddffade0de..7c8be079a6075a58fcefc3e493042f4b554e69b4 100644 (file)
@@ -10754,11 +10754,23 @@ md_apply_fix3 (fixP, valP, seg)
          value -= symval;
 
          howto = bfd_reloc_type_lookup (stdoutput, fixP->fx_r_type);
-         if (value != 0 && howto->partial_inplace && ! fixP->fx_pcrel)
+         if (value != 0 && howto->partial_inplace
+             && (! fixP->fx_pcrel || howto->pcrel_offset))
            {
              /* In this case, the bfd_install_relocation routine will
                 incorrectly add the symbol value back in.  We just want
-                the addend to appear in the object file.  */
+                the addend to appear in the object file.
+                
+                howto->pcrel_offset is added for R_MIPS_PC16, which is
+                generated for code like
+                
+                       globl g1 .text
+                       .text
+                       .space 20
+                g1:
+                x:
+                       bal g1
+              */
              value -= symval;
 
              /* Make sure the addend is still non-zero.  If it became zero