标签:term ble macbook develop 安装路径 cos 14. rmi 汇编
which nasm
查看nasm的安装路径,Mac系统默认安装了nasm.一般默认返回的路径是/usr/bin/nasmalias nasm=/usr/bin/nasm
nasm -v
如果配置成功的话,就会返回nasm的版本号NASM version 2.14.02 compiled on Dec 27 2018
,macs-MacBook-Pro:~ mac$ nasm nasm: error: unable to find utility "nasm", not a developer tool or in PATH
如果第一种方法配置失败了,那么考虑第二种方法。重装nasm
brew reinstall nasm
vim helloworld.asm
,新建helloworld文件,文件类型为asmSECTION .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 -o helloworld.o helloworld.asm
ld -o helloworld -e _main helloworld.o -macosx_version_min 10.13 -lSystem
./helloworld
Hello World!
标签:term ble macbook develop 安装路径 cos 14. rmi 汇编
原文地址:https://www.cnblogs.com/overlows/p/10834757.html