Index: lld/COFF/DLL.h =================================================================== --- lld/COFF/DLL.h +++ lld/COFF/DLL.h @@ -39,7 +39,7 @@ std::vector> Lookups; std::vector> Addresses; std::vector> Hints; - std::map> DLLNames; + std::vector> DLLNames; }; // Windows-specific. @@ -67,7 +67,7 @@ std::vector> Names; std::vector> HintNames; std::vector> Thunks; - std::map> DLLNames; + std::vector> DLLNames; }; // Windows-specific. Index: lld/COFF/DLL.cpp =================================================================== --- lld/COFF/DLL.cpp +++ lld/COFF/DLL.cpp @@ -394,10 +394,8 @@ V.push_back(C.get()); for (std::unique_ptr &C : Hints) V.push_back(C.get()); - for (auto &P : DLLNames) { - std::unique_ptr &C = P.second; + for (std::unique_ptr &C : DLLNames) V.push_back(C.get()); - } return V; } @@ -406,8 +404,6 @@ // Create .idata contents for each DLL. for (std::vector &Syms : V) { - StringRef Name = Syms[0]->getDLLName(); - // Create lookup and address tables. If they have external names, // we need to create HintName chunks to store the names. // If they don't (if they are import-by-ordinals), we store only @@ -433,9 +429,8 @@ Syms[I]->setLocation(Addresses[Base + I].get()); // Create the import table header. - if (!DLLNames.count(Name)) - DLLNames[Name] = make_unique(Name); - auto Dir = make_unique(DLLNames[Name].get()); + DLLNames.push_back(make_unique(Syms[0]->getDLLName())); + auto Dir = make_unique(DLLNames.back().get()); Dir->LookupTab = Lookups[Base].get(); Dir->AddressTab = Addresses[Base].get(); Dirs.push_back(std::move(Dir)); @@ -452,10 +447,8 @@ V.push_back(C.get()); for (std::unique_ptr &C : HintNames) V.push_back(C.get()); - for (auto &P : DLLNames) { - std::unique_ptr &C = P.second; + for (std::unique_ptr &C : DLLNames) V.push_back(C.get()); - } return V; } @@ -478,12 +471,9 @@ // Create .didat contents for each DLL. for (std::vector &Syms : V) { - StringRef Name = Syms[0]->getDLLName(); - // Create the delay import table header. - if (!DLLNames.count(Name)) - DLLNames[Name] = make_unique(Name); - auto Dir = make_unique(DLLNames[Name].get()); + DLLNames.push_back(make_unique(Syms[0]->getDLLName())); + auto Dir = make_unique(DLLNames.back().get()); size_t Base = Addresses.size(); for (DefinedImportData *S : Syms) {