[PATCH] D70266: [ELF] Fix lld build on Windows/MinGW

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 15 09:47:35 PST 2019


rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

I think this change looks good.

So far nobody has mentioned that the reduced struct (`struct Foo { unsigned myBit : 1; char myByte; };`) is 8 bytes with MSVC. It's highly possible that GCC is aligning their ABI with MSVC for better compatibility.

What I don't know is why the static_assert doesn't trigger with MSVC & clang-cl.

In any case, let's file a bug to:

1. Track down the change in GCC so we know when and why this happened
2. Decide if we should change clang's behavior to match GCC's bitfield behavior on Windows. This may be as simple as changing the -fms-bitfields default.

I'm not sure clang knows the GCC version it is aiming for compatibility with, but as long as we have a flag to get back the other behavior, we're doing pretty well.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70266/new/

https://reviews.llvm.org/D70266





More information about the llvm-commits mailing list