This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[patch] Swap relocs when using intel syntax in i386 GAS
- To: binutils at sourceware dot cygnus dot com
- Subject: [patch] Swap relocs when using intel syntax in i386 GAS
- From: Diego Novillo <dnovillo at redhat dot com>
- Date: Thu, 30 Nov 2000 14:16:10 -0500
- Organization: Red Hat Canada
This problem started when compiling C++ code with -fPIC and
-mintel-syntax. It turns out that GAS was not swapping
i.disp_reloc properly.
This patch fixes the problem. I also added a new test for
intel.s.
OK to install?
2000-11-30 Diego Novillo <dnovillo@redhat.com>
* tc-i386.c (md_assemble): Swap i.disp_relocs when using intel
syntax.
2000-11-30 Diego Novillo <dnovillo@redhat.com>
* intel.s, intel.d: New test for @GOT references.
Index: tc-i386.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-i386.c,v
retrieving revision 1.66
diff -d -c -p -r1.66 tc-i386.c
*** tc-i386.c 2000/11/17 18:15:53 1.66
--- tc-i386.c 2000/11/30 17:58:04
*************** md_assemble (line)
*** 1383,1388 ****
--- 1383,1393 ----
{
union i386_op temp_op;
unsigned int temp_type;
+ #ifdef BFD_ASSEMBLER
+ enum bfd_reloc_code_real temp_disp_reloc;
+ #else
+ int temp_disp_reloc;
+ #endif
int xchg1 = 0;
int xchg2 = 0;
*************** md_assemble (line)
*** 1402,1407 ****
--- 1407,1415 ----
temp_op = i.op[xchg2];
i.op[xchg2] = i.op[xchg1];
i.op[xchg1] = temp_op;
+ temp_disp_reloc = i.disp_reloc[xchg2];
+ i.disp_reloc[xchg2] = i.disp_reloc[xchg1];
+ i.disp_reloc[xchg1] = temp_disp_reloc;
if (i.mem_operands == 2)
{
Index: intel.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/i386/intel.d,v
retrieving revision 1.5
diff -d -c -p -r1.5 intel.d
*** intel.d 2000/11/20 21:16:26 1.5
--- intel.d 2000/11/30 18:01:17
*************** Disassembly of section .text:
*** 624,626 ****
--- 624,627 ----
a7d: 90 [ ]*nop
a7e: 90 [ ]*nop
a7f: 90 [ ]*nop
+ a80: 8b 83 00 00 00 00 [ ]*mov 0x0\(%ebx\),%eax
Index: intel.s
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/i386/intel.s,v
retrieving revision 1.5
diff -d -c -p -r1.5 intel.s
*** intel.s 2000/11/20 21:16:26 1.5
--- intel.s 2000/11/30 18:01:27
*************** rot5:
*** 619,621 ****
--- 619,622 ----
nop
nop
nop
+ mov eax, DWORD PTR gs_foo@GOT[ebx]