The process of looking up the name of a given entry in the lazy or non-lazy pointer tables looks like this: [https://github.com/facebook/fishhook]

例如:查找符号 _close
1、Find entry with same index in indirect symbol table
通过Lazy Symbol Pointers
找到符号在Dynamic Symbol Table->Indirect Symbols
的位置
_close
在Lazy Symbol Pointers与动态表Dynamic Symbol Table的位置是一样的。


2、Treat value as index into symbol table array
Dynamic Symbol Table
的Data为 ox43 为符号在Symbol Table
数组的下标


_close
的偏移位置是:Symbols[_close
下标] = 0x3218 + 0x43 * 10 = 0x3648
0x3218: Symbols的初始地址
0x43:close在symbols的下标
10:为symtab的sizeof (16 —> 16进制 = 10)
找到具体的位置:

3、Look up string table entry by adding offset from symbol table entry to string table base
通过Symbols的String Table Index
偏移量CE
找到对应在String Table的位置

String Table的起始值是:0x379C

字符串的位置:0x379C + 0xCE = 0x386A

385C : 66
385D : 6F
.
.
.
386A : 5F // _
38BF : 63 // c
38C0 : 6C // l
38C1 : 6F // o
38C2 : 73 // s
38C3 : 65 // e
lPush._open._pri // `_open`
16进制: 5F 63 6C 6F 73 65
字 形: _ c l o s e
_
是函数的开始 .
是分隔符
网友评论