This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PATCH: gas/4460: x86 assembler is broken
- From: "H. J. Lu" <hjl at lucon dot org>
- To: Alan Modra <amodra at bigpond dot net dot au>
- Cc: binutils at sources dot redhat dot com
- Date: Thu, 3 May 2007 16:30:31 -0700
- Subject: PATCH: gas/4460: x86 assembler is broken
The problem is an operand may have 2 trailing white spaces while
operand () in expr.c only expects one. Add --enable-checking to gas
triggers this problem. We can change the generic part of assembler
or change x86 assembler to remove the extra trailing white space.
Here is a patch to change x86 assembler. I will check it in if the
problem isn't fixed in 24 hours.
H.J.
---
gas/
2007-05-03 H.J. Lu <hongjiu.lu@intel.com>
PR gas/4460
* config/tc-i386.c (i386_displacement): Remove trailing white
space.
gas/testsuite/
2007-05-03 H.J. Lu <hongjiu.lu@intel.com>
PR gas/4460
* gas/i386/gotpc.s: Add a new test.
* gas/i386/reloc64.s: Likewise.
* gas/i386/gotpc.d: Updated.
* gas/i386/reloc64.d: Likewise.
--- gas/config/tc-i386.c.space 2007-05-03 14:08:08.000000000 -0700
+++ gas/config/tc-i386.c 2007-05-03 16:10:09.000000000 -0700
@@ -4770,6 +4770,11 @@ i386_displacement (char *disp_start, cha
i.disp_operands++;
save_input_line_pointer = input_line_pointer;
input_line_pointer = disp_start;
+
+ /* There may be one white space. */
+ if (disp_end[-1] == ' ')
+ disp_end--;
+
END_STRING_AND_SAVE (disp_end);
#ifndef GCC_ASM_O_HACK
--- gas/testsuite/gas/i386/gotpc.d.space 2002-08-08 17:10:19.000000000 -0700
+++ gas/testsuite/gas/i386/gotpc.d 2007-05-03 16:21:01.000000000 -0700
@@ -49,4 +49,6 @@ Disassembly of section .text:
e0: e0 00 [ ]*loopne e2 <test\+0xe2> e0: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
e2: 00 00 [ ]*add %al,\(%eax\)
e4: 00 00 [ ]*add %al,\(%eax\) e4: (R_386_)?GOTOFF _GLOBAL_OFFSET_TABLE_
- ...
+ e6: 00 00 [ ]*add %al,\(%eax\)
+ e8: 8b 83 00 00 00 00 [ ]*mov 0x0\(%ebx\),%eax ea: (R_386_)?GOTOFF _GLOBAL_OFFSET_TABLE_
+#pass
--- gas/testsuite/gas/i386/gotpc.s.space 2002-08-08 17:10:19.000000000 -0700
+++ gas/testsuite/gas/i386/gotpc.s 2007-05-03 16:19:44.000000000 -0700
@@ -38,3 +38,4 @@ test:
movl _GLOBAL_OFFSET_TABLE_@GOTOFF(%ebx), %ebx
.long _GLOBAL_OFFSET_TABLE_+[.-test]
.long _GLOBAL_OFFSET_TABLE_@GOTOFF
+ movl _GLOBAL_OFFSET_TABLE_@GOTOFF (%ebx), %eax
--- gas/testsuite/gas/i386/reloc64.d.space 2006-03-23 00:23:09.000000000 -0800
+++ gas/testsuite/gas/i386/reloc64.d 2007-05-03 16:14:07.000000000 -0700
@@ -47,6 +47,7 @@ Disassembly of section \.text:
.*[ ]+R_X86_64_TPOFF64[ ]+xtrn
.*[ ]+R_X86_64_TPOFF32[ ]+xtrn
.*[ ]+R_X86_64_TPOFF32[ ]+xtrn
+.*[ ]+R_X86_64_TPOFF32[ ]+xtrn
Disassembly of section \.data:
#...
.*[ ]+R_X86_64_64[ ]+xtrn
--- gas/testsuite/gas/i386/reloc64.s.space 2006-03-23 00:23:09.000000000 -0800
+++ gas/testsuite/gas/i386/reloc64.s 2007-05-03 16:07:09.000000000 -0700
@@ -195,3 +195,6 @@ bad .byte xtrn@gottpoff
bad .byte xtrn@tlsld
bad .byte xtrn@dtpoff
bad .byte xtrn@tpoff
+
+ .text
+ mov xtrn@tpoff (%rbx), %eax