linux - Lazy loading procedure -
I would like to know how this works properly, let's say we have the following code snippet: < Pre> First of all the printf stub (printf @ plt) is called, then the address is located at 0x601018 (within the got) to jump to that address We say that for the first time called printf: we find that the value will be 0x400416, which says the next instruction, okay? After code, value 0 is pushed to the pile and then we jump to 0x400400. Here is a GOT address (0x601008) pushed and then there is a leap on the next one (0x601010): Why? What exactly is that? Apart from this: When really called dynamic linker and how? You have the correct tracing on the answer closed;) If you are the last indicator ( 0000000000400400 & lt; Printf @ plt-0x10>: 400400: FF35 02 C20 00 Pushak 0x200c02 (% RIP) # 601008 & lt; _GLOBAL_OFFSET_TABLE_ + 0x8 & gt; 400406: FF 25 04 C 20 00 jmpq * 0x200c04 (% RIP) # 601010 & lt; _GLOBAL_OFFSET_TABLE_ + 0x10 & gt; 40040c: 0f 1f 40 00 NOPL 0x0 (% racks) 0000000000400410 & lt; Printf @ plt>: 400410: FF 25 02 C 20 00 jmpq * 0x200c02 (% RIP) # 601018 & lt; _GLOBAL_OFFSET_TABLE_ + 0x18 & gt; 400416: 68 00 00 Pushak $ 0x0 40041b: E 9 EFFFFF JFP 400400 & lt; _init + 0x20 & gt; .... 40053b: E8DFF FF FF Caller 400410 & lt; Printf @ plt & gt;
0x601010 ), then you should see that it goes to
_dl_runtime_resolve . The first entry in the
plt entry inserts the transfer index on the stack (it recognizes the entry to operate) and is a link map for the second push module from the mill.
_dl_runtime_resolve Typically Linker has an assembly function (this remains for x86-64), after which some registration, calls
_dl_fixup and all the solutions (Works by updating the pointer in Got, subsequent invocations go directly to the resolved function). Finally
_dl_runtime_resolve jumps to the now resolved function, so it actually executes :)
Comments
Post a Comment