summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/PECOFF/WriterImportLibrary.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/lib/ReaderWriter/PECOFF/WriterImportLibrary.cpp')
-rw-r--r--lld/lib/ReaderWriter/PECOFF/WriterImportLibrary.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/lld/lib/ReaderWriter/PECOFF/WriterImportLibrary.cpp b/lld/lib/ReaderWriter/PECOFF/WriterImportLibrary.cpp
index 74ca2bfb86b..d6081c1cf4b 100644
--- a/lld/lib/ReaderWriter/PECOFF/WriterImportLibrary.cpp
+++ b/lld/lib/ReaderWriter/PECOFF/WriterImportLibrary.cpp
@@ -30,7 +30,15 @@ createModuleDefinitionFile(const PECOFFLinkingContext &ctx) {
<< "EXPORTS\n";
for (const PECOFFLinkingContext::ExportDesc &desc : ctx.getDllExports()) {
- os << " " << desc.getExternalName();
+ // Symbol names in a module-definition file will be mangled by lib.exe,
+ // so we need to demangle them before writing to a .def file.
+ os << " ";
+ if (!desc.externalName.empty()) {
+ os << desc.externalName;
+ } else {
+ os << ctx.undecorateSymbol(desc.name);
+ }
+
if (!desc.isPrivate)
os << " @" << desc.ordinal;
if (desc.noname)
OpenPOWER on IntegriCloud