r231312 - Pass -dll to link.exe when building with -shared (PR22697)

Hans Wennborg hans at hanshq.net
Wed Mar 4 15:16:21 PST 2015


Author: hans
Date: Wed Mar  4 17:16:21 2015
New Revision: 231312

URL: http://llvm.org/viewvc/llvm-project?rev=231312&view=rev
Log:
Pass -dll to link.exe when building with -shared (PR22697)

And start building a test for non-clang-cl link.exe invocations.

Added:
    cfe/trunk/test/Driver/msvc-link.c
Modified:
    cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=231312&r1=231311&r2=231312&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Mar  4 17:16:21 2015
@@ -8098,7 +8098,9 @@ void visualstudio::Link::ConstructJob(Co
   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"));
 

Added: cfe/trunk/test/Driver/msvc-link.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/msvc-link.c?rev=231312&view=auto
==============================================================================
--- cfe/trunk/test/Driver/msvc-link.c (added)
+++ cfe/trunk/test/Driver/msvc-link.c Wed Mar  4 17:16:21 2015
@@ -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"





More information about the cfe-commits mailing list