public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] x86: Intel syntax disallowed use of certain symbols
@ 2005-03-01  8:57 Jan Beulich
  2005-03-01 12:11 ` Alan Modra
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Beulich @ 2005-03-01  8:57 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 4598 bytes --]

Intel syntax mode prevented the use of identifiers like 'dword', 'word',
etc.
in memory operands; MASM really has these symbols predefined (which I
may
provide a patch for later); this patch at least allows equating these
symbols
to the MASM-defined values for compatibility.

Built and tested on i686-pc-linux-gnu.

Jan

gas/
2005-03-01  Jan Beulich  <jbeulich@novell.com>

	* config/tc-i386.c (intel_e11): If not followed by T_PTR, treat
T_BYTE
	etc. like normal symbol references (T_ID).

gas/testsuite/
2005-03-01  Jan Beulich  <jbeulich@novell.com>

	* gas/i386/intelok.d: Add -r to objdump options. Adjust
expectations.
	* gas/i386/intelok.s: Add checks for various special memory
operands.

---
/home/jbeulich/src/binutils/mainline/2005-02-28/gas/config/tc-i386.c	2005-02-01
16:15:56.000000000 +0100
+++ 2005-02-28/gas/config/tc-i386.c	2005-02-28 17:42:09.000000000
+0100
@@ -6154,6 +6162,23 @@ intel_e11 ()
     {
       intel_match_token (cur_token.code);
 
+      if (cur_token.code != T_PTR)
+	{
+	  /* It must have been an identifier; add it to the displacement
string.  */
+	  strcat (intel_parser.disp, prev_token.str);
+
+	  /* The identifier represents a memory reference only if it's
not
+	     preceded by an offset modifier and if it's not an equate. 
*/
+	  if (intel_parser.op_modifier != T_OFFSET)
+	    {
+	      symbolS *symbolP;
+
+	      symbolP = symbol_find(prev_token.str);
+	      if (!symbolP || S_GET_SEGMENT(symbolP) !=
absolute_section)
+		intel_parser.is_mem = 1;
+	    }
+	}
+
       return 1;
     }
 
---
/home/jbeulich/src/binutils/mainline/2005-02-28/gas/testsuite/gas/i386/intelok.d	2005-02-08
13:56:14.000000000 +0100
+++ 2005-02-28/gas/testsuite/gas/i386/intelok.d	2005-03-01
09:38:13.305824976 +0100
@@ -1,5 +1,5 @@
 #as: -J
-#objdump: -dwMintel
+#objdump: -drwMintel
 #name: i386 intel-ok
 
 .*: +file format .*
@@ -93,6 +93,20 @@ Disassembly of section .text:
 [ 	]*[0-9a-f]+:	d7[ 	]+xlat(b|[ 	]+(BYTE PTR
)?(ds:)?\[ebx\])
 [ 	]*[0-9a-f]+:	d7[ 	]+xlat(b|[ 	]+(BYTE PTR
)?(ds:)?\[ebx\])
 [ 	]*[0-9a-f]+:	d7[ 	]+xlat(b|[ 	]+(BYTE PTR
)?(ds:)?\[ebx\])
+[ 	]*[0-9a-f]+:	8b 80 00 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR
)?\[eax\][ 	]+[0-9a-f]+:[ 	]+R_386_32[ 	]+byte
+[ 	]*[0-9a-f]+:	8b 80 00 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR
)?\[eax\][ 	]+[0-9a-f]+:[ 	]+R_386_32[ 	]+byte
+[ 	]*[0-9a-f]+:	8b 40 04[ 	]+mov[ 	]+eax,(DWORD PTR
)?\[eax\+4\]
+[ 	]*[0-9a-f]+:	8b 40 04[ 	]+mov[ 	]+eax,(DWORD PTR
)?\[eax\+4\]
+[ 	]*[0-9a-f]+:	8b 80 00 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR
)?\[eax\][ 	]+[0-9a-f]+:[ 	]+R_386_32[ 	]+fword
+[ 	]*[0-9a-f]+:	8b 80 00 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR
)?\[eax\][ 	]+[0-9a-f]+:[ 	]+R_386_32[ 	]+fword
+[ 	]*[0-9a-f]+:	8b 80 04 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR
)?\[eax\+4\][ 	]+[0-9a-f]+:[ 	]+R_386_32[ 	]+qword
+[ 	]*[0-9a-f]+:	8b 80 04 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR
)?\[eax\+4\][ 	]+[0-9a-f]+:[ 	]+R_386_32[ 	]+qword
+[ 	]*[0-9a-f]+:	8b 80 08 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR
)?\[eax\+8\][ 	]+[0-9a-f]+:[ 	]+R_386_32[ 	]+tbyte
+[ 	]*[0-9a-f]+:	8b 80 08 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR
)?\[eax\+8\][ 	]+[0-9a-f]+:[ 	]+R_386_32[ 	]+tbyte
+#[ 	]*[0-9a-f]+:	8b 04 85 00 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR
)?\[eax\*4\][ 	]+[0-9a-f]+:[ 	]+R_386_32[ 	]+word
+#[ 	]*[0-9a-f]+:	8b 04 85 00 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR
)?\[eax\*4\][ 	]+[0-9a-f]+:[ 	]+R_386_32[ 	]+word
+#[ 	]*[0-9a-f]+:	8b 04 85 04 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR
)?\[eax\*4\+4\][ 	]+[0-9a-f]+:[ 	]+R_386_32[ 	]+xmmword
+#[ 	]*[0-9a-f]+:	8b 04 85 04 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR
)?\[eax\*4\+4\][ 	]+[0-9a-f]+:[ 	]+R_386_32[ 	]+xmmword
 [ 	]*[0-9a-f]+:	6a 01[ 	]+push[ 	]+0x1
 [ 	]*[0-9a-f]+:	6a ff[ 	]+push[ 	]+0xffffffff
 [ 	]*[0-9a-f]+:	6a fe[ 	]+push[ 	]+0xfffffffe
---
/home/jbeulich/src/binutils/mainline/2005-02-28/gas/testsuite/gas/i386/intelok.s	2005-02-08
13:56:39.000000000 +0100
+++ 2005-02-28/gas/testsuite/gas/i386/intelok.s	2005-03-01
09:31:11.807902400 +0100
@@ -1,6 +1,10 @@
 	.intel_syntax noprefix
+	.equiv dword, 4
 	.text
 start:
+
+	# operand sizes
+
 	add	al, [eax]
 	add	al, byte ptr [eax]
 	add	ax, [eax]
@@ -88,6 +92,23 @@ start:
 	xlat	byte ptr [ebx]
 	xlatb
 
+	# memory operands
+
+	mov	eax, dword ptr [byte+eax]
+	mov	eax, dword ptr byte[eax]
+	mov	eax, [dword+eax]
+	mov	eax, dword[eax]
+	mov	eax, [fword+eax]
+	mov	eax, fword[eax]
+	mov	eax, [qword+eax+dword]
+	mov	eax, qword[eax+dword]
+	mov	eax, [tbyte+eax+dword*2]
+	mov	eax, tbyte[eax+dword*2]
+#	mov	eax, [word+eax*dword]
+#	mov	eax, word[eax*dword]
+#	mov	eax, [xmmword+(eax+1)*dword]
+#	mov	eax, xmmword[(eax+1)*dword]
+
 	# expressions
 
 	push	+ 1


[-- Attachment #2: binutils-mainline-x86-intel-equ.patch --]
[-- Type: text/plain, Size: 4597 bytes --]

Intel syntax mode prevented the use of identifiers like 'dword', 'word', etc.
in memory operands; MASM really has these symbols predefined (which I may
provide a patch for later); this patch at least allows equating these symbols
to the MASM-defined values for compatibility.

Built and tested on i686-pc-linux-gnu.

Jan

gas/
2005-03-01  Jan Beulich  <jbeulich@novell.com>

	* config/tc-i386.c (intel_e11): If not followed by T_PTR, treat T_BYTE
	etc. like normal symbol references (T_ID).

gas/testsuite/
2005-03-01  Jan Beulich  <jbeulich@novell.com>

	* gas/i386/intelok.d: Add -r to objdump options. Adjust expectations.
	* gas/i386/intelok.s: Add checks for various special memory operands.

--- /home/jbeulich/src/binutils/mainline/2005-02-28/gas/config/tc-i386.c	2005-02-01 16:15:56.000000000 +0100
+++ 2005-02-28/gas/config/tc-i386.c	2005-02-28 17:42:09.000000000 +0100
@@ -6154,6 +6162,23 @@ intel_e11 ()
     {
       intel_match_token (cur_token.code);
 
+      if (cur_token.code != T_PTR)
+	{
+	  /* It must have been an identifier; add it to the displacement string.  */
+	  strcat (intel_parser.disp, prev_token.str);
+
+	  /* The identifier represents a memory reference only if it's not
+	     preceded by an offset modifier and if it's not an equate.  */
+	  if (intel_parser.op_modifier != T_OFFSET)
+	    {
+	      symbolS *symbolP;
+
+	      symbolP = symbol_find(prev_token.str);
+	      if (!symbolP || S_GET_SEGMENT(symbolP) != absolute_section)
+		intel_parser.is_mem = 1;
+	    }
+	}
+
       return 1;
     }
 
--- /home/jbeulich/src/binutils/mainline/2005-02-28/gas/testsuite/gas/i386/intelok.d	2005-02-08 13:56:14.000000000 +0100
+++ 2005-02-28/gas/testsuite/gas/i386/intelok.d	2005-03-01 09:38:13.305824976 +0100
@@ -1,5 +1,5 @@
 #as: -J
-#objdump: -dwMintel
+#objdump: -drwMintel
 #name: i386 intel-ok
 
 .*: +file format .*
@@ -93,6 +93,20 @@ Disassembly of section .text:
 [ 	]*[0-9a-f]+:	d7[ 	]+xlat(b|[ 	]+(BYTE PTR )?(ds:)?\[ebx\])
 [ 	]*[0-9a-f]+:	d7[ 	]+xlat(b|[ 	]+(BYTE PTR )?(ds:)?\[ebx\])
 [ 	]*[0-9a-f]+:	d7[ 	]+xlat(b|[ 	]+(BYTE PTR )?(ds:)?\[ebx\])
+[ 	]*[0-9a-f]+:	8b 80 00 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR )?\[eax\][ 	]+[0-9a-f]+:[ 	]+R_386_32[ 	]+byte
+[ 	]*[0-9a-f]+:	8b 80 00 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR )?\[eax\][ 	]+[0-9a-f]+:[ 	]+R_386_32[ 	]+byte
+[ 	]*[0-9a-f]+:	8b 40 04[ 	]+mov[ 	]+eax,(DWORD PTR )?\[eax\+4\]
+[ 	]*[0-9a-f]+:	8b 40 04[ 	]+mov[ 	]+eax,(DWORD PTR )?\[eax\+4\]
+[ 	]*[0-9a-f]+:	8b 80 00 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR )?\[eax\][ 	]+[0-9a-f]+:[ 	]+R_386_32[ 	]+fword
+[ 	]*[0-9a-f]+:	8b 80 00 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR )?\[eax\][ 	]+[0-9a-f]+:[ 	]+R_386_32[ 	]+fword
+[ 	]*[0-9a-f]+:	8b 80 04 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR )?\[eax\+4\][ 	]+[0-9a-f]+:[ 	]+R_386_32[ 	]+qword
+[ 	]*[0-9a-f]+:	8b 80 04 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR )?\[eax\+4\][ 	]+[0-9a-f]+:[ 	]+R_386_32[ 	]+qword
+[ 	]*[0-9a-f]+:	8b 80 08 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR )?\[eax\+8\][ 	]+[0-9a-f]+:[ 	]+R_386_32[ 	]+tbyte
+[ 	]*[0-9a-f]+:	8b 80 08 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR )?\[eax\+8\][ 	]+[0-9a-f]+:[ 	]+R_386_32[ 	]+tbyte
+#[ 	]*[0-9a-f]+:	8b 04 85 00 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR )?\[eax\*4\][ 	]+[0-9a-f]+:[ 	]+R_386_32[ 	]+word
+#[ 	]*[0-9a-f]+:	8b 04 85 00 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR )?\[eax\*4\][ 	]+[0-9a-f]+:[ 	]+R_386_32[ 	]+word
+#[ 	]*[0-9a-f]+:	8b 04 85 04 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR )?\[eax\*4\+4\][ 	]+[0-9a-f]+:[ 	]+R_386_32[ 	]+xmmword
+#[ 	]*[0-9a-f]+:	8b 04 85 04 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR )?\[eax\*4\+4\][ 	]+[0-9a-f]+:[ 	]+R_386_32[ 	]+xmmword
 [ 	]*[0-9a-f]+:	6a 01[ 	]+push[ 	]+0x1
 [ 	]*[0-9a-f]+:	6a ff[ 	]+push[ 	]+0xffffffff
 [ 	]*[0-9a-f]+:	6a fe[ 	]+push[ 	]+0xfffffffe
--- /home/jbeulich/src/binutils/mainline/2005-02-28/gas/testsuite/gas/i386/intelok.s	2005-02-08 13:56:39.000000000 +0100
+++ 2005-02-28/gas/testsuite/gas/i386/intelok.s	2005-03-01 09:31:11.807902400 +0100
@@ -1,6 +1,10 @@
 	.intel_syntax noprefix
+	.equiv dword, 4
 	.text
 start:
+
+	# operand sizes
+
 	add	al, [eax]
 	add	al, byte ptr [eax]
 	add	ax, [eax]
@@ -88,6 +92,23 @@ start:
 	xlat	byte ptr [ebx]
 	xlatb
 
+	# memory operands
+
+	mov	eax, dword ptr [byte+eax]
+	mov	eax, dword ptr byte[eax]
+	mov	eax, [dword+eax]
+	mov	eax, dword[eax]
+	mov	eax, [fword+eax]
+	mov	eax, fword[eax]
+	mov	eax, [qword+eax+dword]
+	mov	eax, qword[eax+dword]
+	mov	eax, [tbyte+eax+dword*2]
+	mov	eax, tbyte[eax+dword*2]
+#	mov	eax, [word+eax*dword]
+#	mov	eax, word[eax*dword]
+#	mov	eax, [xmmword+(eax+1)*dword]
+#	mov	eax, xmmword[(eax+1)*dword]
+
 	# expressions
 
 	push	+ 1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86: Intel syntax disallowed use of certain symbols
  2005-03-01  8:57 [PATCH] x86: Intel syntax disallowed use of certain symbols Jan Beulich
@ 2005-03-01 12:11 ` Alan Modra
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Modra @ 2005-03-01 12:11 UTC (permalink / raw)
  To: Jan Beulich; +Cc: binutils

