Index: lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp =================================================================== --- lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp +++ lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp @@ -74,13 +74,6 @@ .Default(IMAGE_FILE_MACHINE_UNKNOWN); } -static std::string getImplibPath(StringRef Path) { - SmallString<128> Out = StringRef("lib"); - Out.append(Path); - sys::path::replace_extension(Out, ".a"); - return Out.str(); -} - int llvm::dlltoolDriverMain(llvm::ArrayRef ArgsArr) { DllOptTable Table; unsigned MissingIndex; @@ -154,8 +147,6 @@ } std::string Path = Args.getLastArgValue(OPT_l); - if (Path.empty()) - Path = getImplibPath(Def->OutputFile); if (Machine == IMAGE_FILE_MACHINE_I386 && Args.getLastArg(OPT_k)) { for (COFFShortExport& E : Def->Exports) { @@ -174,7 +165,8 @@ } } - if (writeImportLibrary(Def->OutputFile, Path, Def->Exports, Machine, true)) - return 1; + if (!Path.empty()) + if (writeImportLibrary(Def->OutputFile, Path, Def->Exports, Machine, true)) + return 1; return 0; }