[lld] [ELF] Remove dead code related to relocation scanning (PR #195594)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun May 3 23:45:42 PDT 2026


https://github.com/MaskRay created https://github.com/llvm/llvm-project/pull/195594

None

>From 6e55a0bd351353732dc789889f0442d4101705a1 Mon Sep 17 00:00:00 2001
From: Fangrui Song <i at maskray.me>
Date: Sun, 3 May 2026 23:38:36 -0700
Subject: [PATCH] [ELF] Remove dead code related to relocation scanning

---
 lld/ELF/RelocScan.h | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/lld/ELF/RelocScan.h b/lld/ELF/RelocScan.h
index 4135c15963b95..d25555ab28905 100644
--- a/lld/ELF/RelocScan.h
+++ b/lld/ELF/RelocScan.h
@@ -191,24 +191,12 @@ void RelocScan::scan(typename Relocs<RelTy>::const_iterator &it, RelType type,
   RelExpr expr =
       ctx.target->getRelExpr(type, sym, sec->content().data() + offset);
 
-  // Ignore R_*_NONE and other marker relocations.
-  if (expr == R_NONE)
-    return;
-
   // Error if the target symbol is undefined. Symbol index 0 may be used by
   // marker relocations, e.g. R_*_NONE and R_ARM_V4BX. Don't error on them.
   if (sym.isUndefined() && symIdx != 0 &&
       maybeReportUndefined(cast<Undefined>(sym), offset))
     return;
 
-  // Ensure GOT or GOTPLT is created for relocations that reference their base
-  // addresses without directly creating entries.
-  if (oneof<R_GOTPLTREL, R_GOTPLT, R_TLSGD_GOTPLT>(expr)) {
-    ctx.in.gotPlt->hasGotPltOffRel.store(true, std::memory_order_relaxed);
-  } else if (oneof<R_GOTONLY_PC, R_GOTREL, RE_PPC32_PLTREL>(expr)) {
-    ctx.in.got->hasGotOffRel.store(true, std::memory_order_relaxed);
-  }
-
   process(expr, type, offset, sym, addend);
 }
 



More information about the llvm-commits mailing list