diff --git a/lld/COFF/DriverUtils.cpp b/lld/COFF/DriverUtils.cpp index 79627ae7f473..50d77601772e 100644 --- a/lld/COFF/DriverUtils.cpp +++ b/lld/COFF/DriverUtils.cpp @@ -444,17 +444,16 @@ std::error_code fixupExports() { std::map Map; std::vector V; for (Export &E : Config->Exports) { - auto Pair = Map.insert(std::make_pair(E.Name, &E)); + auto Pair = Map.insert(std::make_pair(E.ExtLibName, &E)); bool Inserted = Pair.second; if (Inserted) { V.push_back(E); continue; } Export *Existing = Pair.first->second; - if (E == *Existing) + if (E == *Existing || E.Name != Existing->Name) continue; llvm::errs() << "warning: duplicate /export option: " << E.Name << "\n"; - continue; } Config->Exports = std::move(V);