Page MenuHomePhabricator

[JITLink][ELF] Implement R_X86_64_PLT32 relocations
ClosedPublic

Authored by sgraenitz on Oct 28 2020, 12:11 PM.

Details

Summary

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.

Diff Detail

Event Timeline

sgraenitz created this revision.Oct 28 2020, 12:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 28 2020, 12:11 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
sgraenitz requested review of this revision.Oct 28 2020, 12:11 PM
sgraenitz updated this revision to Diff 301448.Oct 28 2020, 2:57 PM

Polish comments and variable names in test

lhames accepted this revision.Oct 29 2020, 12:45 PM

Looks great to me. Thanks very much Stefan!

This revision is now accepted and ready to land.Oct 29 2020, 12:45 PM
MaskRay added inline comments.
llvm/test/ExecutionEngine/JITLink/X86/ELF_x86-64_relocations.s
65

Such a oneshot temporary label can usually be omitted:

.-test_call_extern

This revision was landed with ongoing or failed builds.Nov 3 2020, 4:09 AM
This revision was automatically updated to reflect the committed changes.

Such a oneshot temporary label can usually be omitted:

Thanks for the note @MaskRay. As it affects a number of locations, I opened another review for it: D90676