[lld] r330953 - Delete GotPltIndex.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 26 09:09:31 PDT 2018


Author: rafael
Date: Thu Apr 26 09:09:30 2018
New Revision: 330953

URL: http://llvm.org/viewvc/llvm-project?rev=330953&view=rev
Log:
Delete GotPltIndex.

It was always an offset of PltIndex.

This doesn't reduce the size of the structures, but makes it easier to
do so in a followup patch.

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

Modified: lld/trunk/ELF/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.cpp?rev=330953&r1=330952&r2=330953&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.cpp (original)
+++ lld/trunk/ELF/Symbols.cpp Thu Apr 26 09:09:30 2018
@@ -132,7 +132,9 @@ uint64_t Symbol::getGotPltVA() const {
 }
 
 uint64_t Symbol::getGotPltOffset() const {
-  return GotPltIndex * Target->GotPltEntrySize;
+  if (IsInIgot)
+    return PltIndex * Target->GotPltEntrySize;
+  return (PltIndex + Target->GotPltHeaderEntriesNum) * Target->GotPltEntrySize;
 }
 
 uint64_t Symbol::getPltVA() const {

Modified: lld/trunk/ELF/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.h?rev=330953&r1=330952&r2=330953&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.h (original)
+++ lld/trunk/ELF/Symbols.h Thu Apr 26 09:09:30 2018
@@ -69,7 +69,6 @@ protected:
 public:
   uint32_t DynsymIndex = 0;
   uint32_t GotIndex = -1;
-  uint32_t GotPltIndex = -1;
   uint32_t PltIndex = -1;
   uint32_t GlobalDynIndex = -1;
 

Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=330953&r1=330952&r2=330953&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Thu Apr 26 09:09:30 2018
@@ -887,7 +887,7 @@ GotPltSection::GotPltSection()
                        Target->GotPltEntrySize, ".got.plt") {}
 
 void GotPltSection::addEntry(Symbol &Sym) {
-  Sym.GotPltIndex = Target->GotPltHeaderEntriesNum + Entries.size();
+  assert(Sym.PltIndex == Entries.size());
   Entries.push_back(&Sym);
 }
 
@@ -922,7 +922,7 @@ IgotPltSection::IgotPltSection()
 
 void IgotPltSection::addEntry(Symbol &Sym) {
   Sym.IsInIgot = true;
-  Sym.GotPltIndex = Entries.size();
+  assert(Sym.PltIndex == Entries.size());
   Entries.push_back(&Sym);
 }
 




More information about the llvm-commits mailing list