[lld] r266929 - lld-link: Fix default output name with /dll flag.

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 20 15:34:15 PDT 2016


Author: nico
Date: Wed Apr 20 17:34:15 2016
New Revision: 266929

URL: http://llvm.org/viewvc/llvm-project?rev=266929&view=rev
Log:
lld-link: Fix default output name with /dll flag.

If /dll is passed, the default output filename should be foo.dll,
not foo.exe.
http://reviews.llvm.org/D19321

Modified:
    lld/trunk/COFF/Driver.cpp
    lld/trunk/test/COFF/out.test

Modified: lld/trunk/COFF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Driver.cpp?rev=266929&r1=266928&r2=266929&view=diff
==============================================================================
--- lld/trunk/COFF/Driver.cpp (original)
+++ lld/trunk/COFF/Driver.cpp Wed Apr 20 17:34:15 2016
@@ -50,11 +50,12 @@ bool link(llvm::ArrayRef<const char *> A
   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.

Modified: lld/trunk/test/COFF/out.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/out.test?rev=266929&r1=266928&r2=266929&view=diff
==============================================================================
--- lld/trunk/test/COFF/out.test (original)
+++ lld/trunk/test/COFF/out.test Wed Apr 20 17:34:15 2016
@@ -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:




More information about the llvm-commits mailing list