[Top][All Lists]

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

[Bug gas/291] New: GAS assemble direct constant as memory reference

From: egarrulo at muchomail dot com
Subject: [Bug gas/291] New: GAS assemble direct constant as memory reference
Date: 28 Jul 2004 18:28:31 -0000


   in the following code snippet, GAS assemble what should
be a direct constant as it were a memory reference.

binutils 2.15.90
GAS version 2.15.90
Platform Windows XP.

Comments show the interesting line. Comments follow.


.intel_syntax noprefix

        Format: .asciz "FormatLen = %d - %d\n"
        FormatLen= . - Format # FormatLen=0x15


.global _main

        push ebp
        mov ebp, esp

        # Following instruction assembles as
        # it were written:       
        # push dword ptr [0x15]
        push FormatLen
        # whereas it should be just like:       
        push 0x15
        push offset Format
        call _printf
        add esp, 12
        xor eax, eax
        mov esp, ebp    
        pop ebp


Maybe that doesn't show up in AT&T syntax because
constants are $-prefixed.

As far as I know, Intel syntax is:

- Load a constant (note no brackets):

    mov eax, 0x12

   which should also be for symbolic constants

- Load the value at the specified address (note brackets):

    mov eax, dword ptr [myLabel]

- Load address (note the OFFSET keyword):

    mov eax, offset myLabel

Thank you for your attention. And thank you all for your work
aimed to allowing Windows users easy access to GNU tools.

           Summary: GAS assemble direct constant as memory reference
           Product: binutils
           Version: 2.15
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gas
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: egarrulo at muchomail dot com
                CC: bug-binutils at gnu dot org


------- 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]