[all-commits] [llvm/llvm-project] beeed3: [clang] [MinGW] Link kernel32 once after the last ...

Martin Storsjö via All-commits all-commits at lists.llvm.org
Tue Jun 16 23:37:41 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: beeed368b60252178f66ab117d8a96ecdc35f60e
      https://github.com/llvm/llvm-project/commit/beeed368b60252178f66ab117d8a96ecdc35f60e
  Author: Martin Storsjö <martin at martin.st>
  Date:   2020-06-17 (Wed, 17 Jun 2020)

  Changed paths:
    M clang/lib/Driver/ToolChains/MinGW.cpp
    M clang/test/Driver/mingw-msvcrt.c

  Log Message:
  -----------
  [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


  Commit: 7b3fe969927731c69ba4d8a428442e1e191f49b5
      https://github.com/llvm/llvm-project/commit/7b3fe969927731c69ba4d8a428442e1e191f49b5
  Author: Martin Storsjö <martin at martin.st>
  Date:   2020-06-17 (Wed, 17 Jun 2020)

  Changed paths:
    M clang/lib/Sema/SemaDeclCXX.cpp
    M clang/test/SemaCXX/ms_struct.cpp

  Log Message:
  -----------
  [clang] Don't emit warn_cxx_ms_struct when MSBitfields is enabled globally

This diagnostic (which defaults to an error, added in
95833f33bda6c92e746e0b0007b69c2c30bfc693) was intended to clearly
point out cases where the C++ ABI won't match the Microsoft C++ ABI,
for cases when this is enabled via a pragma over a region of code.

The MSVC compatible struct layout feature can also be enabled via a
compiler option (-mms-bitfields). If enabled that way, one essentially
can't compile any C++ code unless also building with
-Wno-incompatible-ms-struct (which GCC doesn't support, and projects
developed with GCC aren't setting).

For the MinGW target, it's expected that the C++ ABI won't match
the MSVC one, if this option is used for getting the struct
layout to match MSVC.

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


  Commit: e3fd9dc9734c5775dc6824d0a839702e8d43e7f6
      https://github.com/llvm/llvm-project/commit/e3fd9dc9734c5775dc6824d0a839702e8d43e7f6
  Author: Martin Storsjö <martin at martin.st>
  Date:   2020-06-17 (Wed, 17 Jun 2020)

  Changed paths:
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/test/Driver/ms-bitfields.c

  Log Message:
  -----------
  [clang] Enable -mms-bitfields by default for mingw targets

This matches GCC, which enabled -mms-bitfields by default for
mingw targets in 4.7 [1].

[1] https://www.gnu.org/software/gcc/gcc-4.7/changes.html

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


Compare: https://github.com/llvm/llvm-project/compare/ccbd7e8d463a...e3fd9dc9734c


More information about the All-commits mailing list