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

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


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

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


>From 923255e960edd621072584efe9af6195356b18f1 Mon Sep 17 00:00:00 2001
From: Jessica Clarke <jrtc27 at jrtc27.com>
Date: Mon, 8 Dec 2025 18:29:59 +0000
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
 =?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.5
---
 lld/ELF/Relocations.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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;
   }
 



More information about the llvm-commits mailing list