Index: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp =================================================================== --- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp +++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp @@ -83,7 +83,7 @@ CmdArgs.push_back("-lmoldname"); CmdArgs.push_back("-lmingwex"); for (auto Lib : Args.getAllArgValues(options::OPT_l)) - if (StringRef(Lib).startswith("msvcr") || Lib == "ucrtbase") + if (StringRef(Lib).startswith("msvcr") || StringRef(Lib).startswith("ucrt")) 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 @@ -1,6 +1,12 @@ // 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 +// 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 // CHECK_DEFAULT: "-lmingwex" "-lmsvcrt" "-ladvapi32" // CHECK_MSVCR120: "-lmsvcr120" // CHECK_MSVCR120-SAME: "-lmingwex" "-ladvapi32" +// CHECK_UCRTBASE: "-lucrtbase" +// CHECK_UCRTBASE-SAME: "-lmingwex" "-ladvapi32" +// CHECK_UCRT: "-lucrt" +// CHECK_UCRT-SAME: "-lmingwex" "-ladvapi32"