Restore "call|jmp [xtrn]" in x86 assembler.
authorH.J. Lu <hjl.tools@gmail.com>
Sat, 24 Apr 2010 17:41:04 +0000 (17:41 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Sat, 24 Apr 2010 17:41:04 +0000 (17:41 +0000)
gas/

2010-04-24  H.J. Lu  <hongjiu.lu@intel.com>

PR gas/11535
* config/tc-i386-intel.c (intel_state): Add is_indirect.
(i386_intel_operand): Initialize intel_state.is_indirect.  Check
intel_state.is_indirect for "call|jmp [symbol]".

gas/testsuite/

2010-04-24  H.J. Lu  <hongjiu.lu@intel.com>

PR gas/11535
* gas/i386/intelok.s: Add tests for "call|jmp [xtrn]".
* gas/i386/intelok.d: Updated.

gas/ChangeLog
gas/config/tc-i386-intel.c
gas/testsuite/ChangeLog
gas/testsuite/gas/i386/intelok.d
gas/testsuite/gas/i386/intelok.s

index 6fb61e9d002cbfab31807ccd2e1d997632f2f8de..1638bc74e85300865152cdf3c347fc35d80768f3 100644 (file)
@@ -1,3 +1,10 @@
+2010-04-24  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR gas/11535
+       * config/tc-i386-intel.c (intel_state): Add is_indirect.
+       (i386_intel_operand): Initialize intel_state.is_indirect.  Check
+       intel_state.is_indirect for "call|jmp [symbol]".
+
 2010-04-22  Nick Clifton  <nickc@redhat.com>
 
        * po/gas.pot: Updated by the Translation project.
index ea1e6e04e132847ec01cd0ac4f81ef19cecc9ee0..163634405307e0cd77c45d121ffe34c6056bab2a 100644 (file)
@@ -23,6 +23,7 @@ static struct
   {
     operatorT op_modifier;     /* Operand modifier.  */
     int is_mem;                        /* 1 if operand is memory reference.  */
+    int is_indirect;           /* 1 if operand is indirect reference.  */
     int has_offset;            /* 1 if operand has offset.  */
     unsigned int in_offset;    /* >=1 if processing operand of offset.  */
     unsigned int in_bracket;   /* >=1 if processing operand in brackets.  */
@@ -491,6 +492,7 @@ i386_intel_operand (char *operand_string, int got_a_float)
   /* Initialize state structure.  */
   intel_state.op_modifier = O_absent;
   intel_state.is_mem = 0;
+  intel_state.is_indirect = 0;
   intel_state.has_offset = 0;
   intel_state.base = NULL;
   intel_state.index = NULL;
@@ -528,7 +530,10 @@ i386_intel_operand (char *operand_string, int got_a_float)
   else if (!intel_state.has_offset
           && input_line_pointer > buf
           && *(input_line_pointer - 1) == ']')
-    intel_state.is_mem |= 1;
+    {
+      intel_state.is_mem |= 1;
+      intel_state.is_indirect = 1;
+    }
 
   input_line_pointer = saved_input_line_pointer;
   free (buf);
@@ -674,7 +679,11 @@ i386_intel_operand (char *operand_string, int got_a_float)
              {
                intel_state.is_mem = 1;
                if (intel_state.op_modifier == O_absent)
-                 break;
+                 {
+                   if (intel_state.is_indirect == 1)
+                     i.types[this_operand].bitfield.jumpabsolute = 1;
+                   break;
+                 }
                as_bad (_("cannot infer the segment part of the operand"));
                return 0;
              }
index 111a118e5476ec3769af32254c6e96dbc48754e3..8e3df9ef946d302b3d75f40d21af737573fecb66 100644 (file)
@@ -1,3 +1,9 @@
+2010-04-24  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR gas/11535
+       * gas/i386/intelok.s: Add tests for "call|jmp [xtrn]".
+       * gas/i386/intelok.d: Updated.
+
 2010-04-21  Joseph Myers  <joseph@codesourcery.com>
 
        * gas/tic6x/insns-c674x.s, gas/tic6x/insns-c674x.d: Also test
index 7a958d574b246274a3bb57bd2c140b2bc18de7d6..bad81e41e2c78760ddeb297af67da07772ce62e6 100644 (file)
@@ -204,4 +204,6 @@ Disassembly of section .text:
 [      ]*[0-9a-f]+:    ea 03 00 00 00 05 00[   ]+l?jmp[        ]+0x5[,:]0x3
 [      ]*[0-9a-f]+:    ff 15 00 00 00 00[      ]+call[         ]+DWORD PTR (ds:)?(0x)?0
 [      ]*[0-9a-f]+:    66 ff 25 00 00 00 00[   ]+jmp[  ]+WORD PTR (ds:)?(0x)?0
+[      ]*[0-9a-f]+:    ff 15 00 00 00 00[      ]+call[         ]+DWORD PTR (ds:)?(0x)?0
+[      ]*[0-9a-f]+:    ff 25 00 00 00 00[      ]+jmp[  ]+DWORD PTR (ds:)?(0x)?0
 #pass
index 68833015a3595e7a3753e37429f9803ca3b959f5..eae9c2d50923e1067bb1436a917d0556ca9fd7bd 100644 (file)
@@ -215,3 +215,5 @@ start:
        jmp     5:[3]
        call    dword ptr xtrn
        jmp     word ptr xtrn
+       call    [xtrn]
+       jmp     [xtrn]