Sign in to follow this  
CRACK123

Assembly on linux using as

Recommended Posts

Hi, I am trying to learn assembly using GAS syntax. However I get a bunch of errors on doing as -o file.o file.S This is the source program
[Source]
.data                           # section declaration

msg:
        .ascii "Hello, World!\n"
        len = . - msg

.text

        .global _start

_start:

# write string to stdout
        movl $len,%edx
        movl $msg,%ecx
        movl $1,%ebx
        movl $4,%eax
        int $0x80

# and exit
        movl $0,%ebx
        movl $1,%eax
        int $0x80


I get the following on errors on trying to build the object file as: "hello.S", line 1: error: invalid character (0x73) as: "hello.S", line 1: error: statement syntax as: "hello.S", line 14: error: unknown "%"-symbol as: "hello.S", line 14: error: statement syntax as: "hello.S", line 15: error: unknown "%"-symbol as: "hello.S", line 15: error: statement syntax as: "hello.S", line 16: error: unknown "%"-symbol as: "hello.S", line 16: error: statement syntax as: "hello.S", line 17: error: unknown "%"-symbol as: "hello.S", line 17: error: statement syntax as: "hello.S", line 18: error: unknown opcode "int" as: "hello.S", line 18: error: statement syntax as: "hello.S", line 21: error: unknown "%"-symbol as: "hello.S", line 21: error: statement syntax as: "hello.S", line 22: error: unknown "%"-symbol as: "hello.S", line 22: error: statement syntax as: "hello.S", line 23: error: unknown opcode "int" as: "hello.S", line 23: error: statement syntax I am not sure how to interpret these errors as I am still trying to learn assembly and have no idea of its syntax in general. Any help would be appreciated. Thanks

Share this post


Link to post
Share on other sites
Sign in to follow this