ELF: Make names for TLS module indices shorter.
The previous names contained "Local" and "Current", but what we are handling is always local and current, so they were redundant. TlsIndex comes from "tls_index" struct that Ulrich Drepper is using in this document to describe this data structure in GOT. llvm-svn: 259852
This commit is contained in:
parent
eb7d7f8729
commit
0e53c7dd2c
|
@ -150,7 +150,7 @@ void InputSectionBase<ELFT>::relocate(uint8_t *Buf, uint8_t *BufEnd,
|
|||
if (Target->isTlsLocalDynamicRel(Type) &&
|
||||
!Target->canRelaxTls(Type, nullptr)) {
|
||||
Target->relocateOne(BufLoc, BufEnd, Type, AddrLoc,
|
||||
Out<ELFT>::Got->getLocalTlsIndexVA() +
|
||||
Out<ELFT>::Got->getTlsIndexVA() +
|
||||
getAddend<ELFT>(RI));
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -88,10 +88,12 @@ template <class ELFT> bool GotSection<ELFT>::addDynTlsEntry(SymbolBody *Sym) {
|
|||
return true;
|
||||
}
|
||||
|
||||
template <class ELFT> bool GotSection<ELFT>::addCurrentModuleTlsIndex() {
|
||||
if (LocalTlsIndexOff != uint32_t(-1))
|
||||
// Reserves TLS entries for a TLS module ID and a TLS block offset.
|
||||
// In total it takes two GOT slots.
|
||||
template <class ELFT> bool GotSection<ELFT>::addTlsIndex() {
|
||||
if (TlsIndexOff != uint32_t(-1))
|
||||
return false;
|
||||
LocalTlsIndexOff = Entries.size() * sizeof(uintX_t);
|
||||
TlsIndexOff = Entries.size() * sizeof(uintX_t);
|
||||
Entries.push_back(nullptr);
|
||||
Entries.push_back(nullptr);
|
||||
return true;
|
||||
|
@ -224,7 +226,7 @@ getOffset(const DynamicReloc<ELFT> &Rel) {
|
|||
case DynamicReloc<ELFT>::Off_GTlsOffset:
|
||||
return Out<ELFT>::Got->getGlobalDynAddr(*Sym) + sizeof(uintX_t);
|
||||
case DynamicReloc<ELFT>::Off_LTlsIndex:
|
||||
return Out<ELFT>::Got->getLocalTlsIndexVA();
|
||||
return Out<ELFT>::Got->getTlsIndexVA();
|
||||
case DynamicReloc<ELFT>::Off_Sec:
|
||||
return Rel.OffsetSec->getOffset(Rel.OffsetInSec) +
|
||||
Rel.OffsetSec->OutSec->getVA();
|
||||
|
|
|
@ -113,7 +113,7 @@ public:
|
|||
void addEntry(SymbolBody *Sym);
|
||||
void addMipsLocalEntry();
|
||||
bool addDynTlsEntry(SymbolBody *Sym);
|
||||
bool addCurrentModuleTlsIndex();
|
||||
bool addTlsIndex();
|
||||
bool empty() const { return MipsLocalEntries == 0 && Entries.empty(); }
|
||||
uintX_t getMipsLocalFullAddr(const SymbolBody &B);
|
||||
uintX_t getMipsLocalPageAddr(uintX_t Addr);
|
||||
|
@ -130,11 +130,11 @@ public:
|
|||
// the number of reserved entries. This method is MIPS-specific.
|
||||
unsigned getMipsLocalEntriesNum() const;
|
||||
|
||||
uintX_t getLocalTlsIndexVA() { return Base::getVA() + LocalTlsIndexOff; }
|
||||
uintX_t getTlsIndexVA() { return Base::getVA() + TlsIndexOff; }
|
||||
|
||||
private:
|
||||
std::vector<const SymbolBody *> Entries;
|
||||
uint32_t LocalTlsIndexOff = -1;
|
||||
uint32_t TlsIndexOff = -1;
|
||||
uint32_t MipsLocalEntries = 0;
|
||||
llvm::DenseMap<uintX_t, size_t> MipsLocalGotPos;
|
||||
|
||||
|
|
|
@ -218,7 +218,7 @@ static bool handleTlsRelocation(unsigned Type, SymbolBody *Body,
|
|||
if (Target->isTlsLocalDynamicRel(Type)) {
|
||||
if (Target->canRelaxTls(Type, nullptr))
|
||||
return true;
|
||||
if (Out<ELFT>::Got->addCurrentModuleTlsIndex())
|
||||
if (Out<ELFT>::Got->addTlsIndex())
|
||||
Out<ELFT>::RelaDyn->addReloc({Target->TlsModuleIndexRel,
|
||||
DynamicReloc<ELFT>::Off_LTlsIndex,
|
||||
nullptr});
|
||||
|
@ -229,8 +229,8 @@ static bool handleTlsRelocation(unsigned Type, SymbolBody *Body,
|
|||
return false;
|
||||
|
||||
if (Target->isTlsGlobalDynamicRel(Type)) {
|
||||
bool Opt = Target->canRelaxTls(Type, Body);
|
||||
if (!Opt && Out<ELFT>::Got->addDynTlsEntry(Body)) {
|
||||
if (!Target->canRelaxTls(Type, Body) &&
|
||||
Out<ELFT>::Got->addDynTlsEntry(Body)) {
|
||||
Out<ELFT>::RelaDyn->addReloc(
|
||||
{Target->TlsModuleIndexRel, DynamicReloc<ELFT>::Off_GTlsIndex, Body});
|
||||
Out<ELFT>::RelaDyn->addReloc(
|
||||
|
|
Loading…
Reference in New Issue