COFF: Suppress "Duplicate entry" warning of lib.exe

We create a module-definition file and give that to lib.exe to
create an import library file. A module-definition has to be
syntactically and semantically correct, of course.

There was a case that we created a module-definition file that
lib.exe would complain for duplicate entries. If a user gives
an unmangled and mangled name for the same symbol, we would end
up having two duplicate lines for the mangled name in a module-
definition file.

This patch fixes that issue by uniquefying entries by mangled
symbol name.

llvm-svn: 243587
This commit is contained in:
Rui Ueyama 2015-07-29 22:38:27 +00:00
parent dd2eb13ac4
commit 966acb2e2f
1 changed files with 2 additions and 3 deletions

View File

@ -444,17 +444,16 @@ std::error_code fixupExports() {
std::map<StringRef, Export *> Map;
std::vector<Export> 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);