This is an archive of the discontinued LLVM Phabricator instance.

[LLD][ELF][AArch64] Add missing PLT relocations to isStaticLinkTimeConstant
ClosedPublic

Authored by peter.smith on Jan 14 2019, 7:51 AM.

Details

Summary

D54314 fixed pr38074 for AArch64 for static linking. It added two new RelExpr instances R_AARCH64_GOT_PAGE_PC_PLT and R_GOT_PLT. These need to be added to isStaticLinkTimeConstant so that the address of an ifunc can be taken when building a shared library. I've checked that both ld.gold and ld.bfd generate the same PLT and relocations for this case.

Fixes pr40250 (https://bugs.llvm.org/show_bug.cgi?id=40250) which is a regression introduced by D54314.

While looking into this I think LLD isn't getting PIE or non-preemptible ifuncs right (and wasn't prior to D54314). The got entry generated as a result of the got generating relocation pair above is reduced to a R_AARCH64_RELATIVE to the ifunc resolver. I'm working on a proper fix for this but as it is not a regression I think it can go in a separate patch.

Diff Detail

Repository
rL LLVM