[lld] r243587 - COFF: Suppress "Duplicate entry" warning of lib.exe

Rui Ueyama ruiu at google.com
Wed Jul 29 15:38:27 PDT 2015


Author: ruiu
Date: Wed Jul 29 17:38:27 2015
New Revision: 243587

URL: http://llvm.org/viewvc/llvm-project?rev=243587&view=rev
Log:
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.

Modified:
    lld/trunk/COFF/DriverUtils.cpp

Modified: lld/trunk/COFF/DriverUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/DriverUtils.cpp?rev=243587&r1=243586&r2=243587&view=diff
==============================================================================
--- lld/trunk/COFF/DriverUtils.cpp (original)
+++ lld/trunk/COFF/DriverUtils.cpp Wed Jul 29 17:38:27 2015
@@ -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);
 





More information about the llvm-commits mailing list