Skip to content

Commit 0a64fe5

Browse files
aykevltstellar
authored andcommitted
[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 (cherry picked from commit 57776f7)
1 parent e99a087 commit 0a64fe5

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

lld/ELF/Symbols.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,27 +108,27 @@ class Symbol {
108108

109109
// Symbol visibility. This is the computed minimum visibility of all
110110
// observed non-DSO symbols.
111-
unsigned visibility : 2;
111+
uint8_t visibility : 2;
112112

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

119119
// If this flag is true and the symbol has protected or default visibility, it
120120
// will appear in .dynsym. This flag is set by interposable DSO symbols in
121121
// executables, by most symbols in DSOs and executables built with
122122
// --export-dynamic, and by dynamic lists.
123-
unsigned exportDynamic : 1;
123+
uint8_t exportDynamic : 1;
124124

125125
// False if LTO shouldn't inline whatever this symbol points to. If a symbol
126126
// is overwritten after LTO, LTO shouldn't inline the symbol because it
127127
// doesn't know the final contents of the symbol.
128-
unsigned canInline : 1;
128+
uint8_t canInline : 1;
129129

130130
// True if this symbol is specified by --trace-symbol option.
131-
unsigned traced : 1;
131+
uint8_t traced : 1;
132132

133133
inline void replace(const Symbol &New);
134134

@@ -236,28 +236,28 @@ class Symbol {
236236
public:
237237
// True the symbol should point to its PLT entry.
238238
// For SharedSymbol only.
239-
unsigned needsPltAddr : 1;
239+
uint8_t needsPltAddr : 1;
240240

241241
// True if this symbol is in the Iplt sub-section of the Plt and the Igot
242242
// sub-section of the .got.plt or .got.
243-
unsigned isInIplt : 1;
243+
uint8_t isInIplt : 1;
244244

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

249249
// True if this symbol is preemptible at load time.
250-
unsigned isPreemptible : 1;
250+
uint8_t isPreemptible : 1;
251251

252252
// True if an undefined or shared symbol is used from a live section.
253-
unsigned used : 1;
253+
uint8_t used : 1;
254254

255255
// True if a call to this symbol needs to be followed by a restore of the
256256
// PPC64 toc pointer.
257-
unsigned needsTocRestore : 1;
257+
uint8_t needsTocRestore : 1;
258258

259259
// True if this symbol is defined by a linker script.
260-
unsigned scriptDefined : 1;
260+
uint8_t scriptDefined : 1;
261261

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

0 commit comments

Comments
 (0)