[lld] [lld][AArch64][ELF][PAC] Support `.relr.auth.dyn` section (PR #87635)
Daniil Kovalev via llvm-commits
llvm-commits at lists.llvm.org
Tue May 14 12:42:10 PDT 2024
================
@@ -1445,9 +1445,33 @@ template <class ELFT> void Writer<ELFT>::finalizeAddressDependentContent() {
in.mipsGot->updateAllocSize();
for (Partition &part : partitions) {
+ // The R_AARCH64_AUTH_RELATIVE has a smaller addend field as bits [63:32]
+ // encode the signing schema. We've put relocations in .relr.auth.dyn
+ // during RelocationScanner::processAux, but the target VA for some of
+ // them might be wider than 32 bits. We can only know the final VA at this
+ // point, so move relocations with large values from .relr.auth.dyn to
+ // .rela.dyn.
+ if (part.relrAuthDyn) {
+ auto it = llvm::remove_if(
+ part.relrAuthDyn->relocs, [&part](const RelativeReloc &elem) {
+ const Relocation &reloc = elem.inputSec->relocs()[elem.relocIdx];
+ if (isInt<32>(reloc.sym->getVA(reloc.addend)))
+ return false;
+ part.relaDyn->addReloc({R_AARCH64_AUTH_RELATIVE, elem.inputSec,
+ reloc.offset,
+ DynamicReloc::AddendOnlyWithTargetVA,
+ *reloc.sym, reloc.addend, R_ABS});
+ // See also AArch64::relocate
----------------
kovdan01 wrote:
Moved to the previous one, see e68efcf46ebf0abdeec9f1fd5ed6a14e51e07e42
https://github.com/llvm/llvm-project/pull/87635
More information about the llvm-commits
mailing list