Commit Graph

4 Commits

Author SHA1 Message Date
Martin Storsjö beeed368b6 [clang] [MinGW] Link kernel32 once after the last instance of msvcrt
The msvcrt library isn't a pure import library; it does contain
regular object files with wrappers/fallbacks, and these can require
linking against kernel32.

This only makes a difference when linking with ld.bfd, as lld
always searches all static libraries.

This matches a similar change made recently in gcc in
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=850533ab160ef40eccfd039e1e3b138cf26e76b8,
although clang adds --start-group --end-group around these libraries
if -static is specified, which gcc doesn't. But try to match gcc's
linking order in any case, for consistency.

Differential Revision: https://reviews.llvm.org/D80880
2020-06-17 09:37:07 +03:00
Martin Storsjo 995e596168 [MinGW] Treat any -lucrt* as replacing -lmsvcrt
Since SVN r314138, we check if the user has specified any particular
alternative msvcrt/ucrt version, and skip the default -lmsvcrt
in those cases.

In addition to the existing names checked, we should also treat
a plain -lucrt in the same way, mingw-w64 has now added a separate
import library named libucrt.a, in addition to libucrtbase.a.

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

llvm-svn: 336654
2018-07-10 10:46:45 +00:00
Martin Storsjo f9b3c67956 [test] Extend the Driver/mingw-msvcrt.c test with a -SAME check. NFC.
llvm-svn: 326180
2018-02-27 08:35:35 +00:00
Martin Storsjo 68c730a1b2 [MinGW] Don't link -lmsvcrt if a different msvcrt version is to be linked
Differential Revision: https://reviews.llvm.org/D37530

llvm-svn: 314138
2017-09-25 19:24:45 +00:00