Skip to content

Commit 691e3c6

Browse files
authored
[lld-macho] Fix Defined size increase with -mms-bitfields (#107545)
Under the Microsoft ABI, only those bit fields can be merged whose underlying types have the same size. d175616 (`[lld-macho][arm64] Enhance safe ICF with thunk-based deduplication`) added an enum field (`identicalCodeFoldingKind`) next to booleans in the `Defined` class, which increased the size under the MS ABI. On MinGW targets, this triggered the `static_assert` which checks the size of `Defined` (for MSVC targets, the check is disabled due to another problem). Let's store it as a `uint8_t` to allow merging to take place. Fixes #107511
1 parent 725fab9 commit 691e3c6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lld/MachO/Symbols.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "Target.h"
1515

1616
#include "llvm/Object/Archive.h"
17+
#include "llvm/Support/Compiler.h"
1718
#include "llvm/Support/MathExtras.h"
1819

1920
namespace lld {
@@ -152,7 +153,8 @@ class Defined : public Symbol {
152153
// Whether this symbol should appear in the output symbol table.
153154
bool includeInSymtab : 1;
154155
// The ICF folding kind of this symbol: None / Body / Thunk.
155-
ICFFoldKind identicalCodeFoldingKind : 2;
156+
LLVM_PREFERRED_TYPE(ICFFoldKind)
157+
uint8_t identicalCodeFoldingKind : 2;
156158
// Symbols marked referencedDynamically won't be removed from the output's
157159
// symbol table by tools like strip. In theory, this could be set on arbitrary
158160
// symbols in input object files. In practice, it's used solely for the

0 commit comments

Comments
 (0)