我找到了“你好世界”并写了下来。
纳诺你好
此代码
.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
我错在哪里了?
付款交单:Debian,AMD64。
最佳答案
尝试.globl _start
或.global _start
。
如果您遇到入口点问题,可以尝试未理解的start
。
最后,如果要生成64位可执行文件,可能需要使用不同的系统调用接口,而不是int 0x80
而是syscall
。更多关于here。
关于linux - 我如何开始学习asm(gas)?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/14901689/