Summary: | .intel_syntax misassembles a forward-referenced .equ as a data reference | ||
---|---|---|---|
Product: | binutils | Reporter: | Josh Triplett <josh> |
Component: | gas | Assignee: | unassigned |
Status: | RESOLVED WONTFIX | ||
Severity: | normal | CC: | bug-binutils |
Priority: | P2 | ||
Version: | 2.20 | ||
Target Milestone: | --- | ||
Host: | x86_64-linux-gnu | Target: | x86_64-linux-gnu |
Build: | x86_64-linux-gnu | Last reconfirmed: |
Description
Josh Triplett
2010-04-27 01:51:02 UTC
I originally observed this bug in in 16-bit assembly with .code16, but as shown in this report I can also reproduce it in 64-bit assembly. When assembler sees mov ax, AN_EQU AN_EQU is undefined and treats it as a symbol. Later AN_EQU is resolved to 5. For mov $AN_EQU, %ax assembler knows the operand is an immediate due to `$'. There is not much assembler can do here. If the assembler knows enough to go back and substitute the value afterward, it knows that it emitted a data reference when it should have emitted an immediate. It could at least spit out an error at that point rather than assembling incorrect code; that would have saved me an hour of debugging and disassembly. Also, the assembler seems to support forward references in various other places; why not for equates? |