Index: ELF/SyntheticSections.h =================================================================== --- ELF/SyntheticSections.h +++ ELF/SyntheticSections.h @@ -297,9 +297,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; @@ -309,7 +308,7 @@ private: const bool Dynamic; - uintX_t Size = 0; + uint64_t Size = 0; llvm::DenseMap StringMap; std::vector Strings; @@ -416,7 +415,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; @@ -431,7 +430,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: @@ -765,7 +764,7 @@ static BuildIdSection *BuildId; static InputSection *Common; static DynamicSection *Dynamic; - static StringTableSection *DynStrTab; + static StringTableSection *DynStrTab; static SymbolTableSection *DynSymTab; static EhFrameHeader *EhFrameHdr; static GnuHashTableSection *GnuHashTab; @@ -783,8 +782,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; @@ -795,7 +794,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; @@ -813,8 +812,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: ELF/SyntheticSections.cpp =================================================================== --- ELF/SyntheticSections.cpp +++ ELF/SyntheticSections.cpp @@ -986,9 +986,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(""); @@ -998,8 +997,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) @@ -1011,7 +1009,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; @@ -1280,8 +1278,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), @@ -2334,11 +2331,6 @@ template class elf::IgotPltSection; template class elf::IgotPltSection; -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: ELF/Writer.cpp =================================================================== --- ELF/Writer.cpp +++ ELF/Writer.cpp @@ -333,11 +333,11 @@ Out::Bss = make(".bss", SHT_NOBITS, SHF_ALLOC | SHF_WRITE); Out::BssRelRo = make(".bss.rel.ro", SHT_NOBITS, SHF_ALLOC | SHF_WRITE); - 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); @@ -355,7 +355,7 @@ Add(createCommentSection()); if (Config->Strip != StripPolicy::All) { - In::StrTab = make>(".strtab", false); + In::StrTab = make(".strtab", false); In::SymTab = make>(*In::StrTab); }