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

Differential Revision: https://reviews.llvm.org/D119234
This commit is contained in:
Martin Storsjö 2022-02-08 10:48:32 +02:00
parent 9545976ff1
commit 079b6d02d1
2 changed files with 6 additions and 1 deletions

View File

@ -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");
}

View File

@ -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"