[JITLink][ELF] Implement R_X86_64_PLT32 relocations
authorStefan Gränitz <stefan.graenitz@gmail.com>
Tue, 3 Nov 2020 12:05:38 +0000 (12:05 +0000)
committerStefan Gränitz <stefan.graenitz@gmail.com>
Tue, 3 Nov 2020 12:05:54 +0000 (12:05 +0000)
commitb397795f1a2f9e25669fe030dc3836f35e2e725e
tree819d5912885fea0744da6914b90a7a20d25b8704
parentd6a468d622b2d48c40c47290aa54d6d910c5a6bf
[JITLink][ELF] Implement R_X86_64_PLT32 relocations

Basic implementation for call and jmp branches with 32 bit offset. Branches to local targets produce
Branch32 edges that are resolved like a regular PCRel32 relocations. Branches to external (undefined)
targets produce Branch32ToStub edges and go through a PLT entry by default. If the target happens to
get resolved within the 32 bit range from the callsite, the edge is relaxed during post-allocation
optimization. There is a test for each of these cases.

Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D90331
llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp
llvm/test/ExecutionEngine/JITLink/X86/ELF_x86-64_relocations.s