Advertisement

Assembly on linux using as

Started by November 26, 2005 01:47 AM
0 comments, last by CRACK123 18 years, 10 months ago
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
The more applications I write, more I find out how less I know
I figured int out.
Thanks
The more applications I write, more I find out how less I know

This topic is closed to new replies.

Advertisement