Index: COFF/Driver.cpp =================================================================== --- COFF/Driver.cpp +++ COFF/Driver.cpp @@ -50,11 +50,12 @@ return true; } -// Drop directory components and replace extension with ".exe". +// Drop directory components and replace extension with ".exe" or ".dll". static std::string getOutputPath(StringRef Path) { auto P = Path.find_last_of("\\/"); StringRef S = (P == StringRef::npos) ? Path : Path.substr(P + 1); - return (S.substr(0, S.rfind('.')) + ".exe").str(); + const char* E = Config->DLL ? ".dll" : ".exe"; + return (S.substr(0, S.rfind('.')) + E).str(); } // Opens a file. Path has to be resolved already. Index: test/COFF/out.test =================================================================== --- test/COFF/out.test +++ test/COFF/out.test @@ -5,12 +5,13 @@ # RUN: cp %t.obj %T/out/tmp/out2 # RUN: cp %t.obj %T/out/tmp/out3.xyz +# RUN: rm -f out1.exe out2.exe out3.exe out3.dll # RUN: lld-link /entry:main %T/out/out1.obj # RUN: lld-link /entry:main %T/out/tmp/out2 -# RUN: lld-link /entry:main %T/out/tmp/out3.xyz +# RUN: lld-link /dll /entry:main %T/out/tmp/out3.xyz # RUN: llvm-readobj out1.exe | FileCheck %s # RUN: llvm-readobj out2.exe | FileCheck %s -# RUN: llvm-readobj out3.exe | FileCheck %s +# RUN: llvm-readobj out3.dll | FileCheck %s CHECK: File: