]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* config/tc-i386.c (output_jump): Set fx_pcrel_adjust to size of
authorAndreas Schwab <schwab@linux-m68k.org>
Wed, 27 Mar 2002 16:22:04 +0000 (16:22 +0000)
committerAndreas Schwab <schwab@linux-m68k.org>
Wed, 27 Mar 2002 16:22:04 +0000 (16:22 +0000)
field for pc-relative fixups.
(output_disp): Likewise.
(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 4d496972b5ebd5b54e83e66402d742cd1090d284..190d0ac4277cde154751ac5f716ae9b6f7002b5d 100644 (file)
@@ -1,3 +1,12 @@
+2002-03-27  Andreas Schwab  <schwab@suse.de>
+
+       * config/tc-i386.c (output_jump): Set fx_pcrel_adjust to size of
+       field for pc-relative fixups.
+       (output_disp): Likewise.
+       (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-22  Alan Modra  <amodra@bigpond.net.au>
 
        * config/te-aix5.h: Typo fix.
index 7b9e8ed6b296e3253d248f9b60ccf0dc08b68f5e..2567b4c2247f213cbe036764f0febf07e1e7f1a6 100644 (file)
@@ -2972,6 +2972,7 @@ output_jump ()
 {
   char *p;
   int size;
+  fixS *fixP;
 
   if (i.tm.opcode_modifier & JumpByte)
     {
@@ -3022,8 +3023,9 @@ output_jump ()
   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;
 }
 
 static void
@@ -3216,6 +3218,7 @@ output_disp ()
              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
@@ -3255,9 +3258,11 @@ output_disp ()
                }
 
              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;
            }
        }
     }
@@ -4202,6 +4207,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;
@@ -4219,10 +4225,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:
@@ -4240,10 +4247,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.  */
@@ -4258,10 +4266,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:
@@ -5105,7 +5114,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);