gas/
authorJan Beulich <jbeulich@novell.com>
Wed, 28 Sep 2005 15:31:21 +0000 (15:31 +0000)
committerJan Beulich <jbeulich@novell.com>
Wed, 28 Sep 2005 15:31:21 +0000 (15:31 +0000)
2005-09-28  Jan Beulich  <jbeulich@novell.com>

* config/tc-i386.c (reloc): Disable signedness check for 4-byte
relocations in 16- and 32-bit modes.
(i386_displacement): Make pc-relative branch handling dependent
upon operand (rather than address) size.

gas/testsuite/
2005-09-28  Jan Beulich  <jbeulich@novell.com>

* gas/i386/mixed-mode-reloc.s: Enable all insns.
* gas/i386/mixed-mode-reloc32.d: Adjust.
* gas/i386/mixed-mode-reloc64.d: Adjust.

gas/ChangeLog
gas/config/tc-i386.c
gas/testsuite/ChangeLog
gas/testsuite/gas/i386/mixed-mode-reloc.s
gas/testsuite/gas/i386/mixed-mode-reloc32.d
gas/testsuite/gas/i386/mixed-mode-reloc64.d

index 91d515f..8085e67 100644 (file)
@@ -1,5 +1,12 @@
 2005-09-28  Jan Beulich  <jbeulich@novell.com>
 
+       * config/tc-i386.c (reloc): Disable signedness check for 4-byte
+       relocations in 16- and 32-bit modes.
+       (i386_displacement): Make pc-relative branch handling dependent
+       upon operand (rather than address) size.
+
+2005-09-28  Jan Beulich  <jbeulich@novell.com>
+
        * dw2gencfi.c (dot_cfi): Call ignore_rest_of_line when not fully
        parsing the input.
        (dot_cfi_startproc): Likewise.
index 8f229cf..d6e11df 100644 (file)
@@ -1237,6 +1237,11 @@ reloc (unsigned int size,
            default:
              break;
          }
+
+      /* Sign-checking 4-byte relocations in 16-/32-bit code is pointless.  */
+      if (size == 4 && flag_code != CODE_64BIT)
+       sign = -1;
+
       reloc = bfd_reloc_type_lookup (stdoutput, other);
       if (!reloc)
        as_bad (_("unknown relocation (%u)"), other);
@@ -4111,16 +4116,44 @@ i386_displacement (disp_start, disp_end)
   segT exp_seg = 0;
   char *save_input_line_pointer;
   char *gotfree_input_line;
-  int bigdisp = Disp32;
+  int bigdisp, override;
   unsigned int types = Disp;
 
+  if ((i.types[this_operand] & JumpAbsolute)
+      || !(current_templates->start->opcode_modifier & (Jump | JumpDword)))
+    {
+      bigdisp = Disp32;
+      override = (i.prefix[ADDR_PREFIX] != 0);
+    }
+  else
+    {
+      /* For PC-relative branches, the width of the displacement
+        is dependent upon data size, not address size.  */
+      bigdisp = 0;
+      override = (i.prefix[DATA_PREFIX] != 0);
+    }
   if (flag_code == CODE_64BIT)
     {
-      if (i.prefix[ADDR_PREFIX] == 0)
+      if (!bigdisp)
+       bigdisp = (override || i.suffix == WORD_MNEM_SUFFIX)
+                 ? Disp16
+                 : Disp32S | Disp32;
+      else if (!override)
        bigdisp = Disp64 | Disp32S | Disp32;
     }
-  else if ((flag_code == CODE_16BIT) ^ (i.prefix[ADDR_PREFIX] != 0))
-    bigdisp = Disp16;
+  else
+    {
+      if (!bigdisp)
+       {
+         if (!override)
+           override = (i.suffix == (flag_code != CODE_16BIT
+                                    ? WORD_MNEM_SUFFIX
+                                    : LONG_MNEM_SUFFIX));
+         bigdisp = Disp32;
+       }
+      if ((flag_code == CODE_16BIT) ^ override)
+       bigdisp = Disp16;
+    }
   i.types[this_operand] |= bigdisp;
 
   exp = &disp_expressions[i.disp_operands];
index dc7927a..5416d28 100644 (file)
@@ -1,5 +1,11 @@
 2005-09-28  Jan Beulich  <jbeulich@novell.com>
 
+       * gas/i386/mixed-mode-reloc.s: Enable all insns.
+       * gas/i386/mixed-mode-reloc32.d: Adjust.
+       * gas/i386/mixed-mode-reloc64.d: Adjust.
+
+2005-09-28  Jan Beulich  <jbeulich@novell.com>
+
        * gas/i386/reloc64.s: Also test .slong.
        * gas/i386/reloc64.l: Adjust.
        * gas/i386/reloc64.d: Adjust.
index 1b1a7fe..3cc2861 100644 (file)
@@ -2,12 +2,12 @@
 
  .code16
 _start16:
-#FIXME movl    xtrn@got(%ebx), %eax
-#FIXME calll   xtrn@plt
+       movl    xtrn@got(%ebx), %eax
+       calll   xtrn@plt
 
  .code32
 _start32:
-#FIXME movl    xtrn@got(%ebx), %eax
+       movl    xtrn@got(%ebx), %eax
        calll   xtrn@plt
 
  .code64
index 2dba860..6bc52f7 100644 (file)
@@ -6,9 +6,9 @@
 
 RELOCATION RECORDS FOR \[.text\]:
 OFFSET[        ]+TYPE[         ]+VALUE[        ]*
-#[0-9a-f]+[    ]+R_386_GOT32[  ]+xtrn[         ]*
-#[0-9a-f]+[    ]+R_386_PLT32[  ]+xtrn[         ]*
-#[0-9a-f]+[    ]+R_386_GOT32[  ]+xtrn[         ]*
+[0-9a-f]+[     ]+R_386_GOT32[  ]+xtrn[         ]*
+[0-9a-f]+[     ]+R_386_PLT32[  ]+xtrn[         ]*
+[0-9a-f]+[     ]+R_386_GOT32[  ]+xtrn[         ]*
 [0-9a-f]+[     ]+R_386_PLT32[  ]+xtrn[         ]*
 [0-9a-f]+[     ]+R_386_GOT32[  ]+xtrn[         ]*
 [0-9a-f]+[     ]+R_386_PLT32[  ]+xtrn[         ]*
index 9c99eef..dc50e43 100644 (file)
@@ -6,9 +6,9 @@
 
 RELOCATION RECORDS FOR \[.text\]:
 OFFSET[        ]+TYPE[         ]+VALUE[        ]*
-#[0-9a-f]+[    ]+R_X86_64_GOT32[       ]+xtrn[         ]*
-#[0-9a-f]+[    ]+R_X86_64_PLT32[       ]+xtrn\+0xf+c[  ]*
-#[0-9a-f]+[    ]+R_X86_64_GOT32[       ]+xtrn[         ]*
+[0-9a-f]+[     ]+R_X86_64_GOT32[       ]+xtrn[         ]*
+[0-9a-f]+[     ]+R_X86_64_PLT32[       ]+xtrn\+0xf+c[  ]*
+[0-9a-f]+[     ]+R_X86_64_GOT32[       ]+xtrn[         ]*
 [0-9a-f]+[     ]+R_X86_64_PLT32[       ]+xtrn\+0xf+c[  ]*
 [0-9a-f]+[     ]+R_X86_64_GOT32[       ]+xtrn[         ]*
 [0-9a-f]+[     ]+R_X86_64_PLT32[       ]+xtrn\+0xf+c[  ]*