From: Hans Wennborg Date: Wed, 4 Mar 2015 23:16:21 +0000 (+0000) Subject: Pass -dll to link.exe when building with -shared (PR22697) X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4c95c7eb80eab914424971c1437ba360c9819342;p=clang Pass -dll to link.exe when building with -shared (PR22697) 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 --- diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 5d66605c25..a80214e1e6 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -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 index 0000000000..a93ecaf9b6 --- /dev/null +++ b/test/Driver/msvc-link.c @@ -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"