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