Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Assembly 错误:未知指令。类型func,@function_Assembly - Fatal编程技术网

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
^