下载

brew install nasm
  • code
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 -o asm1.o asm1.asm
  • 错误链接命令

    ld -o asm1 -e _main asm1.o
  • 提示如下

    ld: dynamic main executables must link with libSystem.dylib for architecture x86_64
  • 正确链接

# 方式一   -macosx_version_min 10.15你的Mac版本
ld -o asm1 -e _main asm1.o -macosx_version_min 10.15 -static
# 方式二 ,会提示警告 ,如下
ld -o asm1 -e _main asm1.o -macosx_version_min 10.15 -lSystem
  • 警告如下

    ld: warning: PIE disabled. Absolute addressing (perhaps -mdynamic-no-pic) not allowed in code signed PIE, but used in _main from asm1.o. To fix this warning, don't compile with -mdynamic-no-pic or link with -Wl,-no_pie

最新文章

  1. 如何修改 Total commander 配置文件的路径
  2. fname
  3. jquery 的 sort 函数
  4. IntelliJ IDEA 的 Jetty部署插件
  5. Jquery 操作Html 控件 CheckBox、Radio、Select 控件 【转】http://www.cnblogs.com/lxblog/archive/2013/01/09/2853056.html
  6. 打开自定义链接新窗口(safari JS prompt的坑!)2016.03.08
  7. IIC的标准操作函数集(C51)包含C和H文件
  8. 报错:loaded the "" nib but didn't get a UITableView
  9. 积累的VC编程小技巧之按钮
  10. Oracle-4 - :超级适合初学者的入门级笔记:plsql,基本语法,记录类型,循环,游标,异常处理,存储过程,存储函数,触发器
  11. 使用tkinter加载png,jpg
  12. Cocos2D实现上下滚动式状态窗口
  13. 26 python 初学(线程、同步锁、死锁和递归锁)
  14. CentOS7 搭建 SVN 服务器
  15. 13个.Net开源的网络爬虫
  16. Quartus II 中 Verilog 常见警告/错误汇总
  17. python 时间戳算法
  18. 轮询、中断、DMA和通道
  19. springboot学习过程笔记
  20. corejDay1

热门文章

  1. ubuntu16.04 通过命令,修改屏幕分辨率
  2. Linux_权限管理理论概述
  3. gpcj-07.为什么是连锁零售类公司
  4. python3 xlrd包的用法
  5. 10.4 route:显示或管理路由表
  6. 信息学C++教程<-3->输入输出格式控制
  7. Linux C 进程
  8. 关于lua闭包导致引用无法释放内存泄露
  9. APA自动泊车系统
  10. 2019个嵌入式市场研究,持续的C/C++优势