[lld] [LLD][MachO][NFC] Rename Reloc to Relocation (PR #175586)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 12 08:58:29 PST 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lld-macho

Author: Alexis Engelke (aengelke)

<details>
<summary>Changes</summary>

Due to heavy use of using namespace llvm, Reloc is often ambiguous with llvm::Reloc, the relocation model. Previously, this was sometimes disambiguated with macho::Reloc. This ambiguity is even more problematic when using pre-compiled headers, where it's no longer "obvious" whether it should be Reloc or macho::Reloc.

Therefore, rename Reloc to Relocation. This is also consistent with lld/ELF, where the type is also named Relocation.

---

Patch is 34.51 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/175586.diff


20 Files Affected:

- (modified) lld/MachO/Arch/ARM64Common.cpp (+5-5) 
- (modified) lld/MachO/Arch/ARM64Common.h (+6-5) 
- (modified) lld/MachO/Arch/X86_64.cpp (+4-4) 
- (modified) lld/MachO/BPSectionOrderer.cpp (+1-1) 
- (modified) lld/MachO/ConcatOutputSection.cpp (+6-5) 
- (modified) lld/MachO/EhFrame.cpp (+5-5) 
- (modified) lld/MachO/EhFrame.h (+1-1) 
- (modified) lld/MachO/ICF.cpp (+5-5) 
- (modified) lld/MachO/InputFiles.cpp (+10-9) 
- (modified) lld/MachO/InputFiles.h (+1-1) 
- (modified) lld/MachO/InputSection.cpp (+7-7) 
- (modified) lld/MachO/InputSection.h (+2-2) 
- (modified) lld/MachO/MarkLive.cpp (+2-2) 
- (modified) lld/MachO/ObjC.cpp (+19-18) 
- (modified) lld/MachO/Relocations.cpp (+6-5) 
- (modified) lld/MachO/Relocations.h (+7-6) 
- (modified) lld/MachO/SyntheticSections.cpp (+4-4) 
- (modified) lld/MachO/Target.h (+2-2) 
- (modified) lld/MachO/UnwindInfoSection.cpp (+2-2) 
- (modified) lld/MachO/Writer.cpp (+2-2) 


``````````diff
diff --git a/lld/MachO/Arch/ARM64Common.cpp b/lld/MachO/Arch/ARM64Common.cpp
index d90a37fe8c659..599f1e18efda6 100644
--- a/lld/MachO/Arch/ARM64Common.cpp
+++ b/lld/MachO/Arch/ARM64Common.cpp
@@ -38,7 +38,7 @@ int64_t ARM64Common::getEmbeddedAddend(MemoryBufferRef mb, uint64_t offset,
   }
 }
 
