freebsd at&t 汇编 hello world
.section .data //数据段
msg: .ascii "hello world\n\0"
.set len,.-msg //得到字符串长度
.section .text
.globl _start //入口
_start:
push $len
pushl $msg
pushl $0x01
pushl $0x00
movl $0x04,%eax
int $0x80
pushl %eax
pushl $0x00
movl $01,%eax
int $0x80
使用as编译链接
$as hello.s -o hello.o
$ld hello.o -o hello.bin
$./hello.bin