bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gas/21874] x86: Multiple segment registers in the address are not d


From: jbeulich at novell dot com
Subject: [Bug gas/21874] x86: Multiple segment registers in the address are not detected with -masm=intel
Date: Mon, 13 Nov 2017 15:08:42 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=21874

--- Comment #17 from Jan Beulich <jbeulich at novell dot com> ---
This is a tentative patch which could replace the bad one. Only tested on
2.29.1 so far.

--- 2.29.1/gas/config/tc-i386-intel.c
+++ 2.29.1/gas/config/tc-i386-intel.c
@@ -411,7 +413,19 @@ static int i386_intel_simplify (expressi
                               intel_state.index))
        return 0;
       if (!intel_state.in_offset)
-       intel_state.seg = e->X_add_symbol;
+       {
+         if (!intel_state.seg)
+           intel_state.seg = e->X_add_symbol;
+         else
+           {
+             expressionS exp;
+
+             exp.X_op = O_full_ptr;
+             exp.X_add_symbol = e->X_add_symbol;
+             exp.X_op_symbol = intel_state.seg;
+             intel_state.seg = make_expr_symbol (&exp);
+           }
+       }
       i386_intel_fold (e, e->X_op_symbol);
       break;

@@ -935,7 +964,8 @@ i386_intel_operand (char *operand_string
          for (;;)
            {
              expP = symbol_get_value_expression (intel_state.seg);
-             if (expP->X_op != O_full_ptr)
+             if (expP->X_op != O_full_ptr 
+                 || symbol_get_value_expression (expP->X_op_symbol)->X_op !=
O_register)
                break;
              intel_state.seg = expP->X_add_symbol;
            }
--- 2.29.1/gas/testsuite/gas/i386/inval-seg.l
+++ 2.29.1/gas/testsuite/gas/i386/inval-seg.l
@@ -1,10 +1,22 @@
 .*: Assembler messages:
 .*:3: Error: .*
 .*:4: Error: .*
+.*:7: Error: .*
+.*:8: Error: .*
+.*:9: Error: .*
+.*:10: Error: .*
+.*:11: Error: .*
 GAS LISTING .*


-   1 [         ]*      .text
-   2 [         ]*# All the following should be illegal
-   3 [         ]*      movl    %ds,\(%eax\)
-   4 [         ]*      movl    \(%eax\),%ds
+[      ]*[1-9][0-9]*[  ]*\.text
+[      ]*[1-9][0-9]*[  ]*# All the following should be illegal
+[      ]*[1-9][0-9]*[  ]*movl  %ds,\(%eax\)
+[      ]*[1-9][0-9]*[  ]*movl  \(%eax\),%ds
+[      ]*[1-9][0-9]*[  ]*
+[      ]*[1-9][0-9]*[  ]*\.intel_syntax noprefix
+[      ]*[1-9][0-9]*[  ]*mov   eax, es:foo:\[eax\]
+[      ]*[1-9][0-9]*[  ]*mov   eax, es:fs:foo:\[eax\]
+[      ]*[1-9][0-9]*[  ]*mov   eax, fs:foo:bar:\[eax\]
+[      ]*[1-9][0-9]*[  ]*mov   eax, fs:foo:gs:\[eax\]
+[      ]*[1-9][0-9]*[  ]*mov   eax, bar:gs:\[eax\]
--- 2.29.1/gas/testsuite/gas/i386/inval-seg.s
+++ 2.29.1/gas/testsuite/gas/i386/inval-seg.s
@@ -2,3 +2,10 @@
 # All the following should be illegal
        movl    %ds,(%eax)
        movl    (%eax),%ds
+
+       .intel_syntax noprefix
+       mov     eax, es:foo:[eax]
+       mov     eax, es:fs:foo:[eax]
+       mov     eax, fs:foo:bar:[eax]
+       mov     eax, fs:foo:gs:[eax]
+       mov     eax, bar:gs:[eax]

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]