Index: ELF/LinkerScript.cpp =================================================================== --- ELF/LinkerScript.cpp +++ ELF/LinkerScript.cpp @@ -375,7 +375,7 @@ // Add input sections to an output section. for (InputSectionBase *S : V) - Factory.addInputSec(S, Cmd->Name); + Factory.addInputSec(S, Cmd->Name); } } CurOutSec = nullptr; @@ -386,7 +386,7 @@ void LinkerScript::addOrphanSections(OutputSectionFactory &Factory) { for (InputSectionBase *S : InputSections) if (S->Live && !S->OutSec) - Factory.addInputSec(S, getOutputSectionName(S->Name)); + Factory.addInputSec(S, getOutputSectionName(S->Name)); } template static bool isTbss(OutputSection *Sec) { Index: ELF/OutputSections.h =================================================================== --- ELF/OutputSections.h +++ ELF/OutputSections.h @@ -136,7 +136,6 @@ OutputSectionFactory(std::vector &OutputSections); ~OutputSectionFactory(); - template void addInputSec(InputSectionBase *IS, StringRef OutsecName); private: Index: ELF/OutputSections.cpp =================================================================== --- ELF/OutputSections.cpp +++ ELF/OutputSections.cpp @@ -249,12 +249,10 @@ Script::X->writeDataBytes(this->Name, Buf); } -template -static typename ELFT::uint getOutFlags(InputSectionBase *S) { +static uint64_t getOutFlags(InputSectionBase *S) { return S->Flags & ~SHF_GROUP & ~SHF_COMPRESSED; } -template static SectionKey createKey(InputSectionBase *C, StringRef OutsecName) { // The ELF spec just says // ---------------------------------------------------------------- @@ -299,12 +297,10 @@ // Given the above issues, we instead merge sections by name and error on // incompatible types and flags. - typedef typename ELFT::uint uintX_t; - uint32_t Alignment = 0; - uintX_t Flags = 0; + uint64_t Flags = 0; if (Config->Relocatable && (C->Flags & SHF_MERGE)) { - Alignment = std::max(C->Alignment, C->Entsize); + Alignment = std::max(C->Alignment, C->Entsize); Flags = C->Flags & (SHF_MERGE | SHF_STRINGS); } @@ -331,23 +327,22 @@ Type == SHT_NOTE; } -template static void reportDiscarded(InputSectionBase *IS) { +static void reportDiscarded(InputSectionBase *IS) { if (!Config->PrintGcSections) return; message("removing unused section from '" + IS->Name + "' in file '" + - IS->getFile()->getName()); + IS->File->getName()); } -template void OutputSectionFactory::addInputSec(InputSectionBase *IS, StringRef OutsecName) { if (!IS->Live) { - reportDiscarded(IS); + reportDiscarded(IS); return; } - SectionKey Key = createKey(IS, OutsecName); - uint64_t Flags = getOutFlags(IS); + SectionKey Key = createKey(IS, OutsecName); + uint64_t Flags = getOutFlags(IS); OutputSection *&Sec = Map[Key]; if (Sec) { if (getIncompatibleFlags(Sec->Flags) != getIncompatibleFlags(IS->Flags)) @@ -412,13 +407,5 @@ template void OutputSection::writeTo(uint8_t *Buf); template void OutputSection::writeTo(uint8_t *Buf); -template void OutputSectionFactory::addInputSec(InputSectionBase *, - StringRef); -template void OutputSectionFactory::addInputSec(InputSectionBase *, - StringRef); -template void OutputSectionFactory::addInputSec(InputSectionBase *, - StringRef); -template void OutputSectionFactory::addInputSec(InputSectionBase *, - StringRef); } } Index: ELF/Writer.cpp =================================================================== --- ELF/Writer.cpp +++ ELF/Writer.cpp @@ -937,7 +937,7 @@ template void Writer::createSections() { for (InputSectionBase *IS : InputSections) if (IS) - Factory.addInputSec(IS, getOutputSectionName(IS->Name)); + Factory.addInputSec(IS, getOutputSectionName(IS->Name)); sortBySymbolsOrder(OutputSections); sortInitFini(findSection(".init_array"));