This is an archive of the discontinued LLVM Phabricator instance.

[JITLink][ELF/AARCH64] Implement Procedure Linkage Table
ClosedPublic

Authored by sunho on Jun 4 2022, 5:59 PM.

Details

Summary

This patch implements Procedure Linkage Table (PLT) for ELF/AARCH64. The aarch64 linux calling convention also uses r16 as the intra-procedure-call scratch register same as MachO/ARM64. We can use the same stub sequence for this reason.

Also, BR regiseter doesn't touch X30 register. External function call by BL instruction (touched by CALL26 relocation) will set X30 to the original PC + 4, which is the intended behavior. External function call by B instruction (touched by JUMP26 relocation) doesn't requite to set X30, so the patch will be correct in this case too.

Reference: https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst#611general-purpose-registers

Diff Detail

Unit TestsFailed

Event Timeline

sunho created this revision.Jun 4 2022, 5:59 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 4 2022, 5:59 PM
sunho requested review of this revision.Jun 4 2022, 5:59 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 4 2022, 5:59 PM
sunho updated this revision to Diff 434340.Jun 5 2022, 11:14 AM
lhames accepted this revision.Jun 9 2022, 3:17 PM

LGTM. Thanks @sunho!

This revision is now accepted and ready to land.Jun 9 2022, 3:17 PM
This revision was landed with ongoing or failed builds.Jun 9 2022, 10:45 PM
This revision was automatically updated to reflect the committed changes.