Skip to content

Commit 57776f7

Browse files
committed
[ELF] Fix lld build on Windows/MinGW
The patch in https://reviews.llvm.org/D64077 causes a build failure because both the Defined and SharedSymbol classes are bigger than 80 bytes on MinGW 8. This patch fixes this build failure by changing the type of the bitfields. It is a similar change to the bitfield changes in https://reviews.llvm.org/D64238, but instead of changing to bool I decided to use uint8_t because one of the bitfields takes up two bits instead of one. Note: the patch is slightly different from the one reviewed in Phabricator, but it is a trivial change to align it with LLVM master instead of LLVM 9. Also, it passes all lld tests. Differential Revision: https://reviews.llvm.org/D70266
1 parent a4a7c12 commit 57776f7

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

lld/ELF/Symbols.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,13 @@ class Symbol {
105105

106106
// Symbol visibility. This is the computed minimum visibility of all
107107
// observed non-DSO symbols.
108-
unsigned visibility : 2;
108+
uint8_t visibility : 2;
109109

110110
// True if the symbol was used for linking and thus need to be added to the
111111
// output file's symbol table. This is true for all symbols except for
112112
// unreferenced DSO symbols, lazy (archive) symbols, and bitcode symbols that
113113
// are unreferenced except by other bitcode objects.
114-
unsigned isUsedInRegularObj : 1;
114+
uint8_t isUsedInRegularObj : 1;
115115

116116
// Used by a Defined symbol with protected or default visibility, to record
117117
// whether it is required to be exported into .dynsym. This is set when any of
@@ -121,25 +121,25 @@ class Symbol {
121121
// - If -shared or --export-dynamic is specified, any symbol in an object
122122
// file/bitcode sets this property, unless suppressed by LTO
123123
// canBeOmittedFromSymbolTable().
124-
unsigned exportDynamic : 1;
124+
uint8_t exportDynamic : 1;
125125

126126
// True if the symbol is in the --dynamic-list file. A Defined symbol with
127127
// protected or default visibility with this property is required to be
128128
// exported into .dynsym.
129-
unsigned inDynamicList : 1;
129+
uint8_t inDynamicList : 1;
130130

131131
// False if LTO shouldn't inline whatever this symbol points to. If a symbol
132132
// is overwritten after LTO, LTO shouldn't inline the symbol because it
133133
// doesn't know the final contents of the symbol.
134-
unsigned canInline : 1;
134+
uint8_t canInline : 1;
135135

136136
// Used by Undefined and SharedSymbol to track if there has been at least one
137137
// undefined reference to the symbol. The binding may change to STB_WEAK if
138138
// the first undefined reference from a non-shared object is weak.
139-
unsigned referenced : 1;
139+
uint8_t referenced : 1;
140140

141141
// True if this symbol is specified by --trace-symbol option.
142-
unsigned traced : 1;
142+
uint8_t traced : 1;
143143

144144
inline void replace(const Symbol &newSym);
145145

@@ -248,28 +248,28 @@ class Symbol {
248248
public:
249249
// True the symbol should point to its PLT entry.
250250
// For SharedSymbol only.
251-
unsigned needsPltAddr : 1;
251+
uint8_t needsPltAddr : 1;
252252

253253
// True if this symbol is in the Iplt sub-section of the Plt and the Igot
254254
// sub-section of the .got.plt or .got.
255-
unsigned isInIplt : 1;
255+
uint8_t isInIplt : 1;
256256

257257
// True if this symbol needs a GOT entry and its GOT entry is actually in
258258
// Igot. This will be true only for certain non-preemptible ifuncs.
259-
unsigned gotInIgot : 1;
259+
uint8_t gotInIgot : 1;
260260

261261
// True if this symbol is preemptible at load time.
262-
unsigned isPreemptible : 1;
262+
uint8_t isPreemptible : 1;
263263

264264
// True if an undefined or shared symbol is used from a live section.
265-
unsigned used : 1;
265+
uint8_t used : 1;
266266

267267
// True if a call to this symbol needs to be followed by a restore of the
268268
// PPC64 toc pointer.
269-
unsigned needsTocRestore : 1;
269+
uint8_t needsTocRestore : 1;
270270

271271
// True if this symbol is defined by a linker script.
272-
unsigned scriptDefined : 1;
272+
uint8_t scriptDefined : 1;
273273

274274
// The partition whose dynamic symbol table contains this symbol's definition.
275275
uint8_t partition = 1;

0 commit comments

Comments
 (0)