[llvm-branch-commits] [clang] 200390c - [clang] [MinGW] Recognize -lcrtdll as a library replacing -lmsvcrt

Tom Stellard via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Feb 14 14:15:55 PST 2022


Author: Martin Storsjö
Date: 2022-02-14T14:13:29-08:00
New Revision: 200390c3c17196b9c0f34453eeb85175015b2283

URL: https://github.com/llvm/llvm-project/commit/200390c3c17196b9c0f34453eeb85175015b2283
DIFF: https://github.com/llvm/llvm-project/commit/200390c3c17196b9c0f34453eeb85175015b2283.diff

LOG: [clang] [MinGW] Recognize -lcrtdll as a library replacing -lmsvcrt

Differential Revision: https://reviews.llvm.org/D119234

(cherry picked from commit 079b6d02d1f52301e2d3276fadba822bf87b75b2)

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/MinGW.cpp
    clang/test/Driver/mingw-msvcrt.c

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/MinGW.cpp b/clang/lib/Driver/ToolChains/MinGW.cpp
index 0501f97374044..ceeaa79bc2021 100644
--- a/clang/lib/Driver/ToolChains/MinGW.cpp
+++ b/clang/lib/Driver/ToolChains/MinGW.cpp
@@ -86,7 +86,9 @@ void tools::MinGW::Linker::AddLibGCC(const ArgList &Args,
   CmdArgs.push_back("-lmoldname");
   CmdArgs.push_back("-lmingwex");
   for (auto Lib : Args.getAllArgValues(options::OPT_l))
-    if (StringRef(Lib).startswith("msvcr") || StringRef(Lib).startswith("ucrt"))
+    if (StringRef(Lib).startswith("msvcr") ||
+        StringRef(Lib).startswith("ucrt") ||
+        StringRef(Lib).startswith("crtdll"))
       return;
   CmdArgs.push_back("-lmsvcrt");
 }

diff  --git a/clang/test/Driver/mingw-msvcrt.c b/clang/test/Driver/mingw-msvcrt.c
index bb4813ca33a5a..48a30d8469cb6 100644
--- a/clang/test/Driver/mingw-msvcrt.c
+++ b/clang/test/Driver/mingw-msvcrt.c
@@ -2,6 +2,7 @@
 // RUN: %clang -v -target i686-pc-windows-gnu -lmsvcr120 -### %s 2>&1 | FileCheck -check-prefix=CHECK_MSVCR120 %s
 // RUN: %clang -v -target i686-pc-windows-gnu -lucrtbase -### %s 2>&1 | FileCheck -check-prefix=CHECK_UCRTBASE %s
 // RUN: %clang -v -target i686-pc-windows-gnu -lucrt -### %s 2>&1 | FileCheck -check-prefix=CHECK_UCRT %s
+// RUN: %clang -v -target i686-pc-windows-gnu -lcrtdll -### %s 2>&1 | FileCheck -check-prefix=CHECK_CRTDLL %s
 
 // CHECK_DEFAULT: "-lmingwex" "-lmsvcrt" "-ladvapi32"
 // CHECK_DEFAULT-SAME: "-lmsvcrt" "-lkernel32" "{{.*}}crtend.o"
@@ -11,3 +12,5 @@
 // CHECK_UCRTBASE-SAME: "-lmingwex" "-ladvapi32"
 // CHECK_UCRT: "-lucrt"
 // CHECK_UCRT-SAME: "-lmingwex" "-ladvapi32"
+// CHECK_CRTDLL: "-lcrtdll"
+// CHECK_CRTDLL-SAME: "-lmingwex" "-ladvapi32"


        


More information about the llvm-branch-commits mailing list