[lld] [NFC][lld] Pass `sym` as const reference to `GotSection`'s methods (PR #86481)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 25 02:49:34 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lld-elf
@llvm/pr-subscribers-lld
Author: Daniil Kovalev (kovdan01)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/86481.diff
2 Files Affected:
- (modified) lld/ELF/SyntheticSections.cpp (+3-3)
- (modified) lld/ELF/SyntheticSections.h (+3-3)
``````````diff
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index f924756ddddfcd..650bd6cd390060 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -628,19 +628,19 @@ GotSection::GotSection()
}
void GotSection::addConstant(const Relocation &r) { relocations.push_back(r); }
-void GotSection::addEntry(Symbol &sym) {
+void GotSection::addEntry(const Symbol &sym) {
assert(sym.auxIdx == symAux.size() - 1);
symAux.back().gotIdx = numEntries++;
}
-bool GotSection::addTlsDescEntry(Symbol &sym) {
+bool GotSection::addTlsDescEntry(const Symbol &sym) {
assert(sym.auxIdx == symAux.size() - 1);
symAux.back().tlsDescIdx = numEntries;
numEntries += 2;
return true;
}
-bool GotSection::addDynTlsEntry(Symbol &sym) {
+bool GotSection::addDynTlsEntry(const Symbol &sym) {
assert(sym.auxIdx == symAux.size() - 1);
symAux.back().tlsGdIdx = numEntries;
// Global Dynamic TLS entries take two GOT slots.
diff --git a/lld/ELF/SyntheticSections.h b/lld/ELF/SyntheticSections.h
index fa21b80a5a5ea0..02a669b01d1522 100644
--- a/lld/ELF/SyntheticSections.h
+++ b/lld/ELF/SyntheticSections.h
@@ -106,9 +106,9 @@ class GotSection final : public SyntheticSection {
void writeTo(uint8_t *buf) override;
void addConstant(const Relocation &r);
- void addEntry(Symbol &sym);
- bool addTlsDescEntry(Symbol &sym);
- bool addDynTlsEntry(Symbol &sym);
+ void addEntry(const Symbol &sym);
+ bool addTlsDescEntry(const Symbol &sym);
+ bool addDynTlsEntry(const Symbol &sym);
bool addTlsIndex();
uint32_t getTlsDescOffset(const Symbol &sym) const;
uint64_t getTlsDescAddr(const Symbol &sym) const;
``````````
</details>
https://github.com/llvm/llvm-project/pull/86481
More information about the llvm-commits
mailing list