Index: lld/trunk/ELF/SyntheticSections.h =================================================================== --- lld/trunk/ELF/SyntheticSections.h +++ lld/trunk/ELF/SyntheticSections.h @@ -296,9 +296,8 @@ std::vector Entries; }; -template class StringTableSection final : public SyntheticSection { +class StringTableSection final : public SyntheticSection { public: - typedef typename ELFT::uint uintX_t; StringTableSection(StringRef Name, bool Dynamic); unsigned addString(StringRef S, bool HashIt = true); void writeTo(uint8_t *Buf) override; @@ -308,7 +307,7 @@ private: const bool Dynamic; - uintX_t Size = 0; + uint64_t Size = 0; llvm::DenseMap StringMap; std::vector Strings; @@ -415,7 +414,7 @@ typedef typename ELFT::Sym Elf_Sym; typedef typename ELFT::uint uintX_t; - SymbolTableSection(StringTableSection &StrTabSec); + SymbolTableSection(StringTableSection &StrTabSec); void finalizeContents() override; void postThunkContents() override; @@ -430,7 +429,7 @@ // A vector of symbols and their string table offsets. std::vector Symbols; - StringTableSection &StrTabSec; + StringTableSection &StrTabSec; }; // Outputs GNU Hash section. For detailed explanation see: @@ -766,7 +765,7 @@ static BssSection *BssRelRo; static InputSection *Common; static DynamicSection *Dynamic; - static StringTableSection *DynStrTab; + static StringTableSection *DynStrTab; static SymbolTableSection *DynSymTab; static EhFrameHeader *EhFrameHdr; static GnuHashTableSection *GnuHashTab; @@ -784,8 +783,8 @@ static RelocationSection *RelaDyn; static RelocationSection *RelaPlt; static RelocationSection *RelaIplt; - static StringTableSection *ShStrTab; - static StringTableSection *StrTab; + static StringTableSection *ShStrTab; + static StringTableSection *StrTab; static SymbolTableSection *SymTab; static VersionDefinitionSection *VerDef; static VersionTableSection *VerSym; @@ -798,7 +797,7 @@ template BuildIdSection *In::BuildId; template InputSection *In::Common; template DynamicSection *In::Dynamic; -template StringTableSection *In::DynStrTab; +template StringTableSection *In::DynStrTab; template SymbolTableSection *In::DynSymTab; template EhFrameHeader *In::EhFrameHdr; template GdbIndexSection *In::GdbIndex; @@ -816,8 +815,8 @@ template RelocationSection *In::RelaDyn; template RelocationSection *In::RelaPlt; template RelocationSection *In::RelaIplt; -template StringTableSection *In::ShStrTab; -template StringTableSection *In::StrTab; +template StringTableSection *In::ShStrTab; +template StringTableSection *In::StrTab; template SymbolTableSection *In::SymTab; template VersionDefinitionSection *In::VerDef; template VersionTableSection *In::VerSym; Index: lld/trunk/ELF/SyntheticSections.cpp =================================================================== --- lld/trunk/ELF/SyntheticSections.cpp +++ lld/trunk/ELF/SyntheticSections.cpp @@ -987,9 +987,8 @@ } } -template -StringTableSection::StringTableSection(StringRef Name, bool Dynamic) - : SyntheticSection(Dynamic ? (uintX_t)SHF_ALLOC : 0, SHT_STRTAB, 1, Name), +StringTableSection::StringTableSection(StringRef Name, bool Dynamic) + : SyntheticSection(Dynamic ? (uint64_t)SHF_ALLOC : 0, SHT_STRTAB, 1, Name), Dynamic(Dynamic) { // ELF string tables start with a NUL byte. addString(""); @@ -999,8 +998,7 @@ // duplicates. It is optional because the name of global symbols are already // uniqued and hashing them again has a big cost for a small value: uniquing // them with some other string that happens to be the same. -template -unsigned StringTableSection::addString(StringRef S, bool HashIt) { +unsigned StringTableSection::addString(StringRef S, bool HashIt) { if (HashIt) { auto R = StringMap.insert(std::make_pair(S, this->Size)); if (!R.second) @@ -1012,7 +1010,7 @@ return Ret; } -template void StringTableSection::writeTo(uint8_t *Buf) { +void StringTableSection::writeTo(uint8_t *Buf) { for (StringRef S : Strings) { memcpy(Buf, S.data(), S.size()); Buf += S.size() + 1; @@ -1281,8 +1279,7 @@ } template -SymbolTableSection::SymbolTableSection( - StringTableSection &StrTabSec) +SymbolTableSection::SymbolTableSection(StringTableSection &StrTabSec) : SyntheticSection(StrTabSec.isDynamic() ? (uintX_t)SHF_ALLOC : 0, StrTabSec.isDynamic() ? SHT_DYNSYM : SHT_SYMTAB, sizeof(uintX_t), @@ -2320,11 +2317,6 @@ template class elf::MipsGotSection; template class elf::MipsGotSection; -template class elf::StringTableSection; -template class elf::StringTableSection; -template class elf::StringTableSection; -template class elf::StringTableSection; - template class elf::DynamicSection; template class elf::DynamicSection; template class elf::DynamicSection; Index: lld/trunk/ELF/Writer.cpp =================================================================== --- lld/trunk/ELF/Writer.cpp +++ lld/trunk/ELF/Writer.cpp @@ -330,11 +330,11 @@ auto Add = [](InputSectionBase *Sec) { InputSections.push_back(Sec); }; - In::DynStrTab = make>(".dynstr", true); + In::DynStrTab = make(".dynstr", true); In::Dynamic = make>(); In::RelaDyn = make>( Config->isRela() ? ".rela.dyn" : ".rel.dyn", Config->ZCombreloc); - In::ShStrTab = make>(".shstrtab", false); + In::ShStrTab = make(".shstrtab", false); Out::ElfHeader = make("", 0, SHF_ALLOC); Out::ElfHeader->Size = sizeof(Elf_Ehdr); @@ -352,7 +352,7 @@ Add(createCommentSection()); if (Config->Strip != StripPolicy::All) { - In::StrTab = make>(".strtab", false); + In::StrTab = make(".strtab", false); In::SymTab = make>(*In::StrTab); }