[llvm-branch-commits] [lld] [NFC][ELF] Abstract RelrBaseSection more like RelocationBaseSection (PR #171178)
Jessica Clarke via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Dec 24 02:58:28 PST 2025
https://github.com/jrtc27 updated https://github.com/llvm/llvm-project/pull/171178
>From f7a0ec77fd7e3f73f0f640e7273ec3ad67d5077f Mon Sep 17 00:00:00 2001
From: Jessica Clarke <jrtc27 at jrtc27.com>
Date: Mon, 8 Dec 2025 18:30:15 +0000
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20change?=
=?UTF-8?q?s=20to=20main=20this=20commit=20is=20based=20on?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Created using spr 1.3.5
[skip ci]
---
lld/ELF/Relocations.cpp | 2 +-
lld/ELF/SyntheticSections.cpp | 1 -
lld/ELF/SyntheticSections.h | 2 +-
3 files changed, 2 insertions(+), 3 deletions(-)
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;
}
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index 1e9d44fa37bea..d6e214f9d0f48 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -674,7 +674,6 @@ GotSection::GotSection(Ctx &ctx)
numEntries = ctx.target->gotHeaderEntriesNum;
}
-void GotSection::addConstant(const Relocation &r) { relocations.push_back(r); }
void GotSection::addEntry(const Symbol &sym) {
assert(sym.auxIdx == ctx.symAux.size() - 1);
ctx.symAux.back().gotIdx = numEntries++;
diff --git a/lld/ELF/SyntheticSections.h b/lld/ELF/SyntheticSections.h
index e01a5ad8abc60..79fa8140c2498 100644
--- a/lld/ELF/SyntheticSections.h
+++ b/lld/ELF/SyntheticSections.h
@@ -113,7 +113,7 @@ class GotSection final : public SyntheticSection {
bool isNeeded() const override;
void writeTo(uint8_t *buf) override;
- void addConstant(const Relocation &r);
+ void addConstant(const Relocation &r) { addReloc(r); }
void addEntry(const Symbol &sym);
void addAuthEntry(const Symbol &sym);
bool addTlsDescEntry(const Symbol &sym);
More information about the llvm-branch-commits
mailing list