]> granicus.if.org Git - clang/commitdiff
Pass -dll to link.exe when building with -shared (PR22697)
authorHans Wennborg <hans@hanshq.net>
Wed, 4 Mar 2015 23:16:21 +0000 (23:16 +0000)
committerHans Wennborg <hans@hanshq.net>
Wed, 4 Mar 2015 23:16:21 +0000 (23:16 +0000)
And start building a test for non-clang-cl link.exe invocations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@231312 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Tools.cpp
test/Driver/msvc-link.c [new file with mode: 0644]

index 5d66605c257d6af835ce7f4f1ddb7960129692eb..a80214e1e663b61529c94b1dda72ca653f68f41d 100644 (file)
@@ -8098,7 +8098,9 @@ void visualstudio::Link::ConstructJob(Compilation &C, const JobAction &JA,
   if (Args.hasArg(options::OPT_g_Group))
     CmdArgs.push_back("-debug");
 
-  bool DLL = Args.hasArg(options::OPT__SLASH_LD, options::OPT__SLASH_LDd);
+  bool DLL = Args.hasArg(options::OPT__SLASH_LD,
+                         options::OPT__SLASH_LDd,
+                         options::OPT_shared);
   if (DLL) {
     CmdArgs.push_back(Args.MakeArgString("-dll"));
 
diff --git a/test/Driver/msvc-link.c b/test/Driver/msvc-link.c
new file mode 100644 (file)
index 0000000..a93ecaf
--- /dev/null
@@ -0,0 +1,12 @@
+// RUN: %clang -target i686-pc-windows-msvc -### %s 2>&1 | FileCheck --check-prefix=BASIC %s
+// BASIC: "link.exe"
+// BASIC: "-out:a.exe"
+// BASIC: "-defaultlib:libcmt"
+// BASIC: "-nologo"
+
+// RUN: %clang -target i686-pc-windows-msvc -shared -o a.dll -### %s 2>&1 | FileCheck --check-prefix=DLL %s
+// DLL: "link.exe"
+// DLL: "-out:a.dll"
+// DLL: "-defaultlib:libcmt"
+// DLL: "-nologo"
+// DLL: "-dll"