From 68b9eb60fa8ce5d73fd5e4700db0ff61f3a40388 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Fri, 12 Jun 2020 13:43:35 +0300 Subject: [PATCH] wrappers: Use -lucrtapp instead of -lvcruntime140_app Passing -lucrt* to the clang driver inhibits the implicit default -lmsvcrt, so this ends up only using libucrtapp.a instead of libucrt.a. This still requires that the default crt was ucrt, as the prebuilt libc++.a needs to have been built for the right crt. --- wrappers/clang-target-wrapper.c | 5 +++-- wrappers/clang-target-wrapper.sh | 5 +++-- wrappers/ld-wrapper.sh | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/wrappers/clang-target-wrapper.c b/wrappers/clang-target-wrapper.c index 94e6a40..4c77eeb 100644 --- a/wrappers/clang-target-wrapper.c +++ b/wrappers/clang-target-wrapper.c @@ -192,8 +192,9 @@ int _tmain(int argc, TCHAR* argv[]) { exec_argv[arg++] = _T("-DUNICODE"); // add the minimum runtime to use for UWP targets exec_argv[arg++] = _T("-Wl,-lwindowsapp"); - // This requires that the default crt is ucrt. - exec_argv[arg++] = _T("-Wl,-lvcruntime140_app"); + // This still requires that the toolchain (in particular, libc++.a) has + // been built targeting UCRT originally. + exec_argv[arg++] = _T("-Wl,-lucrtapp"); // force the user of Universal C Runtime exec_argv[arg++] = _T("-D_UCRT"); } diff --git a/wrappers/clang-target-wrapper.sh b/wrappers/clang-target-wrapper.sh index 1e58450..5d75702 100755 --- a/wrappers/clang-target-wrapper.sh +++ b/wrappers/clang-target-wrapper.sh @@ -74,8 +74,9 @@ mingw32uwp) FLAGS="$FLAGS -DUNICODE" # add the minimum runtime to use for UWP targets FLAGS="$FLAGS -Wl,-lwindowsapp" - # This requires that the default crt is ucrt. - FLAGS="$FLAGS -Wl,-lvcruntime140_app" + # This still requires that the toolchain (in particular, libc++.a) has + # been built targeting UCRT originally. + FLAGS="$FLAGS -Wl,-lucrtapp" # Force the Universal C Runtime FLAGS="$FLAGS -D_UCRT" ;; diff --git a/wrappers/ld-wrapper.sh b/wrappers/ld-wrapper.sh index 2e0e80c..ada8a07 100755 --- a/wrappers/ld-wrapper.sh +++ b/wrappers/ld-wrapper.sh @@ -34,7 +34,7 @@ esac FLAGS="-m $M" case $TARGET_OS in mingw32uwp) - FLAGS="$FLAGS -lwindowsapp -lvcruntime140_app" + FLAGS="$FLAGS -lwindowsapp -lucrtapp" ;; esac ld.lld $FLAGS "$@"