[lld] r254432 - revert r254428 [ELF] - Refactor of tls_index implementation for tls local dynamic model.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 1 10:11:16 PST 2015
Author: grimar
Date: Tue Dec 1 12:11:16 2015
New Revision: 254432
URL: http://llvm.org/viewvc/llvm-project?rev=254432&view=rev
Log:
revert r254428 [ELF] - Refactor of tls_index implementation for tls local dynamic model.
It failed buildbot:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/3782/steps/build/logs/stdio
Target.cpp
In file included from /home/buildbot/Buildbot/Slave/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.src/tools/lld/ELF/Target.cpp:20:
/home/buildbot/Buildbot/Slave/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.src/tools/lld/ELF/OutputSections.h:136:42: error: use of undeclared identifier 'getVA'
uint32_t getLocalTlsIndexVA() { return getVA() + LocalTlsIndexOff; }
Modified:
lld/trunk/ELF/InputSection.cpp
lld/trunk/ELF/OutputSections.cpp
lld/trunk/ELF/OutputSections.h
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=254432&r1=254431&r2=254432&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Tue Dec 1 12:11:16 2015
@@ -113,7 +113,8 @@ void InputSectionBase<ELFT>::relocate(
if (Target->isTlsLocalDynamicReloc(Type) &&
!Target->isTlsOptimized(Type, nullptr)) {
Target->relocateOne(BufLoc, BufEnd, Type, AddrLoc,
- Out<ELFT>::Got->getLocalTlsIndexVA() +
+ Out<ELFT>::Got->getVA() +
+ Out<ELFT>::LocalModuleTlsIndexOffset +
getAddend<ELFT>(RI));
continue;
}
Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=254432&r1=254431&r2=254432&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Tue Dec 1 12:11:16 2015
@@ -87,13 +87,10 @@ template <class ELFT> void GotSection<EL
Entries.push_back(nullptr);
}
-template <class ELFT> bool GotSection<ELFT>::addLocalModelTlsIndex() {
- if (LocalTlsIndexOff != uint32_t(-1))
- return false;
+template <class ELFT> uint32_t GotSection<ELFT>::addLocalModuleTlsIndex() {
Entries.push_back(nullptr);
Entries.push_back(nullptr);
- LocalTlsIndexOff = (Entries.size() - 2) * sizeof(uintX_t);
- return true;
+ return (Entries.size() - 2) * sizeof(uintX_t);
}
template <class ELFT>
@@ -204,7 +201,8 @@ bool RelocationSection<ELFT>::applyTlsDy
Elf_Rel *N) {
if (Target->isTlsLocalDynamicReloc(Type)) {
P->setSymbolAndType(0, Target->getTlsModuleIndexReloc(), Config->Mips64EL);
- P->r_offset = Out<ELFT>::Got->getLocalTlsIndexVA();
+ P->r_offset =
+ Out<ELFT>::Got->getVA() + Out<ELFT>::LocalModuleTlsIndexOffset;
return true;
}
Modified: lld/trunk/ELF/OutputSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.h?rev=254432&r1=254431&r2=254432&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.h (original)
+++ lld/trunk/ELF/OutputSections.h Tue Dec 1 12:11:16 2015
@@ -119,7 +119,7 @@ public:
void writeTo(uint8_t *Buf) override;
void addEntry(SymbolBody *Sym);
void addDynTlsEntry(SymbolBody *Sym);
- bool addLocalModelTlsIndex();
+ uint32_t addLocalModuleTlsIndex();
bool empty() const { return Entries.empty(); }
uintX_t getEntryAddr(const SymbolBody &B) const;
@@ -133,11 +133,8 @@ public:
// 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>
@@ -433,6 +430,7 @@ template <class ELFT> struct Out {
static SymbolTableSection<ELFT> *DynSymTab;
static SymbolTableSection<ELFT> *SymTab;
static Elf_Phdr *TlsPhdr;
+ static uint32_t LocalModuleTlsIndexOffset;
};
template <class ELFT> DynamicSection<ELFT> *Out<ELFT>::Dynamic;
@@ -454,6 +452,7 @@ template <class ELFT> StringTableSection
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
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=254432&r1=254431&r2=254432&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Tue Dec 1 12:11:16 2015
@@ -205,8 +205,11 @@ void Writer<ELFT>::scanRelocs(
if (Target->isTlsLocalDynamicReloc(Type)) {
if (Target->isTlsOptimized(Type, nullptr))
continue;
- if (Out<ELFT>::Got->addLocalModelTlsIndex())
+ if (Out<ELFT>::LocalModuleTlsIndexOffset == uint32_t(-1)) {
+ Out<ELFT>::LocalModuleTlsIndexOffset =
+ Out<ELFT>::Got->addLocalModuleTlsIndex();
Out<ELFT>::RelaDyn->addReloc({&C, &RI});
+ }
continue;
}
More information about the llvm-commits
mailing list