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]
fishHook.png
例如:查找符號(hào) _close
1、Find entry with same index in indirect symbol table
通過Lazy Symbol Pointers
找到符號(hào)在Dynamic Symbol Table->Indirect Symbols
的位置
_close
在Lazy Symbol Pointers與動(dòng)態(tài)表Dynamic Symbol Table的位置是一樣的。
Lazy Symbol Pointers.png
Indirect Symbols.png
2、Treat value as index into symbol table array
Dynamic Symbol Table
的Data為 ox43 為符號(hào)在Symbol Table
數(shù)組的下標(biāo)
_close的data值.png
Symbols.png
_close
的偏移位置是:Symbols[_close
下標(biāo)] = 0x3218 + 0x43 * 10 = 0x3648
0x3218: Symbols的初始地址
0x43:close在symbols的下標(biāo)
10:為symtab的sizeof (16 —> 16進(jìn)制 = 10)
找到具體的位置:
_close在Symbols的位置.png
3、Look up string table entry by adding offset from symbol table entry to string table base
通過Symbols的String Table Index
偏移量CE
找到對(duì)應(yīng)在String Table的位置
image.png
String Table的起始值是:0x379C
String Table.png
字符串的位置:0x379C + 0xCE = 0x386A
_close在String Table的位置.png
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進(jìn)制: 5F 63 6C 6F 73 65
字 形: _ c l o s e
_
是函數(shù)的開始 .
是分隔符