您的位置:首页 > 运维架构 > Linux

Linux下最简单的汇编程序

2008-06-30 21:13 295 查看
.data
msg :.string "Hello World!"
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
存为hello.s
然后:as -o hello.o hello.s(汇编成.o文件)
然后:ld -s -o hello hello.o(链接成可执行文件)
然后运行:./hello
呵,OK了!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: