[lld] f3f594c - [NFC][lld] Pass `sym` as const reference to `GotSection`'s methods (#86481)

via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 25 10:25:46 PDT 2024


Author: Daniil Kovalev
Date: 2024-03-25T20:25:42+03:00
New Revision: f3f594c6b569a1b126f390c28ec0ca3704f39e93

URL: https://github.com/llvm/llvm-project/commit/f3f594c6b569a1b126f390c28ec0ca3704f39e93
DIFF: https://github.com/llvm/llvm-project/commit/f3f594c6b569a1b126f390c28ec0ca3704f39e93.diff

LOG: [NFC][lld] Pass `sym` as const reference to `GotSection`'s methods (#86481)

Added: 
    

Modified: 
    lld/ELF/SyntheticSections.cpp
    lld/ELF/SyntheticSections.h

Removed: 
    


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


        


More information about the llvm-commits mailing list