dyld binding test
=========================================================================
a.c
----------------------------------
void main (int argc, char **argv) {
printf ("Salve, Munde!\n");
printf ("Vale!\n");
exit();
}
=========================================================================
dyldinfo -lazy_bind a
----------------------------------
lazy binding information (from lazy_bind part of dyld info):
segment section address index dylib symbol
__DATA __la_symbol_ptr 0x100001010 0x0000 libSystem _exit
__DATA __la_symbol_ptr 0x100001018 0x000C libSystem _printf
=========================================================================
otool -p _main -tV
----------------------------------
a:
(__TEXT,__text) section
_main:
0000000100000f10 pushq %rbp
0000000100000f11 movq %rsp, %rbp
0000000100000f14 subq $0x20, %rsp
0000000100000f18 leaq 0x61(%rip), %rax ## literal pool for: "Salve, Munde!
"
0000000100000f1f movl %edi, -0x4(%rbp)
0000000100000f22 movq %rsi, -0x10(%rbp)
0000000100000f26 movq %rax, %rdi
0000000100000f29 movb $0x0, %al
0000000100000f2b callq 0x100000f54 ## symbol stub for: _printf <------
0000000100000f30 leaq 0x58(%rip), %rdi ## literal pool for: "Vale!
"
0000000100000f37 movl %eax, -0x14(%rbp)
0000000100000f3a movb $0x0, %al
0000000100000f3c callq 0x100000f54 ## symbol stub for: _printf <------
0000000100000f41 movl $0x0, %edi
0000000100000f46 movl %eax, -0x18(%rbp)
0000000100000f49 callq 0x100000f4e ## symbol stub for: _exit <------
=========================================================================
otool -l -V a
----------------------------------
a:
Load command
cmd LC_SEGMENT_64
cmdsize
segname __PAGEZERO
vmaddr 0x0000000000000000
vmsize 0x0000000100000000
fileoff
filesize
maxprot ---
initprot ---
nsects
flags (none)
Load command
cmd LC_SEGMENT_64
cmdsize
segname __TEXT
vmaddr 0x0000000100000000
vmsize 0x0000000000001000
fileoff
filesize
maxprot rwx
initprot r-x
nsects
flags (none)
Section
sectname __text
segname __TEXT
addr 0x0000000100000f10
size 0x000000000000003e
offset
align ^ ()
reloff
nreloc
type S_REGULAR
attributes PURE_INSTRUCTIONS SOME_INSTRUCTIONS
reserved1
reserved2
Section
sectname __stubs
segname __TEXT
addr 0x0000000100000f4e <------
size 0x000000000000000c
offset
align ^ ()
reloff
nreloc
type S_SYMBOL_STUBS
attributes PURE_INSTRUCTIONS SOME_INSTRUCTIONS
reserved1 (index into indirect symbol table)
reserved2 (size of stubs)
Section
sectname __stub_helper
segname __TEXT
addr 0x0000000100000f5c
size 0x0000000000000024
offset
align ^ ()
reloff
nreloc
type S_REGULAR
attributes PURE_INSTRUCTIONS SOME_INSTRUCTIONS
reserved1
reserved2
Section
sectname __cstring
segname __TEXT
addr 0x0000000100000f80
size 0x0000000000000016
offset
align ^ ()
reloff
nreloc
type S_CSTRING_LITERALS
attributes (none)
reserved1
reserved2
Section
sectname __unwind_info
segname __TEXT
addr 0x0000000100000f96
size 0x0000000000000048
offset
align ^ ()
reloff
nreloc
type S_REGULAR
attributes (none)
reserved1
reserved2
Section
sectname __eh_frame
segname __TEXT
addr 0x0000000100000fe0
size 0x0000000000000018
offset
align ^ ()
reloff
nreloc
type S_REGULAR
attributes (none)
reserved1
reserved2
Load command
cmd LC_SEGMENT_64
cmdsize
segname __DATA
vmaddr 0x0000000100001000
vmsize 0x0000000000001000
fileoff
filesize
maxprot rwx
initprot rw-
nsects
flags (none)
Section
sectname __nl_symbol_ptr
segname __DATA
addr 0x0000000100001000
size 0x0000000000000010
offset
align ^ ()
reloff
nreloc
type S_NON_LAZY_SYMBOL_POINTERS
attributes (none)
reserved1 (index into indirect symbol table)
reserved2
Section
sectname __la_symbol_ptr
segname __DATA
addr 0x0000000100001010
size 0x0000000000000010
offset
align ^ ()
reloff
nreloc
type S_LAZY_SYMBOL_POINTERS
attributes (none)
reserved1 (index into indirect symbol table)
reserved2
Load command
cmd LC_SEGMENT_64
cmdsize
segname __LINKEDIT
vmaddr 0x0000000100002000
vmsize 0x0000000000001000
fileoff
filesize
maxprot rwx
initprot r--
nsects
flags (none)
Load command
cmd LC_DYLD_INFO_ONLY
cmdsize
rebase_off
rebase_size
bind_off
bind_size
weak_bind_off
weak_bind_size
lazy_bind_off
lazy_bind_size
export_off
export_size
Load command
cmd LC_SYMTAB
cmdsize
symoff
nsyms
stroff
strsize
Load command
cmd LC_DYSYMTAB
cmdsize
ilocalsym
nlocalsym
iextdefsym
nextdefsym
iundefsym
nundefsym
tocoff
ntoc
modtaboff
nmodtab
extrefsymoff
nextrefsyms
indirectsymoff
nindirectsyms
extreloff
nextrel
locreloff
nlocrel
Load command
cmd LC_LOAD_DYLINKER
cmdsize
name /usr/lib/dyld (offset )
Load command
cmd LC_UUID
cmdsize
uuid AAF0A21D-08BD-30FB-BB08-2A3352D9D4B9
Load command
cmd LC_VERSION_MIN_MACOSX
cmdsize
version .
sdk .
Load command
cmd LC_SOURCE_VERSION
cmdsize
version .
Load command
cmd LC_MAIN
cmdsize
entryoff
stacksize
Load command
cmd LC_LOAD_DYLIB
cmdsize
name /usr/lib/libSystem.B.dylib (offset )
time stamp Thu Jan ::
current version ..
compatibility version ..
Load command
cmd LC_FUNCTION_STARTS
cmdsize
dataoff
datasize
Load command
cmd LC_DATA_IN_CODE
cmdsize
dataoff
datasize
Load command
cmd LC_DYLIB_CODE_SIGN_DRS
cmdsize
dataoff
datasize
=========================================================================
nm a | grep "U "
----------------------------------
U _exit
U _printf
U dyld_stub_binder
=========================================================================
nm a | wc -l
---------------------------------- =========================================================================
x/2i 0x100000f4e
----------------------------------
0x100000f4e <dyld_stub_exit>: jmpq *0xbc(%rip) # 0x100001010 <------
0x100000f54 <dyld_stub_printf>: jmpq *0xbe(%rip) # 0x100001018 <------
=========================================================================
x/g 0x100001010
----------------------------------
0x100001010: 0x0000000100000f6c <------
=========================================================================
x/g 0x100001018
----------------------------------
0x100001018: 0x0000000100000f76 <------
=========================================================================
x/2i 0x0000000100000f6c <------
----------------------------------
0x100000f6c: pushq $0x0
0x100000f71: jmpq 0x100000f5c <------
=========================================================================
x/2i 0x0000000100000f76 <------
----------------------------------
0x100000f76: pushq $0xc
0x100000f7b: jmpq 0x100000f5c <------
=========================================================================
x/3i 0x100000f5c
----------------------------------
0x100000f5c: lea 0xa5(%rip),%r11 # 0x100001008
0x100000f63: push %r11
0x100000f65: jmpq *0x95(%rip) # 0x100001000 <------
=========================================================================
x/2g 0x100001000
----------------------------------
0x100001000: 0x0000000000000000 0x0000000000000000
=========================================================================
b main
----------------------------------
r
----------------------------------
x/2g 0x100001000
----------------------------------
0x100001000: 0x00007fff8a2bc210 <------ 0x0000000000000000
=========================================================================
disass 0x00007fff8a2bc210
----------------------------------
Dump of assembler code for function dyld_stub_binder:
0x00007fff8a2bc210 <dyld_stub_binder+>: push %rbp
0x00007fff8a2bc211 <dyld_stub_binder+>: mov %rsp,%rbp
0x00007fff8a2bc214 <dyld_stub_binder+>: sub $0x140,%rsp
0x00007fff8a2bc21b <dyld_stub_binder+>: mov %rdi,(%rsp)
0x00007fff8a2bc21f <dyld_stub_binder+>: mov %rsi,0x8(%rsp)
0x00007fff8a2bc224 <dyld_stub_binder+>: mov %rdx,0x10(%rsp)
0x00007fff8a2bc229 <dyld_stub_binder+>: mov %rcx,0x18(%rsp)
0x00007fff8a2bc22e <dyld_stub_binder+>: mov %r8,0x20(%rsp)
0x00007fff8a2bc233 <dyld_stub_binder+>: mov %r9,0x28(%rsp)
0x00007fff8a2bc238 <dyld_stub_binder+>: mov %rax,0x30(%rsp)
End of assembler dump.
=========================================================================
x/i dyld_stub_exit
----------------------------------
0x100000f4e <dyld_stub_exit>: jmpq *0xbc(%rip) # 0x100001010
=========================================================================
x/i dyld_stub_printf
----------------------------------
0x100000f54 <dyld_stub_printf>: jmpq *0xbe(%rip) # 0x100001018
=========================================================================
x/g 0x100001018
----------------------------------
0x100001018: 0x0000000100000f76
=========================================================================
x/2i 0x0000000100000f76
----------------------------------
0x100000f76: pushq $0xc
0x100000f7b: jmpq 0x100000f5c
=========================================================================
b *0x0000000100000f2b
b *0x0000000100000f3c
=========================================================================
x/g 0x100001018
----------------------------------
0x100001018: 0x0000000100000f76
=========================================================================
x/2i 0x0000000100000f76
----------------------------------
0x100000f76: pushq $0xc
0x100000f7b: jmpq 0x100000f5c
=========================================================================
x/g 0x100001018
----------------------------------
0x100001018: 0x00007fff883ba8a8
=========================================================================
x/2i 0x00007fff883ba8a8
----------------------------------
0x7fff883ba8a8 <printf>: push %rbp
0x7fff883ba8a9 <printf+>: mov %rsp,%rbp
=========================================================================
dyld binding test的更多相关文章
- CURL命令报错:dyld: lazy symbol binding failed: Symbol not found: _SSL_load_error_strings解决办法
Mac OS X 10.11.6, curl 命令报错,错误如下: dyld: lazy symbol binding failed: Symbol not found: _SSL_load_erro ...
- dyld: lazy symbol binding failed: Symbol not found: ___sincosf_stret
This is the error I get: dyld: lazy symbol binding failed: Symbol not found: ___sincosf_stret Refere ...
- dyld: lazy symbol binding failed: Symbol not found: _objc_setProperty_nonatomic
这个错误,一般在高版本设备里面不会出现,而在低版本会出现比如你的项目或者引入的静态库的Deployment Target设置成了ios6.0而你的测试设备是ios5.0甚至更低,就会出现如上错误.因为 ...
- dyld
一.介绍 在 MacOS 和 iOS 上,可执行程序的启动依赖于 xnu 内核进程运作和动态链接加载器 dyld. dyld 全称 the dynamic link editor,即动态链接器,其本质 ...
- org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): da.huying.usermanag ...
- WPF binding 参考
Introduction This is an article on WPF Binding Cheat Sheet. Some of the Binding won't work for Silve ...
- 十五天精通WCF——第一天 三种Binding让你KO80%的业务
转眼wcf技术已经出现很多年了,也在.net界混的风生水起,同时.net也是一个高度封装的框架,作为在wcf食物链最顶端的我们所能做的任务已经简单的不能再简单了, 再简单的话马路上的大妈也能写wcf了 ...
- dyld 加载 Mach-O
➠更多技术干货请戳:听云博客 前言 最近看 ObjC的runtime 是怎么实现 +load 钩子函数的实现.进而引申分析了 dyld 处理 Mach-O 的这部分机制. 1.简单分析 Mach-O ...
- Binding笔记
Binding基础 绑定某个对象的属性值到控制上,写法如下: public class Order : INotifyPropertyChanged//只要实现此接口 { public event ...
随机推荐
- 【百度地图API】北京周边7日游——图标按路线轨迹行动
原文:[百度地图API]北京周边7日游--图标按路线轨迹行动 任务描述: 春节就要来啦~酸奶小妹的妈妈要从遥远的重庆,来到北京过春节呢!酸奶小妹忙着给妈妈计划,北京周边的旅游线路.计划好路线后,就开始 ...
- python解析命令行
可以解析这样的命令 ./cron_ctrl jobname1 --stop ;./cron_ctrl jobname1 --start;./cron_ctrl jobname1 --list #!/u ...
- 项目管理实践 -- 健身小管家(Fitness housekeeper)的管理(4)
提前几天把检查更新的功能完成了.
- Hack 语言学习/参考---1.Hack 语言
Table of Contents What is Hack? Hack Background Summary Hack is a language for HHVM that interopates ...
- GhostDoc的使用
原文:GhostDoc的使用 一.简介 GhostDoc是Visual Studio的一个免费插件,可以为开发人员自动生成XML格式的注释文档. 二.下载 需要的朋友可以去这里下载,填个Email地址 ...
- MVC验证06-自定义错误信息
原文:MVC验证06-自定义错误信息 本文体验自定义错误信息. 系统默认的错误信息 在"MVC验证02-自定义验证规则.邮件验证"中,我们自定义了一个验证Email的类.如果输 ...
- C语言学习-数据结构 - 倒插法顺序表
// test20161106.cpp : Defines the entry point for the console application. // #include "stdafx. ...
- APlayer组件自制播放器
.NET中使用APlayer组件自制播放器 2015-02-02 09:46 by xiaozhi_5638, 402 阅读, 9 评论, 收藏, 编辑 目录 说明 APlayer介绍 APlayer ...
- java设计模式之十桥接模式(Bridge)
桥接模式就是把事物和其具体实现分开,使他们可以各自独立的变化.桥接的用意是:将抽象化与实现化解耦,使得二者可以独立变化,像我们常用的JDBC桥DriverManager一样,JDBC进行连接数据库的时 ...
- OC的构造方法与分类知识点总结
OC语言构造方法: 用来初始化对象的方法,对象方法,以减号开头 为了让对象创建出来,成员变量就会有一些固定的值 重写构造方法的注意点: 先调用父类的构造方法([super init]) 再进行子类内部 ...