Update nasm
mac comes with nasm, but, but, but, old mess.
apple version
brew install nasm
After installing after the restart.
The latest version of
Write compile and run
After that and write c almost the same. But we have to pay attention to some, write 32, 64 write, all right.
- 64:
64
nasm -f macho64 -o helloworld.o helloworld.asm
ld -o helloworld -e _main helloworld.o
./helloworld
run
- 32:
32
run
At last
I compile Buddha department was recently also began to seriously learn. I remember like point like oh, there are comments or comments area ~
Reference article:
http://gaoryrt.com/2015/11-18-assembly/
https://blog.csdn.net/u011987514/article/details/72615406
Reprinted address: https: //www.jianshu.com/p/3de6731bc5ff