Index: lib/Object/COFFModuleDefinition.cpp =================================================================== --- lib/Object/COFFModuleDefinition.cpp +++ lib/Object/COFFModuleDefinition.cpp @@ -227,6 +227,10 @@ E.Name = (std::string("_").append(E.Name)); if (!E.ExtName.empty() && !isDecorated(E.ExtName, MingwDef)) E.ExtName = (std::string("_").append(E.ExtName)); + if (MingwDef) { + E.SymbolName = E.Name; + E.Name = E.Name.substr(0, E.Name.find('@')); + } } for (;;) { Index: test/DllTool/coff-stdcall.def =================================================================== --- /dev/null +++ test/DllTool/coff-stdcall.def @@ -0,0 +1,13 @@ +; RUN: llvm-dlltool -m i386 --input-def %s --output-lib %t.a +; RUN: llvm-readobj %t.a | FileCheck %s + +LIBRARY test.dll +EXPORTS +TestFunction@4 + +; CHECK: File: test.dll +; CHECK: Format: COFF-import-file +; CHECK: Type: code +; CHECK: Name type: undecorate +; CHECK: Symbol: __imp__TestFunction@4 +; CHECK: Symbol: _TestFunction@4