]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* config/tc-i386.c (md_assemble): Set fx_pcrel_adjust to size of
authorAndreas Schwab <schwab@linux-m68k.org>
Wed, 27 Mar 2002 16:20:41 +0000 (16:20 +0000)
committerAndreas Schwab <schwab@linux-m68k.org>
Wed, 27 Mar 2002 16:20:41 +0000 (16:20 +0000)
field for pc-relative fixups.
(md_estimate_size_before_relax): Likewise.
(tc_gen_reloc): Subtract fx_pcrel_adjust instead of fx_size for
pc-relative fixups in 64bit mode.

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

index cd0abbb63316cc958fec748a8c2cc06cae3338f8..9a720f56ecb8931cb4a8cff92dee3b6ec1cb5626 100644 (file)
@@ -1,3 +1,11 @@
+2002-03-27  Andreas Schwab  <schwab@suse.de>
+
+       * config/tc-i386.c (md_assemble): Set fx_pcrel_adjust to size of
+       field for pc-relative fixups.
+       (md_estimate_size_before_relax): Likewise.
+       (tc_gen_reloc): Subtract fx_pcrel_adjust instead of fx_size for
+       pc-relative fixups in 64bit mode.
+
 2002-03-20  Albert Chin-A-Young  <china@thewrittenword.com>
 
        * config/tc-arm.c (vfp_dp_reg_required_here): Fix typo
index 2b82037a8ba5ffc97cb09bc20f1a868090472505..ede47f97c9fa3f4452a4ad615e7a57078dc28594 100644 (file)
@@ -2817,6 +2817,7 @@ md_assemble (line)
     else if (i.tm.opcode_modifier & (JumpByte | JumpDword))
       {
        int size;
+       fixS *fixP;
 
        if (i.tm.opcode_modifier & JumpByte)
          {
@@ -2867,8 +2868,9 @@ md_assemble (line)
        p = frag_more (1 + size);
        *p++ = i.tm.base_opcode;
 
-       fix_new_exp (frag_now, p - frag_now->fr_literal, size,
-                    i.op[0].disps, 1, reloc (size, 1, 1, i.reloc[0]));
+       fixP = fix_new_exp (frag_now, p - frag_now->fr_literal, size,
+                           i.op[0].disps, 1, reloc (size, 1, 1, i.reloc[0]));
+       fixP->fx_pcrel_adjust = size;
       }
     else if (i.tm.opcode_modifier & JumpInterSegment)
       {
@@ -3024,6 +3026,7 @@ md_assemble (line)
                        int size = 4;
                        int sign = 0;
                        int pcrel = (i.flags[n] & Operand_PCrel) != 0;
+                       fixS *fixP;
 
                        /* The PC relative address is computed relative
                           to the instruction boundary, so in case immediate
@@ -3063,9 +3066,11 @@ md_assemble (line)
                          }
 
                        p = frag_more (size);
-                       fix_new_exp (frag_now, p - frag_now->fr_literal, size,
-                                    i.op[n].disps, pcrel,
-                                    reloc (size, pcrel, sign, i.reloc[n]));
+                       fixP = fix_new_exp (frag_now, p - frag_now->fr_literal,
+                                           size, i.op[n].disps, pcrel,
+                                           reloc (size, pcrel, sign, i.reloc[n]));
+                       if (pcrel)
+                         fixP->fx_pcrel_adjust = size;
                      }
                  }
              }
@@ -4019,6 +4024,7 @@ md_estimate_size_before_relax (fragP, segment)
       RELOC_ENUM reloc_type;
       unsigned char *opcode;
       int old_fr_fix;
+      fixS *fixP;
 
       if (fragP->fr_var != NO_RELOC)
        reloc_type = fragP->fr_var;
@@ -4036,10 +4042,11 @@ md_estimate_size_before_relax (fragP, segment)
          /* Make jmp (0xeb) a (d)word displacement jump.  */
          opcode[0] = 0xe9;
          fragP->fr_fix += size;
-         fix_new (fragP, old_fr_fix, size,
-                  fragP->fr_symbol,
-                  fragP->fr_offset, 1,
-                  reloc_type);
+         fixP = fix_new (fragP, old_fr_fix, size,
+                         fragP->fr_symbol,
+                         fragP->fr_offset, 1,
+                         reloc_type);
+         fixP->fx_pcrel_adjust = size;
          break;
 
        case COND_JUMP86:
@@ -4057,10 +4064,11 @@ md_estimate_size_before_relax (fragP, segment)
              /* We added two extra opcode bytes, and have a two byte
                 offset.  */
              fragP->fr_fix += 2 + 2;
-             fix_new (fragP, old_fr_fix + 2, 2,
-                      fragP->fr_symbol,
-                      fragP->fr_offset, 1,
-                      reloc_type);
+             fixP = fix_new (fragP, old_fr_fix + 2, 2,
+                             fragP->fr_symbol,
+                             fragP->fr_offset, 1,
+                             reloc_type);
+             fixP->fx_pcrel_adjust = size;
              break;
            }
          /* Fall through.  */
@@ -4075,10 +4083,11 @@ md_estimate_size_before_relax (fragP, segment)
          opcode[0] = TWO_BYTE_OPCODE_ESCAPE;
          /* We've added an opcode byte.  */
          fragP->fr_fix += 1 + size;
-         fix_new (fragP, old_fr_fix + 1, size,
-                  fragP->fr_symbol,
-                  fragP->fr_offset, 1,
-                  reloc_type);
+         fixP = fix_new (fragP, old_fr_fix + 1, size,
+                         fragP->fr_symbol,
+                         fragP->fr_offset, 1,
+                         reloc_type);
+         fixP->fx_pcrel_adjust = size;
          break;
 
        default:
@@ -4920,7 +4929,7 @@ tc_gen_reloc (section, fixp)
     {
       rel->addend = fixp->fx_offset;
       if (fixp->fx_pcrel)
-       rel->addend -= fixp->fx_size;
+       rel->addend -= fixp->fx_pcrel_adjust;
     }
 
   rel->howto = bfd_reloc_type_lookup (stdoutput, code);