.data
x: .long 2
r: .long 27
.text
.globl _start
_start:
pushl x
movl $0,%eax
call func
addl $4,%esp
movl %eax,r
movl r,%ebx
movl $1,%eax
int $0x80
.type func, @function
func:
pushl %ebp
movl %esp,%ebp
movl 8(%ebp),%eax
cmpl $0,%eax
jle if
jmp else
if: movl %ebx,%eax
jmp endif
else: addl %eax,%ebx
subl $1,%eax
pushl %eax
call func
addl $4,%esp
endif: movl %ebp,%esp
popl %ebp
ret
Above you see the program i am trying to run. I boiled it down to one last error which i can't seem to find the answer to. The error message sound as following:
test.s:19:1: error: unknown directive
.type func, @function
^
I compiled it on a Macintosh 10.9.1 using gcc -m32 test.s
and ggc -c test.s
.
I browsed Google looking for answers, but i can't seem to find any. It is the AT&T syntax.
This directive simply isn't used by the Mach-O assembler. It You should omit it. There are some other differences here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With