[PATCH] D37530: [MinGW] Don't link -lmsvcrt if a different msvcrt version is to be linked
Martin Storsjö via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 25 12:26:27 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL314138: [MinGW] Don't link -lmsvcrt if a different msvcrt version is to be linked (authored by mstorsjo).
Changed prior to commit:
https://reviews.llvm.org/D37530?vs=114429&id=116587#toc
Repository:
rL LLVM
https://reviews.llvm.org/D37530
Files:
cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
cfe/trunk/test/Driver/mingw-msvcrt.c
Index: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
===================================================================
--- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
+++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
@@ -82,6 +82,9 @@
CmdArgs.push_back("-lmoldname");
CmdArgs.push_back("-lmingwex");
+ for (auto Lib : Args.getAllArgValues(options::OPT_l))
+ if (StringRef(Lib).startswith("msvcr") || Lib == "ucrtbase")
+ return;
CmdArgs.push_back("-lmsvcrt");
}
Index: cfe/trunk/test/Driver/mingw-msvcrt.c
===================================================================
--- cfe/trunk/test/Driver/mingw-msvcrt.c
+++ cfe/trunk/test/Driver/mingw-msvcrt.c
@@ -0,0 +1,5 @@
+// RUN: %clang -v -target i686-pc-windows-gnu -### %s 2>&1 | FileCheck -check-prefix=CHECK_DEFAULT %s
+// RUN: %clang -v -target i686-pc-windows-gnu -lmsvcr120 -### %s 2>&1 | FileCheck -check-prefix=CHECK_MSVCR120 %s
+
+// CHECK_DEFAULT: "-lmingwex" "-lmsvcrt" "-ladvapi32"
+// CHECK_MSVCR120: "-lmingwex" "-ladvapi32"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37530.116587.patch
Type: text/x-patch
Size: 1007 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170925/41a1879c/attachment.bin>
More information about the cfe-commits
mailing list