汇编语言的helloworld

2021-02-03  本文已影响0人  一路向后

1.源码实现

#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

2.编译源码

$ gcc -c hello.s
$ ld -o hello hello.o

3.执行程序

$ ./hello
Hello, world!
上一篇 下一篇

猜你喜欢

热点阅读