]> granicus.if.org Git - clang/commitdiff
Driver: support -L for MSVC toolchain under the GNU driver
authorSaleem Abdulrasool <compnerd@compnerd.org>
Fri, 1 Jul 2016 15:36:31 +0000 (15:36 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Fri, 1 Jul 2016 15:36:31 +0000 (15:36 +0000)
When not using clang in the CL emulation mode, honour the -L flags as additional
library paths to pass to the linker invocation.

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

lib/Driver/Tools.cpp
test/Driver/msvc-link.c

index cef2008bed4036b19a8d46adeb26c2b1a82d92d8..8b1171aba5ed6bda156bf54c136d62c0a366584d 100644 (file)
@@ -9950,6 +9950,10 @@ void visualstudio::Linker::ConstructJob(Compilation &C, const JobAction &JA,
                                            WindowsSdkLibPath.c_str()));
   }
 
+  if (!C.getDriver().IsCLMode() && Args.hasArg(options::OPT_L))
+    for (const auto &LibPath : Args.getAllArgValues(options::OPT_L))
+      CmdArgs.push_back(Args.MakeArgString("-libpath:" + LibPath));
+
   CmdArgs.push_back("-nologo");
 
   if (Args.hasArg(options::OPT_g_Group, options::OPT__SLASH_Z7))
index b44e3826199ca21eb74f5223a41369157560f2d0..8fe57331ee47832ba062157dcd59ca313f0613d7 100644 (file)
@@ -10,3 +10,9 @@
 // DLL: "-defaultlib:libcmt"
 // DLL: "-nologo"
 // DLL: "-dll"
+
+// RUN: %clang -target i686-pc-windows-msvc -L/var/empty -L/usr/lib -### %s 2>&1 | FileCheck --check-prefix LIBPATH %s
+// LIBPATH: "-libpath:/var/empty"
+// LIBPATH: "-libpath:/usr/lib"
+// LIBPATH: "-nologo"
+