On Tue, Mar 01, 2005 at 09:56:45AM +0100, Jan Beulich wrote:
> 	* config/tc-i386.c (intel_e11): If not followed by T_PTR, treat T_BYTE
> 	etc. like normal symbol references (T_ID).

OK, but..

> 	* gas/i386/intelok.d: Add -r to objdump options. Adjust expectations.

Please test this on i686-aout and i686-coff targets and adjust relocs to
suit all targets.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86: Intel syntax disallowed use of certain symbols
       [not found] <s224800f.020@emea1-mh.id2.novell.com>
@ 2005-03-01 21:54 ` Alan Modra
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Modra @ 2005-03-01 21:54 UTC (permalink / raw)
  To: Jan Beulich; +Cc: binutils

On Tue, Mar 01, 2005 at 03:45:51PM +0100, Jan Beulich wrote:
> >>> Alan Modra <amodra@bigpond.net.au> 01.03.05 13:11:54 >>>
> >On Tue, Mar 01, 2005 at 09:56:45AM +0100, Jan Beulich wrote:
> >> 	* config/tc-i386.c (intel_e11): If not followed by T_PTR, treat
> T_BYTE
> >> 	etc. like normal symbol references (T_ID).
> >
> >OK, but..
> >
> >> 	* gas/i386/intelok.d: Add -r to objdump options. Adjust
> expectations.
> >
> >Please test this on i686-aout and i686-coff targets and adjust relocs
> to
> >suit all targets.
> 
> Changes below/attached. I'm not sure if in such a case it is OK to
> apply without another approval - please let me know.

Yes, it is OK.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86: Intel syntax disallowed use of certain symbols
@ 2005-03-01 14:46 Jan Beulich
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Beulich @ 2005-03-01 14:46 UTC (permalink / raw)
  To: amodra; +Cc: binutils

[-- Attachment #1: Type: text/plain, Size: 4996 bytes --]

>>> Alan Modra <amodra@bigpond.net.au> 01.03.05 13:11:54 >>>
>On Tue, Mar 01, 2005 at 09:56:45AM +0100, Jan Beulich wrote:
>> 	* config/tc-i386.c (intel_e11): If not followed by T_PTR, treat
T_BYTE
>> 	etc. like normal symbol references (T_ID).
>
>OK, but..
>
>> 	* gas/i386/intelok.d: Add -r to objdump options. Adjust
expectations.
>
>Please test this on i686-aout and i686-coff targets and adjust relocs
to
>suit all targets.

Changes below/attached. I'm not sure if in such a case it is OK to
apply without another approval - please let me know.

Re-tested on i686-pc-linux-gnu and as cross tools for i686-aout and
i686-coff.

Jan

gas/
2005-03-01  Jan Beulich  <jbeulich@novell.com>

	* config/tc-i386.c (intel_e11): If not followed by T_PTR, treat
T_BYTE
	etc. like normal symbol references (T_ID).

gas/testsuite/
2005-03-01  Jan Beulich  <jbeulich@novell.com>

	* gas/i386/intelok.d: Add -r to objdump options. Adjust
expectations.
	* gas/i386/intelok.s: Add checks for various special memory
operands.

---
/home/jbeulich/src/binutils/mainline/2005-02-28/gas/config/tc-i386.c	2005-02-01
16:15:56.000000000 +0100
+++ 2005-02-28/gas/config/tc-i386.c	2005-02-28 17:42:09.000000000
+0100
@@ -6154,6 +6162,23 @@ intel_e11 ()
     {
       intel_match_token (cur_token.code);
 
+      if (cur_token.code != T_PTR)
+	{
+	  /* It must have been an identifier; add it to the displacement
string.  */
+	  strcat (intel_parser.disp, prev_token.str);
+
+	  /* The identifier represents a memory reference only if it's
not
+	     preceded by an offset modifier and if it's not an equate. 
*/
+	  if (intel_parser.op_modifier != T_OFFSET)
+	    {
+	      symbolS *symbolP;
+
+	      symbolP = symbol_find(prev_token.str);
+	      if (!symbolP || S_GET_SEGMENT(symbolP) !=
absolute_section)
+		intel_parser.is_mem = 1;
+	    }
+	}
+
       return 1;
     }
 
---
/home/jbeulich/src/binutils/mainline/2005-02-28/gas/testsuite/gas/i386/intelok.d	2005-02-08
13:56:14.000000000 +0100
+++ 2005-02-28/gas/testsuite/gas/i386/intelok.d	2005-03-01
09:38:13.305824976 +0100
@@ -1,5 +1,5 @@
 #as: -J
-#objdump: -dwMintel
+#objdump: -drwMintel
 #name: i386 intel-ok
 
 .*: +file format .*
@@ -93,6 +93,20 @@ Disassembly of section .text:
 [ 	]*[0-9a-f]+:	d7[ 	]+xlat(b|[ 	]+(BYTE PTR
)?(ds:)?\[ebx\])
 [ 	]*[0-9a-f]+:	d7[ 	]+xlat(b|[ 	]+(BYTE PTR
)?(ds:)?\[ebx\])
 [ 	]*[0-9a-f]+:	d7[ 	]+xlat(b|[ 	]+(BYTE PTR
)?(ds:)?\[ebx\])
+[ 	]*[0-9a-f]+:	8b 80 00 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR
)?\[eax\][ 	]+[0-9a-f]+:[ 	]+(R_386_|dir)?32[ 	]+byte
+[ 	]*[0-9a-f]+:	8b 80 00 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR
)?\[eax\][ 	]+[0-9a-f]+:[ 	]+(R_386_|dir)?32[ 	]+byte
+[ 	]*[0-9a-f]+:	8b 40 04[ 	]+mov[ 	]+eax,(DWORD PTR
)?\[eax\+4\]
+[ 	]*[0-9a-f]+:	8b 40 04[ 	]+mov[ 	]+eax,(DWORD PTR
)?\[eax\+4\]
+[ 	]*[0-9a-f]+:	8b 80 00 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR
)?\[eax\][ 	]+[0-9a-f]+:[ 	]+(R_386_|dir)?32[ 	]+fword
+[ 	]*[0-9a-f]+:	8b 80 00 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR
)?\[eax\][ 	]+[0-9a-f]+:[ 	]+(R_386_|dir)?32[ 	]+fword
+[ 	]*[0-9a-f]+:	8b 80 04 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR
)?\[eax\+4\][ 	]+[0-9a-f]+:[ 	]+(R_386_|dir)?32[ 	]+qword
+[ 	]*[0-9a-f]+:	8b 80 04 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR
)?\[eax\+4\][ 	]+[0-9a-f]+:[ 	]+(R_386_|dir)?32[ 	]+qword
+[ 	]*[0-9a-f]+:	8b 80 08 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR
)?\[eax\+8\][ 	]+[0-9a-f]+:[ 	]+(R_386_|dir)?32[ 	]+tbyte
+[ 	]*[0-9a-f]+:	8b 80 08 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR
)?\[eax\+8\][ 	]+[0-9a-f]+:[ 	]+(R_386_|dir)?32[ 	]+tbyte
+#[ 	]*[0-9a-f]+:	8b 04 85 00 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR
)?\[eax\*4\][ 	]+[0-9a-f]+:[ 	]+(R_386_|dir)?32[ 	]+word
+#[ 	]*[0-9a-f]+:	8b 04 85 00 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR
)?\[eax\*4\][ 	]+[0-9a-f]+:[ 	]+(R_386_|dir)?32[ 	]+word
+#[ 	]*[0-9a-f]+:	8b 04 85 04 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR
)?\[eax\*4\+4\][ 	]+[0-9a-f]+:[ 	]+(R_386_|dir)?32[
	]+xmmword
+#[ 	]*[0-9a-f]+:	8b 04 85 04 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR
)?\[eax\*4\+4\][ 	]+[0-9a-f]+:[ 	]+(R_386_|dir)?32[
	]+xmmword
 [ 	]*[0-9a-f]+:	6a 01[ 	]+push[ 	]+0x1
 [ 	]*[0-9a-f]+:	6a ff[ 	]+push[ 	]+0xffffffff
 [ 	]*[0-9a-f]+:	6a fe[ 	]+push[ 	]+0xfffffffe
---
/home/jbeulich/src/binutils/mainline/2005-02-28/gas/testsuite/gas/i386/intelok.s	2005-02-08
13:56:39.000000000 +0100
+++ 2005-02-28/gas/testsuite/gas/i386/intelok.s	2005-03-01
09:31:11.807902400 +0100
@@ -1,6 +1,10 @@
 	.intel_syntax noprefix
+	.equiv dword, 4
 	.text
 start:
+
+	# operand sizes
+
 	add	al, [eax]
 	add	al, byte ptr [eax]
 	add	ax, [eax]
@@ -88,6 +92,23 @@ start:
 	xlat	byte ptr [ebx]
 	xlatb
 
+	# memory operands
+
+	mov	eax, dword ptr [byte+eax]
+	mov	eax, dword ptr byte[eax]
+	mov	eax, [dword+eax]
+	mov	eax, dword[eax]
+	mov	eax, [fword+eax]
+	mov	eax, fword[eax]
+	mov	eax, [qword+eax+dword]
+	mov	eax, qword[eax+dword]
+	mov	eax, [tbyte+eax+dword*2]
+	mov	eax, tbyte[eax+dword*2]
+#	mov	eax, [word+eax*dword]
+#	mov	eax, word[eax*dword]
+#	mov	eax, [xmmword+(eax+1)*dword]
+#	mov	eax, xmmword[(eax+1)*dword]
+
 	# expressions
 
 	push	+ 1


[-- Attachment #2: binutils-mainline-x86-intel-equ.patch --]
[-- Type: text/plain, Size: 4681 bytes --]

Intel syntax mode prevented the use of identifiers like 'dword', 'word', etc.
in memory operands; MASM really has these symbols predefined (which I may
provide a patch for later); this patch at least allows equating these symbols
to the MASM-defined values for compatibility.

Built and tested on i686-pc-linux-gnu.

Jan

gas/
2005-03-01  Jan Beulich  <jbeulich@novell.com>

	* config/tc-i386.c (intel_e11): If not followed by T_PTR, treat T_BYTE
	etc. like normal symbol references (T_ID).

gas/testsuite/
2005-03-01  Jan Beulich  <jbeulich@novell.com>

	* gas/i386/intelok.d: Add -r to objdump options. Adjust expectations.
	* gas/i386/intelok.s: Add checks for various special memory operands.

--- /home/jbeulich/src/binutils/mainline/2005-02-28/gas/config/tc-i386.c	2005-02-01 16:15:56.000000000 +0100
+++ 2005-02-28/gas/config/tc-i386.c	2005-02-28 17:42:09.000000000 +0100
@@ -6154,6 +6162,23 @@ intel_e11 ()
     {
       intel_match_token (cur_token.code);
 
+      if (cur_token.code != T_PTR)
+	{
+	  /* It must have been an identifier; add it to the displacement string.  */
+	  strcat (intel_parser.disp, prev_token.str);
+
+	  /* The identifier represents a memory reference only if it's not
+	     preceded by an offset modifier and if it's not an equate.  */
+	  if (intel_parser.op_modifier != T_OFFSET)
+	    {
+	      symbolS *symbolP;
+
+	      symbolP = symbol_find(prev_token.str);
+	      if (!symbolP || S_GET_SEGMENT(symbolP) != absolute_section)
+		intel_parser.is_mem = 1;
+	    }
+	}
+
       return 1;
     }
 
--- /home/jbeulich/src/binutils/mainline/2005-02-28/gas/testsuite/gas/i386/intelok.d	2005-02-08 13:56:14.000000000 +0100
+++ 2005-02-28/gas/testsuite/gas/i386/intelok.d	2005-03-01 09:38:13.305824976 +0100
@@ -1,5 +1,5 @@
 #as: -J
-#objdump: -dwMintel
+#objdump: -drwMintel
 #name: i386 intel-ok
 
 .*: +file format .*
@@ -93,6 +93,20 @@ Disassembly of section .text:
 [ 	]*[0-9a-f]+:	d7[ 	]+xlat(b|[ 	]+(BYTE PTR )?(ds:)?\[ebx\])
 [ 	]*[0-9a-f]+:	d7[ 	]+xlat(b|[ 	]+(BYTE PTR )?(ds:)?\[ebx\])
 [ 	]*[0-9a-f]+:	d7[ 	]+xlat(b|[ 	]+(BYTE PTR )?(ds:)?\[ebx\])
+[ 	]*[0-9a-f]+:	8b 80 00 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR )?\[eax\][ 	]+[0-9a-f]+:[ 	]+(R_386_|dir)?32[ 	]+byte
+[ 	]*[0-9a-f]+:	8b 80 00 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR )?\[eax\][ 	]+[0-9a-f]+:[ 	]+(R_386_|dir)?32[ 	]+byte
+[ 	]*[0-9a-f]+:	8b 40 04[ 	]+mov[ 	]+eax,(DWORD PTR )?\[eax\+4\]
+[ 	]*[0-9a-f]+:	8b 40 04[ 	]+mov[ 	]+eax,(DWORD PTR )?\[eax\+4\]
+[ 	]*[0-9a-f]+:	8b 80 00 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR )?\[eax\][ 	]+[0-9a-f]+:[ 	]+(R_386_|dir)?32[ 	]+fword
+[ 	]*[0-9a-f]+:	8b 80 00 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR )?\[eax\][ 	]+[0-9a-f]+:[ 	]+(R_386_|dir)?32[ 	]+fword
+[ 	]*[0-9a-f]+:	8b 80 04 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR )?\[eax\+4\][ 	]+[0-9a-f]+:[ 	]+(R_386_|dir)?32[ 	]+qword
+[ 	]*[0-9a-f]+:	8b 80 04 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR )?\[eax\+4\][ 	]+[0-9a-f]+:[ 	]+(R_386_|dir)?32[ 	]+qword
+[ 	]*[0-9a-f]+:	8b 80 08 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR )?\[eax\+8\][ 	]+[0-9a-f]+:[ 	]+(R_386_|dir)?32[ 	]+tbyte
+[ 	]*[0-9a-f]+:	8b 80 08 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR )?\[eax\+8\][ 	]+[0-9a-f]+:[ 	]+(R_386_|dir)?32[ 	]+tbyte
+#[ 	]*[0-9a-f]+:	8b 04 85 00 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR )?\[eax\*4\][ 	]+[0-9a-f]+:[ 	]+(R_386_|dir)?32[ 	]+word
+#[ 	]*[0-9a-f]+:	8b 04 85 00 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR )?\[eax\*4\][ 	]+[0-9a-f]+:[ 	]+(R_386_|dir)?32[ 	]+word
+#[ 	]*[0-9a-f]+:	8b 04 85 04 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR )?\[eax\*4\+4\][ 	]+[0-9a-f]+:[ 	]+(R_386_|dir)?32[ 	]+xmmword
+#[ 	]*[0-9a-f]+:	8b 04 85 04 00 00 00[ 	]+mov[ 	]+eax,(DWORD PTR )?\[eax\*4\+4\][ 	]+[0-9a-f]+:[ 	]+(R_386_|dir)?32[ 	]+xmmword
 [ 	]*[0-9a-f]+:	6a 01[ 	]+push[ 	]+0x1
 [ 	]*[0-9a-f]+:	6a ff[ 	]+push[ 	]+0xffffffff
 [ 	]*[0-9a-f]+:	6a fe[ 	]+push[ 	]+0xfffffffe
--- /home/jbeulich/src/binutils/mainline/2005-02-28/gas/testsuite/gas/i386/intelok.s	2005-02-08 13:56:39.000000000 +0100
+++ 2005-02-28/gas/testsuite/gas/i386/intelok.s	2005-03-01 09:31:11.807902400 +0100
@@ -1,6 +1,10 @@
 	.intel_syntax noprefix
+	.equiv dword, 4
 	.text
 start:
+
+	# operand sizes
+
 	add	al, [eax]
 	add	al, byte ptr [eax]
 	add	ax, [eax]
@@ -88,6 +92,23 @@ start:
 	xlat	byte ptr [ebx]
 	xlatb
 
+	# memory operands
+
+	mov	eax, dword ptr [byte+eax]
+	mov	eax, dword ptr byte[eax]
+	mov	eax, [dword+eax]
+	mov	eax, dword[eax]
+	mov	eax, [fword+eax]
+	mov	eax, fword[eax]
+	mov	eax, [qword+eax+dword]
+	mov	eax, qword[eax+dword]
+	mov	eax, [tbyte+eax+dword*2]
+	mov	eax, tbyte[eax+dword*2]
+#	mov	eax, [word+eax*dword]
+#	mov	eax, word[eax*dword]
+#	mov	eax, [xmmword+(eax+1)*dword]
+#	mov	eax, xmmword[(eax+1)*dword]
+
 	# expressions
 
 	push	+ 1

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-03-01 21:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-01  8:57 [PATCH] x86: Intel syntax disallowed use of certain symbols Jan Beulich
2005-03-01 12:11 ` Alan Modra
2005-03-01 14:46 Jan Beulich
     [not found] <s224800f.020@emea1-mh.id2.novell.com>
2005-03-01 21:54 ` Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).