[lld] [ELF] Refactor RelocScan::scan to be target-specific (PR #163138)

Owen Anderson via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 14 19:15:24 PDT 2025


================
@@ -87,6 +88,11 @@ class TargetInfo {
   virtual bool inBranchRange(RelType type, uint64_t src,
                              uint64_t dst) const;
 
+  template <class ELFT, class RelTy>
----------------
resistor wrote:

> In the future, we probably should make RelocScan fully target-specific, eliminating `ctx.arg.emachine` overhead. Newer linkers mold and wild use arch as a template parameter, making relocation scanner substantially faster at the cost of binary size.

If we made this change sooner, we could avoid having to copy-paste the boilerplate into each target by just making all of the existing `emachine` checks `if constexpr`

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


More information about the llvm-commits mailing list