[lld] [lld][AArch64][ELF][PAC] Support AUTH relocations and AUTH ELF marking (PR #72714)

Daniil Kovalev via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 8 02:49:15 PST 2024


================
@@ -1887,6 +1920,18 @@ static void removeUnusedSyntheticSections() {
         auto *sec = cast<SyntheticSection>(s);
         if (sec->getParent() && sec->isNeeded())
           return false;
+        // Packed AArch64 AUTH relocs might be moved from .relr.auth.dyn to
+        // .rela.dyn further in finalizeAddressDependentContent(). It is called
+        // later since removing unused synthetic sections changes the final
+        // layout. So, .rela.dyn should be kept now in such a case even if it's
+        // currently empty. A possible side effect is having empty
+        // .relr.auth.dyn (if all the packed AUTH relocs were moved to
+        // .rela.dyn) or empty .rela.dyn (if no rela relocs were there and no
+        // packed AUTH relocs were moved to it) in the output binary.
+        if (config->emachine == EM_AARCH64 && config->relrPackDynRelocs)
+          if (auto *relSec = dyn_cast<RelocationSection<ELFT>>(sec))
----------------
kovdan01 wrote:

Yes, we can, I just thought that being more precise is better. If it's unnecessary, I changed that to `RelocationBaseSection` and deleted the `template<class ELFT>` as not needed. See b215b0d60ac0c2ac29aeb318da7c95725be6ef86


https://github.com/llvm/llvm-project/pull/72714


More information about the llvm-commits mailing list