From a104d558d057389e68630f7a48a0814ba0b233c4 Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Fri, 3 Nov 2017 22:33:49 +0000 Subject: [PATCH] Fix variable name. A mechanical rename caused an illegal name conflict between a variable and a type, which was picked up by GCC. llvm-svn: 317380 --- lld/ELF/SyntheticSections.cpp | 31 +++++++++++++++---------------- lld/ELF/SyntheticSections.h | 2 +- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp index f87f93b..4299289 100644 --- a/lld/ELF/SyntheticSections.cpp +++ b/lld/ELF/SyntheticSections.cpp @@ -1493,11 +1493,11 @@ static bool sortMipsSymbols(const SymbolTableEntry &L, const SymbolTableEntry &R) { // Sort entries related to non-local preemptible symbols by GOT indexes. // All other entries go to the first part of GOT in arbitrary order. - bool LIsInLocalGot = !L.Symbol->IsInGlobalMipsGot; - bool RIsInLocalGot = !R.Symbol->IsInGlobalMipsGot; + bool LIsInLocalGot = !L.Sym->IsInGlobalMipsGot; + bool RIsInLocalGot = !R.Sym->IsInGlobalMipsGot; if (LIsInLocalGot || RIsInLocalGot) return !RIsInLocalGot; - return L.Symbol->GotIndex < R.Symbol->GotIndex; + return L.Sym->GotIndex < R.Sym->GotIndex; } void SymbolTableBaseSection::finalizeContents() { @@ -1518,8 +1518,7 @@ void SymbolTableBaseSection::finalizeContents() { } size_t I = 0; - for (const SymbolTableEntry &S : Symbols) - S.Symbol->DynsymIndex = ++I; + for (const SymbolTableEntry &S : Symbols) S.Sym->DynsymIndex = ++I; return; } } @@ -1533,7 +1532,7 @@ void SymbolTableBaseSection::postThunkContents() { // move all local symbols before global symbols. auto It = std::stable_partition( Symbols.begin(), Symbols.end(), [](const SymbolTableEntry &S) { - return S.Symbol->isLocal() || S.Symbol->computeBinding() == STB_LOCAL; + return S.Sym->isLocal() || S.Sym->computeBinding() == STB_LOCAL; }); size_t NumLocals = It - Symbols.begin(); getParent()->Info = NumLocals + 1; @@ -1554,10 +1553,10 @@ size_t SymbolTableBaseSection::getSymbolIndex(Symbol *Body) { SymbolIndexMap.reserve(Symbols.size()); size_t I = 0; for (const SymbolTableEntry &E : Symbols) { - if (E.Symbol->Type == STT_SECTION) - SectionIndexMap[E.Symbol->getOutputSection()] = ++I; + if (E.Sym->Type == STT_SECTION) + SectionIndexMap[E.Sym->getOutputSection()] = ++I; else - SymbolIndexMap[E.Symbol] = ++I; + SymbolIndexMap[E.Sym] = ++I; } }); @@ -1583,7 +1582,7 @@ template void SymbolTableSection::writeTo(uint8_t *Buf) { auto *ESym = reinterpret_cast(Buf); for (SymbolTableEntry &Ent : Symbols) { - Symbol *Body = Ent.Symbol; + Symbol *Body = Ent.Sym; // Set st_info and st_other. ESym->st_other = 0; @@ -1635,7 +1634,7 @@ template void SymbolTableSection::writeTo(uint8_t *Buf) { auto *ESym = reinterpret_cast(Buf); for (SymbolTableEntry &Ent : Symbols) { - Symbol *Body = Ent.Symbol; + Symbol *Body = Ent.Sym; if (Body->isInPlt() && Body->NeedsPltAddr) ESym->st_other |= STO_MIPS_PLT; @@ -1791,15 +1790,15 @@ void GnuHashTableSection::addSymbols(std::vector &V) { std::stable_partition(V.begin(), V.end(), [](const SymbolTableEntry &S) { // Shared symbols that this executable preempts are special. The dynamic // linker has to look them up, so they have to be in the hash table. - if (auto *SS = dyn_cast(S.Symbol)) + if (auto *SS = dyn_cast(S.Sym)) return SS->CopyRelSec == nullptr && !SS->NeedsPltAddr; - return !S.Symbol->isInCurrentOutput(); + return !S.Sym->isInCurrentOutput(); }); if (Mid == V.end()) return; for (SymbolTableEntry &Ent : llvm::make_range(Mid, V.end())) { - Symbol *B = Ent.Symbol; + Symbol *B = Ent.Sym; Symbols.push_back({B, Ent.StrTabOffset, hashGnu(B->getName())}); } @@ -1841,7 +1840,7 @@ void HashTableSection::writeTo(uint8_t *Buf) { uint32_t *Chains = P + NumSymbols; for (const SymbolTableEntry &S : InX::DynSymTab->getSymbols()) { - Symbol *Body = S.Symbol; + Symbol *Body = S.Sym; StringRef Name = Body->getName(); unsigned I = Body->DynsymIndex; uint32_t Hash = hashSysV(Name) % NumSymbols; @@ -2283,7 +2282,7 @@ template size_t VersionTableSection::getSize() const { template void VersionTableSection::writeTo(uint8_t *Buf) { auto *OutVersym = reinterpret_cast(Buf) + 1; for (const SymbolTableEntry &S : InX::DynSymTab->getSymbols()) { - OutVersym->vs_index = S.Symbol->VersionId; + OutVersym->vs_index = S.Sym->VersionId; ++OutVersym; } } diff --git a/lld/ELF/SyntheticSections.h b/lld/ELF/SyntheticSections.h index f31d6156..c1dcf29 100644 --- a/lld/ELF/SyntheticSections.h +++ b/lld/ELF/SyntheticSections.h @@ -420,7 +420,7 @@ private: }; struct SymbolTableEntry { - Symbol *Symbol; + Symbol *Sym; size_t StrTabOffset; }; -- 2.7.4