Assembly 错误:未知指令。类型func,@function
上面是我正在运行的程序。我把它归结为我似乎找不到答案的最后一个错误。 错误消息听起来如下所示:Assembly 错误:未知指令。类型func,@function,assembly,Assembly,上面是我正在运行的程序。我把它归结为我似乎找不到答案的最后一个错误。 错误消息听起来如下所示: .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
.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
我使用gcc-m32 test.s
和ggc-c test.s
在Macintosh 10.9.1上编译了它。
我在谷歌上搜索答案,但似乎找不到任何答案。这是AT&T语法。Mach-O汇编程序不使用此指令。你应该省略它。还有其他一些区别。您是否尝试过.type func STT_func中的其他语法
.type STT_
test.s:19:1: error: unknown directive
.type func, @function
^