[ELF] - Refactor of tls_index implementation for tls local dynamic model.
Patch contains the next 2 changes:
1) static variable Out<ELFT>::LocalModuleTlsIndexOffset moved to Out<ELFT>::Got. At fact there is no meaning for it to be separated from GOT class because at each place of using it anyways needs to call GOT`s getVA(). Also it is impossible to have that offset and not have GOT.
2) addLocalModuleTlsIndex -> addLocalModelTlsIndex (word "Module" changed to "Model"). Not sure was it a mistype or not but I think that update is closer to Urlich terminology.
Differential revision: http://reviews.llvm.org/D15113
llvm-svn: 254428
diff --git a/lld/ELF/OutputSections.h b/lld/ELF/OutputSections.h
index dea9bb3..a676ce3 100644
--- a/lld/ELF/OutputSections.h
+++ b/lld/ELF/OutputSections.h
@@ -119,7 +119,7 @@
void writeTo(uint8_t *Buf) override;
void addEntry(SymbolBody *Sym);
void addDynTlsEntry(SymbolBody *Sym);
- uint32_t addLocalModuleTlsIndex();
+ bool addLocalModelTlsIndex();
bool empty() const { return Entries.empty(); }
uintX_t getEntryAddr(const SymbolBody &B) const;
@@ -133,8 +133,11 @@
// the number of reserved entries. This method is MIPS-specific.
unsigned getMipsLocalEntriesNum() const;
+ uint32_t getLocalTlsIndexVA() { return getVA() + LocalTlsIndexOff; }
+
private:
std::vector<const SymbolBody *> Entries;
+ uint32_t LocalTlsIndexOff = -1;
};
template <class ELFT>
@@ -430,7 +433,6 @@
static SymbolTableSection<ELFT> *DynSymTab;
static SymbolTableSection<ELFT> *SymTab;
static Elf_Phdr *TlsPhdr;
- static uint32_t LocalModuleTlsIndexOffset;
};
template <class ELFT> DynamicSection<ELFT> *Out<ELFT>::Dynamic;
@@ -452,7 +454,6 @@
template <class ELFT> SymbolTableSection<ELFT> *Out<ELFT>::DynSymTab;
template <class ELFT> SymbolTableSection<ELFT> *Out<ELFT>::SymTab;
template <class ELFT> typename Out<ELFT>::Elf_Phdr *Out<ELFT>::TlsPhdr;
-template <class ELFT> uint32_t Out<ELFT>::LocalModuleTlsIndexOffset = -1;
} // namespace elf2
} // namespace lld