I’ve been reading a lot about the semantics of load-time linking of shared libraries and one thing that I’m having trouble understanding is how can the main program make references to functions defined in shared libraries? For example, say I have this code myShared.sh main.c I understand that, sin…
Tag: relocation
ELF label address
I have the following code in .s file: Its object file has the following: After linking, it becomes: How does the argument 0x0 to pushq at byte 20 of the object file gets converted to 0x400578 in the final executable? Which section of the object file contains this information? Answer You answered your own ques…
Why GOT entry offset appears wrong?
I wrote simple shared library: Compiled/built: Disassembled, to see how some_func is referenced: Looked where .got.plt is located: What is the relocation: In 6aa-6bb we get absolute location of GOT: 6aa + 0x200956 = 0x201000 That agrees with readelf -S libtest.so ‘s output. We skip 3 reserved bytes in G…