Index: ELF/Writer.cpp =================================================================== --- ELF/Writer.cpp +++ ELF/Writer.cpp @@ -996,13 +996,11 @@ std::pair *, bool> create(InputSectionBase *C, StringRef OutsecName); - OutputSectionBase *lookup(StringRef Name, uint32_t Type, uintX_t Flags); + SmallDenseMap, OutputSectionBase *> Map; private: SectionKey createKey(InputSectionBase *C, StringRef OutsecName); - - SmallDenseMap, OutputSectionBase *> Map; }; } @@ -1034,13 +1032,6 @@ } template -OutputSectionBase *OutputSectionFactory::lookup(StringRef Name, - uint32_t Type, - uintX_t Flags) { - return Map.lookup({Name, Type, Flags, 0}); -} - -template SectionKey OutputSectionFactory::createKey(InputSectionBase *C, StringRef OutsecName) { @@ -1177,25 +1168,26 @@ } Out::Bss = static_cast *>( - Factory.lookup(".bss", SHT_NOBITS, SHF_ALLOC | SHF_WRITE)); + Factory.Map.lookup({".bss", SHT_NOBITS, SHF_ALLOC | SHF_WRITE})); // If we have a .opd section (used under PPC64 for function descriptors), // store a pointer to it here so that we can use it later when processing // relocations. - Out::Opd = Factory.lookup(".opd", SHT_PROGBITS, SHF_WRITE | SHF_ALLOC); + Out::Opd = + Factory.Map.lookup({".opd", SHT_PROGBITS, SHF_WRITE | SHF_ALLOC}); - Out::Dynamic->PreInitArraySec = Factory.lookup( - ".preinit_array", SHT_PREINIT_ARRAY, SHF_WRITE | SHF_ALLOC); + Out::Dynamic->PreInitArraySec = Factory.Map.lookup({ + ".preinit_array", SHT_PREINIT_ARRAY, SHF_WRITE | SHF_ALLOC}); Out::Dynamic->InitArraySec = - Factory.lookup(".init_array", SHT_INIT_ARRAY, SHF_WRITE | SHF_ALLOC); + Factory.Map.lookup({ ".init_array", SHT_INIT_ARRAY, SHF_WRITE | SHF_ALLOC }); Out::Dynamic->FiniArraySec = - Factory.lookup(".fini_array", SHT_FINI_ARRAY, SHF_WRITE | SHF_ALLOC); + Factory.Map.lookup({ ".fini_array", SHT_FINI_ARRAY, SHF_WRITE | SHF_ALLOC }); // Sort section contents for __attribute__((init_priority(N)). sortInitFini(Out::Dynamic->InitArraySec); sortInitFini(Out::Dynamic->FiniArraySec); - sortCtorsDtors(Factory.lookup(".ctors", SHT_PROGBITS, SHF_WRITE | SHF_ALLOC)); - sortCtorsDtors(Factory.lookup(".dtors", SHT_PROGBITS, SHF_WRITE | SHF_ALLOC)); + sortCtorsDtors(Factory.Map.lookup({".ctors", SHT_PROGBITS, SHF_WRITE | SHF_ALLOC})); + sortCtorsDtors(Factory.Map.lookup({".dtors", SHT_PROGBITS, SHF_WRITE | SHF_ALLOC})); // The linker needs to define SECNAME_start, SECNAME_end and SECNAME_stop // symbols for sections, so that the runtime can get the start and end