我找到了“你好世界”并写下了它。 nano hello.s
此代码
.data
msg:
.string "Hello, world!\n"
len = . - msg
.text
global _start
_start:
movl $len,%edx
movl $msg,%ecx
movl $1,%ebx
movl $4,%eax
int $0x80
movl $0,%ebx
movl $1,%eax
int $0x80
我已完成as -o hello.o hello.s
我发错了
hello.s:6: Error: no such instruction: global _start
delete global _start.
我已经完成了
ld -s -o hello.o hello*
error
ld: hello: No such file: No such file or directory
我错在哪里?
p / s debian,amd64。
答案 0 :(得分:2)
尝试.globl _start
或.global _start
。
如果您遇到入口点问题,可以尝试ununderscored start
。
最后,如果您正在制作64位可执行文件,则可能需要使用其他系统调用界面,而不是int 0x80
而是syscall
。更多关于here。