Main aim of this patch is adding support of lazy loading.
This patch implements basic variant for x86_x64 and for X86 targets. What was done:
- .got.plt section is created for functions that requires PLT. .got.plt has 3 predefined empty entries now that are required for dynamic linker.
Also other new items created are configured to have correct jump to PLT[N]
- PLT section now has PLT[0] entry, also others ones are configured to support PLT->GOT(.got.plt) calls.
- Implemented .rel[a].plt sections (based on patch http://reviews.llvm.org/D13569)
- Fixed plt relocations types (based on patch http://reviews.llvm.org/D13589)
NOTES:
The .plt.got zero entry is empty now. According to ELF specification it should hold the address of the dynamic structure, referenced with the symbol
_DYNAMIC. The _DYNAMIC entry points to the .dynamic section which contains information used by the ELF interpreter to setup the binary.
This seems to be separate task and I think following patches should handle it, but not this one.