[lld] [NFC][ELF] Use InputSectionBase::addReloc in addRelativeReloc (PR #171176)

via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 8 10:30:51 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lld

Author: Jessica Clarke (jrtc27)

<details>
<summary>Changes</summary>

There's no need to poke into the internals, we can just use the more
abstract member function like everywhere else in LLD.


---
Full diff: https://github.com/llvm/llvm-project/pull/171176.diff


1 Files Affected:

- (modified) lld/ELF/Relocations.cpp (+1-1) 


``````````diff
diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp
index ef19a2af0c4d2..2f08181a4eb0c 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -717,7 +717,7 @@ static void addRelativeReloc(Ctx &ctx, InputSectionBase &isec,
     // field. This is described in further detail in:
     // https://github.com/ARM-software/abi-aa/blob/main/memtagabielf64/memtagabielf64.rst#841extended-semantics-of-r_aarch64_relative
     if (addend < 0 || static_cast<uint64_t>(addend) >= sym.getSize())
-      isec.relocations.push_back({expr, type, offsetInSec, addend, &sym});
+      isec.addReloc({expr, type, offsetInSec, addend, &sym});
     return;
   }
 

``````````

</details>


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


More information about the llvm-commits mailing list