This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: PR gas/10198: GAS wrongly treats `$' as a symbol name


I checked in this patch to fix this regression.


H.J.
---
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 6033)
+++ ChangeLog	(working copy)
@@ -1,3 +1,8 @@
+2009-06-01  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR gas/10198
+	* config/tc-i386-intel.c (i386_intel_operand): Check '$' as '.'.
+
 2009-05-26  Catherine Moore  <clm@codesourcery.com>
 
 	* config/tc-mips.c (check_for_24k_errata): Remove.
Index: testsuite/ChangeLog
===================================================================
--- testsuite/ChangeLog	(revision 6033)
+++ testsuite/ChangeLog	(working copy)
@@ -1,3 +1,12 @@
+2009-06-01  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR gas/10198
+	* gas/i386/jump.s: Add test for "jmp $+2".
+	* gas/i386/jump16.s: Likewise.
+
+	* gas/i386/jump.d: Updated.
+	* gas/i386/jump16.d: Likewise.
+
 2009-05-26  Catherine Moore  <clm@codesourcery.com>
 
 	* gas/mips/eret.s: Remove.
Index: testsuite/gas/i386/jump16.d
===================================================================
--- testsuite/gas/i386/jump16.d	(revision 6033)
+++ testsuite/gas/i386/jump16.d	(working copy)
@@ -6,23 +6,23 @@
 Disassembly of section .text:
 
 0+ <.text>:
-[ 	]*[a-f0-9]+:	eb fe                	jmp    0x0
+[ 	]*[a-f0-9]+:	eb fe                	jmp    (0x0|0 <.text>)
 [ 	]*[a-f0-9]+:	e9 fe ff             	jmp    0x3	3: R_386_PC16	xxx
 [ 	]*[a-f0-9]+:	ff 26 00 00          	jmp    \*0x0	7: R_386_16	xxx
 [ 	]*[a-f0-9]+:	66 ff e7             	jmpl   \*%edi
 [ 	]*[a-f0-9]+:	67 ff 27             	addr32 jmp \*\(%edi\)
-[ 	]*[a-f0-9]+:	67 ff af 00 00 00 00 	addr32 ljmp \*0x0\(%edi\)	12: R_386_32	xxx
+[ 	]*[a-f0-9]+:	67 ff af 00 00 00 00 	addr32 ljmp \*0x0\(%edi\)	12: (R_386_)?(dir)?32	xxx
 [ 	]*[a-f0-9]+:	ff 2e 00 00          	ljmp   \*0x0	18: R_386_16	xxx
 [ 	]*[a-f0-9]+:	ea 00 00 34 12       	ljmp   \$0x1234,\$0x0	1b: R_386_16	xxx
 [ 	]*[a-f0-9]+:	66 e8 db ff ff ff    	calll  0x0
-[ 	]*[a-f0-9]+:	66 e8 fc ff ff ff    	calll  0x27	27: R_386_PC32	xxx
+[ 	]*[a-f0-9]+:	66 e8 fc ff ff ff    	calll  0x27	27: (R_386_PC)?(DISP)?32	xxx
 [ 	]*[a-f0-9]+:	66 ff 16 00 00       	calll  \*0x0	2e: R_386_16	xxx
 [ 	]*[a-f0-9]+:	66 ff d7             	calll  \*%edi
 [ 	]*[a-f0-9]+:	67 66 ff 17          	addr32 calll \*\(%edi\)
-[ 	]*[a-f0-9]+:	67 66 ff 9f 00 00 00 00 	addr32 lcalll \*0x0\(%edi\)	3b: R_386_32	xxx
+[ 	]*[a-f0-9]+:	67 66 ff 9f 00 00 00 00 	addr32 lcalll \*0x0\(%edi\)	3b: (R_386_)?(dir)?32	xxx
 [ 	]*[a-f0-9]+:	66 ff 1e 00 00       	lcalll \*0x0	42: R_386_16	xxx
-[ 	]*[a-f0-9]+:	66 9a 00 00 00 00 34 12 	lcalll \$0x1234,\$0x0	46: R_386_32	xxx
-[ 	]*[a-f0-9]+:	eb b2                	jmp    0x0
+[ 	]*[a-f0-9]+:	66 9a 00 00 00 00 34 12 	lcalll \$0x1234,\$0x0	46: (R_386_)?(dir)?32	xxx
+[ 	]*[a-f0-9]+:	eb b2                	jmp    (0x0|0 <.text>)
 [ 	]*[a-f0-9]+:	ff 26 00 00          	jmp    \*0x0	50: R_386_16	xxx
 [ 	]*[a-f0-9]+:	ff e7                	jmp    \*%di
 [ 	]*[a-f0-9]+:	ff 25                	jmp    \*\(%di\)
@@ -31,7 +31,7 @@ Disassembly of section .text:
 [ 	]*[a-f0-9]+:	ff 2e 00 00          	ljmp   \*0x0	61: R_386_16	xxx
 [ 	]*[a-f0-9]+:	66 ff 2e 00 00       	ljmpl  \*0x0	66: R_386_16	xxx
 [ 	]*[a-f0-9]+:	ea 00 00 34 12       	ljmp   \$0x1234,\$0x0	69: R_386_16	xxx
-[ 	]*[a-f0-9]+:	e8 90 ff             	call   0x0
+[ 	]*[a-f0-9]+:	e8 90 ff             	call   (0x0|0 <.text>)
 [ 	]*[a-f0-9]+:	e8 fe ff             	call   0x71	71: R_386_PC16	xxx
 [ 	]*[a-f0-9]+:	ff 16 00 00          	call   \*0x0	75: R_386_16	xxx
 [ 	]*[a-f0-9]+:	ff d7                	call   \*%di
@@ -47,4 +47,8 @@ Disassembly of section .text:
 [ 	]*[a-f0-9]+:	ff 27                	jmp    \*\(%bx\)
 [ 	]*[a-f0-9]+:	ff 2f                	ljmp   \*\(%bx\)
 [ 	]*[a-f0-9]+:	66 ff 2f             	ljmpl  \*\(%bx\)
+[ 	]*[a-f0-9]+:	eb 00                	jmp    0xa2
+[ 	]*[a-f0-9]+:	90                   	nop
+[ 	]*[a-f0-9]+:	eb 00                	jmp    0xa5
+[ 	]*[a-f0-9]+:	90                   	nop
 #pass
Index: testsuite/gas/i386/jump16.s
===================================================================
--- testsuite/gas/i386/jump16.s	(revision 6033)
+++ testsuite/gas/i386/jump16.s	(working copy)
@@ -50,3 +50,7 @@
 	jmp	word ptr [bx]
 	jmp	dword ptr [bx]
 	jmp	fword ptr [bx]
+	jmp	$+2
+	nop
+	jmp	.+2
+	nop
Index: testsuite/gas/i386/jump.d
===================================================================
--- testsuite/gas/i386/jump.d	(revision 6033)
+++ testsuite/gas/i386/jump.d	(working copy)
@@ -32,4 +32,8 @@ Disassembly of section .text:
 [ 	]*[a-f0-9]+:	66 ff 23             	jmpw   \*\(%ebx\)
 [ 	]*[a-f0-9]+:	ff 23                	jmp    \*\(%ebx\)
 [ 	]*[a-f0-9]+:	ff 2b                	ljmp   \*\(%ebx\)
+[ 	]*[a-f0-9]+:	eb 00                	jmp    0x7b
+[ 	]*[a-f0-9]+:	90                   	nop
+[ 	]*[a-f0-9]+:	eb 00                	jmp    0x7e
+[ 	]*[a-f0-9]+:	90                   	nop
 #pass
Index: testsuite/gas/i386/jump.s
===================================================================
--- testsuite/gas/i386/jump.s	(revision 6033)
+++ testsuite/gas/i386/jump.s	(working copy)
@@ -31,3 +31,7 @@
 	jmp	word ptr [ebx]
 	jmp	dword ptr [ebx]
 	jmp	fword ptr [ebx]
+	jmp	$+2
+	nop
+	jmp	.+2
+	nop
Index: config/tc-i386-intel.c
===================================================================
--- config/tc-i386-intel.c	(revision 6033)
+++ config/tc-i386-intel.c	(working copy)
@@ -475,6 +475,11 @@ i386_intel_operand (char *operand_string
   saved_input_line_pointer = input_line_pointer;
   input_line_pointer = buf = xstrdup (operand_string);
 
+  /* A '$' followed by an identifier char is an identifier.  Otherwise,
+     it's operator '.' followed by an expression.  */
+  if (*buf == '$' && !is_identifier_char (buf[1]))
+    *buf = '.';
+
   intel_syntax = -1;
   memset (&exp, 0, sizeof(exp));
   exp_seg = expression (&exp);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]