bug-binutils
[Top][All Lists]
Advanced

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

[Bug gas/11544] New: .intel_syntax misassembles a forward-referenced .eq


From: josh at joshtriplett dot org
Subject: [Bug gas/11544] New: .intel_syntax misassembles a forward-referenced .equ as a data reference
Date: 27 Apr 2010 01:51:02 -0000

The following three-line text case assembles incorrectly:

.intel_syntax noprefix
    mov ax, AN_EQU
.equ AN_EQU, 5

Compiled with "gcc -c test.S"

Disassembled with "objdump -M intel -d test.o":

   0:   66 8b 04 25 05 00 00    mov    ax,WORD PTR ds:0x5
   7:   00 

For some reason, this assembled as a memory dereference of ds:0x5.  Somehow, gas
knew enough to substitute the value 5, but didn't know to treat it as an 
immediate.

If I move the equate before the instruction, it assembles correctly:

.intel_syntax noprefix
.equ AN_EQU, 5
    mov ax, AN_EQU

   0:   66 b8 05 00             mov    ax,0x5

If I substitute a literal 5 in the instruction, it assembles correctly:

.intel_syntax noprefix
    mov ax, 5

   0:   66 b8 05 00             mov    ax,0x5

And if I use AT&T syntax, it assembles correctly:

.att_syntax 
    mov $AN_EQU, %ax
.equ AN_EQU, 5

   0:   66 b8 05 00             mov    ax,0x5

-- 
           Summary: .intel_syntax misassembles a forward-referenced .equ as
                    a data reference
           Product: binutils
           Version: 2.20
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gas
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: josh at joshtriplett dot org
                CC: bug-binutils at gnu dot org
 GCC build triplet: x86_64-linux-gnu
  GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu


http://sourceware.org/bugzilla/show_bug.cgi?id=11544

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




reply via email to

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