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

Daniil Kovalev via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 19 08:04:18 PDT 2024


================
@@ -1900,6 +1932,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<RelocationBaseSection>(sec))
+            if (relSec->name == ".rela.dyn")
----------------
kovdan01 wrote:

Fixed, thanks, see d32b8e32fc1c938e5a005997b832d215a308037d


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


More information about the llvm-commits mailing list