Page MenuHomePhabricator

[LLD][ELF][AArch64] Add R_AARCH64_PLT_PAGE_PC to isRelExpr
ClosedPublic

Authored by peter.smith on Jan 15 2019, 8:03 AM.

Details

Summary

As a follow on to D56666 (r351186) there is a case when taking the address of an ifunc when compiling -fpie and linking -pie that can generate a spurious can't create dynamic relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol in readonly segment. Specifically the case is where the ifunc is in the same translation unit as the address taker, so given -fpie the compiler knows that the ifunc is going to be defined in the executable so it can use a non-got-generating relocation.

The error message is due to R_AARCH64_PLT_PAGE_PC not being added to isRelExpr, its non PLT equivalent R_AARCH64_PAGE_PC is already in isRelExpr. I've checked that the output is comparable to ld.bfd and ld.gold.

I found this while checking combinations of compilation and link options involving taking the address of an ifunc; for ld.gold, ld.bfd and ld.lld.

Diff Detail

Repository
rLLD LLVM Linker

Event Timeline

peter.smith created this revision.Jan 15 2019, 8:03 AM
ruiu accepted this revision.Jan 15 2019, 10:33 AM

LGTM

This revision is now accepted and ready to land.Jan 15 2019, 10:33 AM
This revision was automatically updated to reflect the committed changes.