我最近开始阅读 《从零开始编程》(PDF),但在第一个程序中遇到了问题。这个程序非常简单:
但是在编译和运行时,我遇到了错误
我正在使用 x86_64 指令集(Intel 处理器)。
.section .data
.section .text
.globl _start
_start:
movl $1, %eax
movl $0, %ebx
int $0x80
但是在编译和运行时,我遇到了错误
非法指令: 4
。我已经编辑了程序,以便它可以正确编译(删除了两个 .section
并将 _start
更改为 _main
),所以这可能会影响它。我正在使用 x86_64 指令集(Intel 处理器)。
fork
(2)系统调用呢?也许你需要exit
(1)系统调用? - kharvdgcc
。 - Jumhyn$ ld exit -o exit/ ld: warning: -macosx_version_min not specificed, assuming 10.7/ Undefined symbols for architecture x86_64:/ "start", referenced from:/ -u command line option/ (maybe you meant: _start)/ ld: symbol(s) not found for inferred architecture x86_64
- Jumhynas exit.s -o exit.o && ld exit.o -o exit
进行编译。 - kharvd