[llvm-branch-commits] [NFC][ELF] Don't reimplement addReloc in GotSection::addConstant (PR #171177)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Dec 8 10:30:51 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lld-elf
Author: Jessica Clarke (jrtc27)
<details>
<summary>Changes</summary>
This is just a copy of InputSectionBase::addReloc, so we can just
forward to that rathe than poking into the internals. Whilst here, move
the implementation to the header so it can be inlined.
---
Full diff: https://github.com/llvm/llvm-project/pull/171177.diff
2 Files Affected:
- (modified) lld/ELF/SyntheticSections.cpp (-1)
- (modified) lld/ELF/SyntheticSections.h (+1-1)
``````````diff
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);
``````````
</details>
https://github.com/llvm/llvm-project/pull/171177
More information about the llvm-branch-commits
mailing list