[PATCH] D80880: [clang] [MinGW] Link kernel32 once after the last instance of msvcrt
Martin Storsjö via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 16 23:57:51 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbeeed368b602: [clang] [MinGW] Link kernel32 once after the last instance of msvcrt (authored by mstorsjo).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D80880/new/
https://reviews.llvm.org/D80880
Files:
clang/lib/Driver/ToolChains/MinGW.cpp
clang/test/Driver/mingw-msvcrt.c
Index: clang/test/Driver/mingw-msvcrt.c
===================================================================
--- clang/test/Driver/mingw-msvcrt.c
+++ clang/test/Driver/mingw-msvcrt.c
@@ -4,6 +4,7 @@
// RUN: %clang -v -target i686-pc-windows-gnu -lucrt -### %s 2>&1 | FileCheck -check-prefix=CHECK_UCRT %s
// CHECK_DEFAULT: "-lmingwex" "-lmsvcrt" "-ladvapi32"
+// CHECK_DEFAULT-SAME: "-lmsvcrt" "-lkernel32" "{{.*}}crtend.o"
// CHECK_MSVCR120: "-lmsvcr120"
// CHECK_MSVCR120-SAME: "-lmingwex" "-ladvapi32"
// CHECK_UCRTBASE: "-lucrtbase"
Index: clang/lib/Driver/ToolChains/MinGW.cpp
===================================================================
--- clang/lib/Driver/ToolChains/MinGW.cpp
+++ clang/lib/Driver/ToolChains/MinGW.cpp
@@ -304,10 +304,13 @@
CmdArgs.push_back("-lkernel32");
}
- if (Args.hasArg(options::OPT_static))
+ if (Args.hasArg(options::OPT_static)) {
CmdArgs.push_back("--end-group");
- else
+ } else {
AddLibGCC(Args, CmdArgs);
+ if (!HasWindowsApp)
+ CmdArgs.push_back("-lkernel32");
+ }
}
if (!Args.hasArg(options::OPT_nostartfiles)) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80880.271280.patch
Type: text/x-patch
Size: 1156 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200617/a8d0cbef/attachment-0001.bin>
More information about the cfe-commits
mailing list