Invalid instruction suffix for push when assembling with gas

Posted by vitaut on Stack Overflow See other posts from Stack Overflow or by vitaut
Published on 2011-06-07T16:49:27Z Indexed on 2011/06/23 16:22 UTC
Read the original article Hit count: 246

When assembling a file with GNU assembler I get the following error:

hello.s:6: Error: invalid instruction suffix for `push'

Here's the file that I'm trying to assemble:

        .text
LC0:
        .ascii "Hello, world!\12\0"
.globl _main
_main:
        pushl   %ebp
        movl    %esp, %ebp
        subl    $8, %esp
        andl    $-16, %esp
        movl    $0, %eax
        movl    %eax, -4(%ebp)
        movl    -4(%ebp), %eax
        call    __alloca
        call    ___main
        movl    $LC0, (%esp)
        call    _printf
        movl    $0, %eax
        leave
        ret

What is wrong here and how do I fix it?

© Stack Overflow or respective owner

Related posts about linux

Related posts about assembly