[lld] [PAC][lld][AArch64][ELF] Support signed GOT (PR #113815)

Daniil Kovalev via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 1 14:30:29 PST 2024


================
@@ -1090,7 +1104,17 @@ void RelocationScanner::processAux(RelExpr expr, RelType type, uint64_t offset,
     } else if (!sym.isTls() || ctx.arg.emachine != EM_LOONGARCH) {
       // Many LoongArch TLS relocs reuse the R_LOONGARCH_GOT type, in which
       // case the NEEDS_GOT flag shouldn't get set.
-      sym.setFlags(NEEDS_GOT);
+      bool needsGotAuth =
+          (expr == R_AARCH64_AUTH_GOT || expr == R_AARCH64_AUTH_GOT_PAGE_PC);
+      uint16_t flags = sym.flags.load(std::memory_order_relaxed);
+      if (!(flags & NEEDS_GOT)) {
+        sym.setFlags(needsGotAuth ? (NEEDS_GOT | NEEDS_GOT_AUTH) : NEEDS_GOT);
+      } else if (needsGotAuth != static_cast<bool>(flags & NEEDS_GOT_AUTH)) {
+        Err(ctx) << "both AUTH and non-AUTH GOT entries for '" << sym.getName()
+                 << "' requested, but only one type of GOT entry per symbol is "
+                    "supported"
+                 << getLocation(ctx, *sec, sym, offset);
----------------
kovdan01 wrote:

Fixed in 6313f5cf1aec1f744a3e82a02794368c2f4eb23f, thanks

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


More information about the llvm-commits mailing list