SECTION .data msg: db "Hello World!", 0x0a len: equ $-msg SECTION .text global _main kernel: syscall ret _main: mov rax,0x2000004 mov rdi,1 mov rsi,msg mov rdx,len call kernel mov rax,0x2000001 mov rdi,0 call kernel
编译这个文件:
nasm -f macho64 hello.asm
ld -o hello -e _main hello.o -macosx_version_min 10.13 -lSystem
运行这个文件: