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

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 10 12:03:58 PST 2024


================
@@ -2615,6 +2619,47 @@ static uint32_t getAndFeatures() {
   return ret;
 }
 
+static void getAArch64PauthInfo() {
+  if (ctx.objectFiles.empty())
+    return;
+
+  auto it = std::find_if(
+      ctx.objectFiles.begin(), ctx.objectFiles.end(),
+      [](const ELFFileBase *f) { return !f->aarch64PauthAbiTag.empty(); });
+  if (it == ctx.objectFiles.end())
+    return;
+
+  ctx.aarch64PauthAbiTag = (*it)->aarch64PauthAbiTag;
+  StringRef f1 = (*it)->getName();
+  for (ELFFileBase *f : ArrayRef(ctx.objectFiles)) {
+    StringRef f2 = f->getName();
+    const SmallVector<uint8_t, 0> &d1 = ctx.aarch64PauthAbiTag;
+    const SmallVector<uint8_t, 0> &d2 = f->aarch64PauthAbiTag;
+    if (d1.empty() != d2.empty()) {
----------------
MaskRay wrote:

`.note.AARCH64-PAUTH-ABI-tag`, if present, its descsz must be at least 16. The emptiness check should be removed.

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


More information about the llvm-commits mailing list