-static void writeValue(uint8_t *loc, const Reloc &r, uint64_t value) {
+static void writeValue(uint8_t *loc, const Relocation &r, uint64_t value) {
   switch (r.length) {
   case 2:
     checkInt(loc, r, value, 32);
@@ -57,7 +57,7 @@ static void writeValue(uint8_t *loc, const Reloc &r, uint64_t value) {
 // instruction has opcode & register-operand bits set, with immediate
 // operands zeroed. We read it from text, OR-in the immediate
 // operands, then write-back the completed instruction.
-void ARM64Common::relocateOne(uint8_t *loc, const Reloc &r, uint64_t value,
+void ARM64Common::relocateOne(uint8_t *loc, const Relocation &r, uint64_t value,
                               uint64_t pc) const {
   auto loc32 = reinterpret_cast<uint32_t *>(loc);
   uint32_t base = ((r.length == 2) ? read32le(loc) : 0);
@@ -110,7 +110,7 @@ void ARM64Common::relaxGotLoad(uint8_t *loc, uint8_t type) const {
   write32le(loc, instruction);
 }
 
-void ARM64Common::handleDtraceReloc(const Symbol *sym, const Reloc &r,
+void ARM64Common::handleDtraceReloc(const Symbol *sym, const Relocation &r,
                                     uint8_t *loc) const {
   assert(r.type == ARM64_RELOC_BRANCH26);
 
@@ -138,8 +138,8 @@ static void reportUnalignedLdrStr(Twine loc, uint64_t va, int align,
         "-byte aligned");
 }
 
-void macho::reportUnalignedLdrStr(void *loc, const lld::macho::Reloc &r,
-                                  uint64_t va, int align) {
+void macho::reportUnalignedLdrStr(void *loc, const Relocation &r, uint64_t va,
+                                  int align) {
   uint64_t off = reinterpret_cast<const uint8_t *>(loc) - in.bufferStart;
   const InputSection *isec = offsetToInputSection(&off);
   std::string locStr = isec ? isec->getLocation(off) : "(invalid location)";
diff --git a/lld/MachO/Arch/ARM64Common.h b/lld/MachO/Arch/ARM64Common.h
index 70461b4e83d31..f20cd4b170249 100644
--- a/lld/MachO/Arch/ARM64Common.h
+++ b/lld/MachO/Arch/ARM64Common.h
@@ -23,13 +23,13 @@ struct ARM64Common : TargetInfo {
 
   int64_t getEmbeddedAddend(MemoryBufferRef, uint64_t offset,
                             const llvm::MachO::relocation_info) const override;
-  void relocateOne(uint8_t *loc, const Reloc &, uint64_t va,
+  void relocateOne(uint8_t *loc, const Relocation &, uint64_t va,
                    uint64_t pc) const override;
 
   void relaxGotLoad(uint8_t *loc, uint8_t type) const override;
   uint64_t getPageSize() const override { return 16 * 1024; }
 
-  void handleDtraceReloc(const Symbol *sym, const Reloc &r,
+  void handleDtraceReloc(const Symbol *sym, const Relocation &r,
                          uint8_t *loc) const override;
 };
 
@@ -42,7 +42,7 @@ inline uint64_t bitField(uint64_t value, int right, int width, int left) {
 // |           |                       imm26                       |
 // +-----------+---------------------------------------------------+
 
-inline void encodeBranch26(uint32_t *loc, const Reloc &r, uint32_t base,
+inline void encodeBranch26(uint32_t *loc, const Relocation &r, uint32_t base,
                            uint64_t va) {
   checkInt(loc, r, va, 28);
   // Since branch destinations are 4-byte aligned, the 2 least-
@@ -61,7 +61,7 @@ inline void encodeBranch26(uint32_t *loc, SymbolDiagnostic d, uint32_t base,
 // | |ilo|         |                immhi                |         |
 // +-+---+---------+-------------------------------------+---------+
 
-inline void encodePage21(uint32_t *loc, const Reloc &r, uint32_t base,
+inline void encodePage21(uint32_t *loc, const Relocation &r, uint32_t base,
                          uint64_t va) {
   checkInt(loc, r, va, 35);
   llvm::support::endian::write32le(loc, base | bitField(va, 12, 2, 29) |
@@ -75,7 +75,8 @@ inline void encodePage21(uint32_t *loc, SymbolDiagnostic d, uint32_t base,
                                             bitField(va, 14, 19, 5));
 }
 
-void reportUnalignedLdrStr(void *loc, const Reloc &, uint64_t va, int align);
+void reportUnalignedLdrStr(void *loc, const Relocation &, uint64_t va,
+                           int align);
 void reportUnalignedLdrStr(void *loc, SymbolDiagnostic, uint64_t va, int align);
 
 //                      21                   10
diff --git a/lld/MachO/Arch/X86_64.cpp b/lld/MachO/Arch/X86_64.cpp
index f35139906554f..c0bdffa22f254 100644
--- a/lld/MachO/Arch/X86_64.cpp
+++ b/lld/MachO/Arch/X86_64.cpp
@@ -28,7 +28,7 @@ struct X86_64 : TargetInfo {
 
   int64_t getEmbeddedAddend(MemoryBufferRef, uint64_t offset,
                             const relocation_info) const override;
-  void relocateOne(uint8_t *loc, const Reloc &, uint64_t va,
+  void relocateOne(uint8_t *loc, const Relocation &, uint64_t va,
                    uint64_t relocVA) const override;
 
   void writeStub(uint8_t *buf, const Symbol &,
@@ -44,7 +44,7 @@ struct X86_64 : TargetInfo {
   void relaxGotLoad(uint8_t *loc, uint8_t type) const override;
   uint64_t getPageSize() const override { return 4 * 1024; }
 
-  void handleDtraceReloc(const Symbol *sym, const Reloc &r,
+  void handleDtraceReloc(const Symbol *sym, const Relocation &r,
                          uint8_t *loc) const override;
 };
 } // namespace
@@ -102,7 +102,7 @@ int64_t X86_64::getEmbeddedAddend(MemoryBufferRef mb, uint64_t offset,
   return addend + pcrelOffset(rel.r_type);
 }
 
-void X86_64::relocateOne(uint8_t *loc, const Reloc &r, uint64_t value,
+void X86_64::relocateOne(uint8_t *loc, const Relocation &r, uint64_t value,
                          uint64_t relocVA) const {
   if (r.pcrel) {
     uint64_t pc = relocVA + (1ull << r.length) + pcrelOffset(r.type);
@@ -241,7 +241,7 @@ TargetInfo *macho::createX86_64TargetInfo() {
   return &t;
 }
 
-void X86_64::handleDtraceReloc(const Symbol *sym, const Reloc &r,
+void X86_64::handleDtraceReloc(const Symbol *sym, const Relocation &r,
                                uint8_t *loc) const {
   assert(r.type == X86_64_RELOC_BRANCH);
 
diff --git a/lld/MachO/BPSectionOrderer.cpp b/lld/MachO/BPSectionOrderer.cpp
index 328c33e6cfb65..c9c6c1c62bdf9 100644
--- a/lld/MachO/BPSectionOrderer.cpp
+++ b/lld/MachO/BPSectionOrderer.cpp
@@ -85,7 +85,7 @@ struct BPOrdererMachO : lld::BPOrderer<BPOrdererMachO> {
 
 private:
   static uint64_t
-  getRelocHash(const macho::Reloc &reloc,
+  getRelocHash(const Relocation &reloc,
                const llvm::DenseMap<const void *, uint64_t> &sectionToIdx) {
     auto *isec = reloc.getReferentInputSection();
     std::optional<uint64_t> sectionIdx;
diff --git a/lld/MachO/ConcatOutputSection.cpp b/lld/MachO/ConcatOutputSection.cpp
index e559676ef5e9b..2612365be2efa 100644
--- a/lld/MachO/ConcatOutputSection.cpp
+++ b/lld/MachO/ConcatOutputSection.cpp
@@ -148,7 +148,7 @@ bool TextOutputSection::needsThunks() const {
     parent->needsThunks = true;
   }
   for (ConcatInputSection *isec : inputs) {
-    for (Reloc &r : isec->relocs) {
+    for (Relocation &r : isec->relocs) {
       if (!target->hasAttr(r.type, RelocAttrBits::BRANCH))
         continue;
       auto *sym = cast<Symbol *>(r.referent);
@@ -333,12 +333,13 @@ void TextOutputSection::finalize() {
       branchTargetThresholdVA = estimateBranchTargetThresholdVA(callIdx);
     }
     // Process relocs by ascending address, i.e., ascending offset within isec
-    std::vector<Reloc> &relocs = isec->relocs;
+    std::vector<Relocation> &relocs = isec->relocs;
     // FIXME: This property does not hold for object files produced by ld64's
     // `-r` mode.
-    assert(is_sorted(relocs,
-                     [](Reloc &a, Reloc &b) { return a.offset > b.offset; }));
-    for (Reloc &r : reverse(relocs)) {
+    assert(is_sorted(relocs, [](Relocation &a, Relocation &b) {
+      return a.offset > b.offset;
+    }));
+    for (Relocation &r : reverse(relocs)) {
       ++relocCount;
       if (!target->hasAttr(r.type, RelocAttrBits::BRANCH))
         continue;
diff --git a/lld/MachO/EhFrame.cpp b/lld/MachO/EhFrame.cpp
index 2446b49b5098a..552f4d05f0cf8 100644
--- a/lld/MachO/EhFrame.cpp
+++ b/lld/MachO/EhFrame.cpp
@@ -109,16 +109,16 @@ template <bool Invert = false>
 static void createSubtraction(PointerUnion<Symbol *, InputSection *> a,
                               PointerUnion<Symbol *, InputSection *> b,
                               uint64_t off, uint8_t length,
-                              SmallVectorImpl<Reloc> *newRelocs) {
+                              SmallVectorImpl<Relocation> *newRelocs) {
   auto subtrahend = a;
   auto minuend = b;
   if (Invert)
     std::swap(subtrahend, minuend);
   assert(isa<Symbol *>(subtrahend));
-  Reloc subtrahendReloc(target->subtractorRelocType, /*pcrel=*/false, length,
-                        off, /*addend=*/0, subtrahend);
-  Reloc minuendReloc(target->unsignedRelocType, /*pcrel=*/false, length, off,
-                     (Invert ? 1 : -1) * off, minuend);
+  Relocation subtrahendReloc(target->subtractorRelocType, /*pcrel=*/false,
+                             length, off, /*addend=*/0, subtrahend);
+  Relocation minuendReloc(target->unsignedRelocType, /*pcrel=*/false, length,
+                          off, (Invert ? 1 : -1) * off, minuend);
   newRelocs->push_back(subtrahendReloc);
   newRelocs->push_back(minuendReloc);
 }
diff --git a/lld/MachO/EhFrame.h b/lld/MachO/EhFrame.h
index d5afab3e15aee..a5695abe461e7 100644
--- a/lld/MachO/EhFrame.h
+++ b/lld/MachO/EhFrame.h
@@ -108,7 +108,7 @@ class EhRelocator {
   InputSection *isec;
   // Insert new relocs here so that we don't invalidate iterators into the
   // existing relocs vector.
-  SmallVector<Reloc, 6> newRelocs;
+  SmallVector<Relocation, 6> newRelocs;
 };
 
 } // namespace lld::macho
diff --git a/lld/MachO/ICF.cpp b/lld/MachO/ICF.cpp
index e0fc89782a419..b03e2c5a42e00 100644
--- a/lld/MachO/ICF.cpp
+++ b/lld/MachO/ICF.cpp
@@ -106,7 +106,7 @@ bool ICF::equalsConstant(const ConcatInputSection *ia,
     return false;
   if (ia->relocs.size() != ib->relocs.size())
     return false;
-  auto f = [](const Reloc &ra, const Reloc &rb) {
+  auto f = [](const Relocation &ra, const Relocation &rb) {
     if (ra.type != rb.type)
       return false;
     if (ra.pcrel != rb.pcrel)
@@ -213,7 +213,7 @@ bool ICF::equalsVariable(const ConcatInputSection *ia,
   if (verboseDiagnostics)
     ++equalsVariableCount;
   assert(ia->relocs.size() == ib->relocs.size());
-  auto f = [this](const Reloc &ra, const Reloc &rb) {
+  auto f = [this](const Relocation &ra, const Relocation &rb) {
     // We already filtered out mismatching values/addends in equalsConstant.
     if (ra.referent == rb.referent)
       return true;
@@ -390,7 +390,7 @@ void ICF::run() {
   for (icfPass = 0; icfPass < 2; ++icfPass) {
     parallelForEach(icfInputs, [&](ConcatInputSection *isec) {
       uint32_t hash = isec->icfEqClass[icfPass % 2];
-      for (const Reloc &r : isec->relocs) {
+      for (const Relocation &r : isec->relocs) {
         if (auto *sym = r.referent.dyn_cast<Symbol *>()) {
           if (auto *defined = dyn_cast<Defined>(sym)) {
             if (defined->isec()) {
@@ -520,7 +520,7 @@ void macho::markAddrSigSymbols() {
 
     const InputSection *isec = addrSigSection->subsections[0].isec;
 
-    for (const Reloc &r : isec->relocs) {
+    for (const Relocation &r : isec->relocs) {
       if (auto *sym = r.referent.dyn_cast<Symbol *>())
         markSymAsAddrSig(sym);
       else
@@ -609,7 +609,7 @@ void macho::foldIdenticalSections(bool onlyCfStrings) {
         // We have to do this copying serially as the BumpPtrAllocator is not
         // thread-safe. FIXME: Make a thread-safe allocator.
         MutableArrayRef<uint8_t> copy = isec->data.copy(bAlloc());
-        for (const Reloc &r : isec->relocs)
+        for (const Relocation &r : isec->relocs)
           target->relocateOne(copy.data() + r.offset, r, /*va=*/0,
                               /*relocVA=*/0);
         isec->data = copy;
diff --git a/lld/MachO/InputFiles.cpp b/lld/MachO/InputFiles.cpp
index 81caef5f15ae1..681f502ad2cb6 100644
--- a/lld/MachO/InputFiles.cpp
+++ b/lld/MachO/InputFiles.cpp
@@ -575,7 +575,7 @@ void ObjFile::parseRelocations(ArrayRef<SectionHeader> sectionHeaders,
     int64_t embeddedAddend = target->getEmbeddedAddend(mb, sec.offset, relInfo);
     assert(!(embeddedAddend && pairedAddend));
     int64_t totalAddend = pairedAddend + embeddedAddend;
-    Reloc r;
+    Relocation r;
     r.type = relInfo.r_type;
     r.pcrel = relInfo.r_pcrel;
     r.length = relInfo.r_length;
@@ -633,7 +633,7 @@ void ObjFile::parseRelocations(ArrayRef<SectionHeader> sectionHeaders,
       // attached to the same address.
       assert(target->hasAttr(minuendInfo.r_type, RelocAttrBits::UNSIGNED) &&
              relInfo.r_address == minuendInfo.r_address);
-      Reloc p;
+      Relocation p;
       p.type = minuendInfo.r_type;
       if (minuendInfo.r_extern) {
         p.referent = symbols[minuendInfo.r_symbolnum];
@@ -1161,7 +1161,7 @@ void ObjFile::registerCompactUnwind(Section &compactUnwindSection) {
 
     ConcatInputSection *referentIsec;
     for (auto it = isec->relocs.begin(); it != isec->relocs.end();) {
-      Reloc &r = *it;
+      Relocation &r = *it;
       // CUE::functionAddress is at offset 0. Skip personality & LSDA relocs.
       if (r.offset != 0) {
         ++it;
@@ -1337,9 +1337,9 @@ static CIE parseCIE(const InputSection *isec, const EhReader &reader,
 template <bool Invert = false>
 Defined *
 targetSymFromCanonicalSubtractor(const InputSection *isec,
-                                 std::vector<macho::Reloc>::iterator relocIt) {
-  macho::Reloc &subtrahend = *relocIt;
-  macho::Reloc &minuend = *std::next(relocIt);
+                                 std::vector<Relocation>::iterator relocIt) {
+  Relocation &subtrahend = *relocIt;
+  Relocation &minuend = *std::next(relocIt);
   assert(target->hasAttr(subtrahend.type, RelocAttrBits::SUBTRAHEND));
   assert(target->hasAttr(minuend.type, RelocAttrBits::UNSIGNED));
   // Note: pcSym may *not* be exactly at the PC; there's usually a non-zero
@@ -1364,7 +1364,7 @@ targetSymFromCanonicalSubtractor(const InputSection *isec,
     // `oldSym->value + oldOffset == newSym + newOffset`. However, we don't
     // have an easy way to access the offsets from this point in the code; some
     // refactoring is needed for that.
-    macho::Reloc &pcReloc = Invert ? minuend : subtrahend;
+    Relocation &pcReloc = Invert ? minuend : subtrahend;
     pcReloc.referent = isec->symbols[0];
     assert(isec->symbols[0]->value == 0);
     minuend.addend = pcReloc.offset * (Invert ? 1LL : -1LL);
@@ -1419,8 +1419,9 @@ void ObjFile::registerEhFrames(Section &ehFrameSection) {
     const size_t cieOffOff = dataOff;
 
     EhRelocator ehRelocator(isec);
-    auto cieOffRelocIt = llvm::find_if(
-        isec->relocs, [=](const Reloc &r) { return r.offset == cieOffOff; });
+    auto cieOffRelocIt = llvm::find_if(isec->relocs, [=](const Relocation &r) {
+      return r.offset == cieOffOff;
+    });
     InputSection *cieIsec = nullptr;
     if (cieOffRelocIt != isec->relocs.end()) {
       // We already have an explicit relocation for the CIE offset.
diff --git a/lld/MachO/InputFiles.h b/lld/MachO/InputFiles.h
index 2d5bceb160445..8f2cba89abf48 100644
--- a/lld/MachO/InputFiles.h
+++ b/lld/MachO/InputFiles.h
@@ -45,7 +45,7 @@ class ConcatInputSection;
 class Symbol;
 class Defined;
 class AliasSymbol;
-struct Reloc;
+struct Relocation;
 enum class RefState : uint8_t;
 
 // If --reproduce option is given, all input files are written
diff --git a/lld/MachO/InputSection.cpp b/lld/MachO/InputSection.cpp
index 2b2d28ef63e2d..d5499babc3265 100644
--- a/lld/MachO/InputSection.cpp
+++ b/lld/MachO/InputSection.cpp
@@ -30,8 +30,8 @@ using namespace lld::macho;
 // Verify ConcatInputSection's size on 64-bit builds. The size of std::vector
 // can differ based on STL debug levels (e.g. iterator debugging on MSVC's STL),
 // so account for that.
-static_assert(sizeof(void *) != 8 ||
-                  sizeof(ConcatInputSection) == sizeof(std::vector<Reloc>) + 88,
+static_assert(sizeof(void *) != 8 || sizeof(ConcatInputSection) ==
+                                         sizeof(std::vector<Relocation>) + 88,
               "Try to minimize ConcatInputSection's size, we create many "
               "instances of it");
 
@@ -177,9 +177,9 @@ std::string InputSection::getSourceLocation(uint64_t off) const {
   return {};
 }
 
-const Reloc *InputSection::getRelocAt(uint32_t off) const {
-  auto it = llvm::find_if(
-      relocs, [=](const macho::Reloc &r) { return r.offset == off; });
+const Relocation *InputSection::getRelocAt(uint32_t off) const {
+  auto it = llvm::find_if(relocs,
+                          [=](const Relocation &r) { return r.offset == off; });
   if (it == relocs.end())
     return nullptr;
   return &*it;
@@ -215,7 +215,7 @@ void ConcatInputSection::writeTo(uint8_t *buf) {
   memcpy(buf, data.data(), data.size());
 
   for (size_t i = 0; i < relocs.size(); i++) {
-    const Reloc &r = relocs[i];
+    const Relocation &r = relocs[i];
     uint8_t *loc = buf + r.offset;
     uint64_t referentVA = 0;
 
@@ -223,7 +223,7 @@ void ConcatInputSection::writeTo(uint8_t *buf) {
                             target->hasAttr(r.type, RelocAttrBits::UNSIGNED);
     if (target->hasAttr(r.type, RelocAttrBits::SUBTRAHEND)) {
       const Symbol *fromSym = cast<Symbol *>(r.referent);
-      const Reloc &minuend = relocs[++i];
+      const Relocation &minuend = relocs[++i];
       uint64_t minuendVA;
       if (const Symbol *toSym = minuend.referent.dyn_cast<Symbol *>())
         minuendVA = toSym->getVA() + minuend.addend;
diff --git a/lld/MachO/InputSection.h b/lld/MachO/InputSection.h
index 8e1f7ea0af01e..e0a90a2edc0af 100644
--- a/lld/MachO/InputSection.h
+++ b/lld/MachO/InputSection.h
@@ -56,7 +56,7 @@ class InputSection {
   // Format: Source.cpp:123 (/path/to/Source.cpp:123)
   std::string getSourceLocation(uint64_t off) const;
   // Return the relocation at \p off, if it exists. This does a linear search.
-  const Reloc *getRelocAt(uint32_t off) const;
+  const Relocation *getRelocAt(uint32_t off) const;
   // Whether the data at \p off in this InputSection is live.
   virtual bool isLive(uint64_t off) const = 0;
   virtual void markLive(uint64_t off) = 0;
@@ -88,7 +88,7 @@ class InputSection {
 
   OutputSection *parent = nullptr;
   ArrayRef<uint8_t> data;
-  std::vector<Reloc> relocs;
+  std::vector<Relocation> relocs;
   // The symbols that belong to this InputSection, sorted by value. With
   // .subsections_via_symbols, there is typically only one element here.
   llvm::TinyPtrVector<Defined *> symbols;
diff --git a/lld/MachO/MarkLive.cpp b/lld/MachO/MarkLive.cpp
index d87ccaeee2805..a51c800bf4ef1 100644
--- a/lld/MachO/MarkLive.cpp
+++ b/lld/MachO/MarkLive.cpp
@@ -154,7 +154,7 @@ void MarkLiveImpl<RecordWhyLive>::markTransitively() {
       assert(isec->live && "We mark as live when pushing onto the worklist!");
 
       // Mark all symbols listed in the relocation table for this section.
-      for (const Reloc &r : isec->relocs) {
+      for (const Relocation &r : isec->relocs) {
         if (auto *s = r.referent.dyn_cast<Symbol *>())
           addSym(s, entry);
         else
@@ -172,7 +172,7 @@ void MarkLiveImpl<RecordWhyLive>::markTransitively() {
       if (!(isec->getFlags() & S_ATTR_LIVE_SUPPORT) || isec->live)
         continue;
 
-      for (const Reloc &r : isec->relocs) {
+      for (const Relocation &r : isec->relocs) {
         if (auto *s = r.referent.dyn_cast<Symbol *>()) {
           if (s->isLive()) {
             InputSection *referentIsec = nullptr;
diff --git a/lld/MachO/ObjC.cpp b/lld/MachO/ObjC.cpp
index ab7f73c3a1df6..2540bffecf2aa 100644
--- a/lld/MachO/ObjC.cpp
+++ b/lld/MachO/ObjC.cpp
@@ -191,7 +191,7 @@ void ObjcCategoryChecker::parseMethods(const ConcatInputSection *methodsIsec,
                                        MethodContainerKind mcKind,
                                        MethodKind mKind) {
   ObjcClass &klass = classMap[methodContainerSym];
-  for (const Reloc &r : methodsIsec->relocs) {
+  for (const Relocation &r : methodsIsec->relocs) {
     if ((r.offset - listHeaderLayout.totalSize) % metho...
[truncated]

``````````

</details>


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


More information about the llvm-commits mailing list