[PECOFF] Use the first definition of an export if specified multiple times.

If the same symbol is specified multiple times as arguments of /export, the
first definition should be used.

llvm-svn: 197998
diff --git a/lld/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp b/lld/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
index 8363f25..55552c1 100644
--- a/lld/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
+++ b/lld/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
@@ -257,6 +257,16 @@
   return (flags | setMask) & ~clearMask;
 }
 
+void PECOFFLinkingContext::addDllExport(ExportDesc &desc) {
+  if (_dllExportSet.count(desc.name)) {
+    llvm::errs() << "Export symbol '" << desc.name
+                 << "' specified more than once.";
+    return;
+  }
+  _dllExports.push_back(desc);
+  _dllExportSet.insert(desc.name);
+}
+
 void PECOFFLinkingContext::addPasses(PassManager &pm) {
   pm.add(std::unique_ptr<Pass>(new pecoff::SetSubsystemPass(*this)));
   pm.add(std::unique_ptr<Pass>(new pecoff::EdataPass(*this)));