@@ -59,25 +59,17 @@ template <class ELFT> struct RelsOrRelas {
59
59
// sections.
60
60
class SectionBase {
61
61
public:
62
- enum Kind { Regular, Synthetic, Spill, EHFrame, Merge, Output, Class };
63
-
64
- Kind kind () const { return (Kind)sectionKind; }
65
-
66
- LLVM_PREFERRED_TYPE (Kind)
67
- uint8_t sectionKind : 3 ;
68
-
69
- // The next two bit fields are only used by InputSectionBase, but we
70
- // put them here so the struct packs better.
71
-
72
- LLVM_PREFERRED_TYPE (bool )
73
- uint8_t bss : 1 ;
74
-
75
- // Set for sections that should not be folded by ICF.
76
- LLVM_PREFERRED_TYPE (bool )
77
- uint8_t keepUnique : 1 ;
62
+ enum Kind : uint8_t {
63
+ Regular,
64
+ Synthetic,
65
+ Spill,
66
+ EHFrame,
67
+ Merge,
68
+ Output,
69
+ Class,
70
+ };
78
71
79
- uint8_t partition = 1 ;
80
- uint32_t type;
72
+ Kind kind () const { return sectionKind; }
81
73
82
74
// The file which contains this section. For InputSectionBase, its dynamic
83
75
// type is usually ObjFile<ELFT>, but may be an InputFile of InternalKind
@@ -93,11 +85,18 @@ class SectionBase {
93
85
94
86
// These corresponds to the fields in Elf_Shdr.
95
87
uint64_t flags;
88
+ uint32_t type;
96
89
uint32_t link;
97
90
uint32_t info;
98
91
uint32_t addralign;
99
92
uint32_t entsize;
100
93
94
+ Kind sectionKind;
95
+ uint8_t partition = 1 ;
96
+
97
+ // The next two bit fields are only used by InputSectionBase, but we
98
+ // put them here so the struct packs better.
99
+
101
100
Ctx &getCtx () const ;
102
101
OutputSection *getOutputSection ();
103
102
const OutputSection *getOutputSection () const {
@@ -118,9 +117,9 @@ class SectionBase {
118
117
constexpr SectionBase (Kind sectionKind, InputFile *file, StringRef name,
119
118
uint32_t type, uint64_t flags, uint32_t link,
120
119
uint32_t info, uint32_t addralign, uint32_t entsize)
121
- : sectionKind(sectionKind ), bss( false ), keepUnique( false ), type(type),
122
- file(file ), name(name ), flags(flags), link(link), info(info ),
123
- addralign(addralign), entsize(entsize ) {}
120
+ : file(file ), name(name ), flags(flags ), type(type), link(link ),
121
+ info(info ), addralign(addralign ), entsize(entsize ),
122
+ sectionKind(sectionKind ) {}
124
123
};
125
124
126
125
struct SymbolAnchor {
@@ -157,6 +156,25 @@ class InputSectionBase : public SectionBase {
157
156
return s->kind () != Output && s->kind () != Class;
158
157
}
159
158
159
+ LLVM_PREFERRED_TYPE (bool )
160
+ uint8_t bss : 1 ;
161
+
162
+ // Whether this section is SHT_CREL and has been decoded to RELA by
163
+ // relsOrRelas.
164
+ LLVM_PREFERRED_TYPE (bool )
165
+ uint8_t decodedCrel : 1 ;
166
+
167
+ // Set for sections that should not be folded by ICF.
168
+ LLVM_PREFERRED_TYPE (bool )
169
+ uint8_t keepUnique : 1 ;
170
+
171
+ // Whether the section needs to be padded with a NOP filler due to
172
+ // deleteFallThruJmpInsn.
173
+ LLVM_PREFERRED_TYPE (bool )
174
+ uint8_t nopFiller : 1 ;
175
+
176
+ mutable bool compressed = false ;
177
+
160
178
// Input sections are part of an output section. Special sections
161
179
// like .eh_frame and merge sections are first combined into a
162
180
// synthetic section that is then added to an output section. In all
@@ -176,16 +194,6 @@ class InputSectionBase : public SectionBase {
176
194
// be reset to zero after uses.
177
195
uint32_t bytesDropped = 0 ;
178
196
179
- mutable bool compressed = false ;
180
-
181
- // Whether this section is SHT_CREL and has been decoded to RELA by
182
- // relsOrRelas.
183
- bool decodedCrel = false ;
184
-
185
- // Whether the section needs to be padded with a NOP filler due to
186
- // deleteFallThruJmpInsn.
187
- bool nopFiller = false ;
188
-
189
197
void drop_back (unsigned num) {
190
198
assert (bytesDropped + num < 256 );
191
199
bytesDropped += num;
@@ -467,7 +475,7 @@ class PotentialSpillSection : public InputSection {
467
475
}
468
476
};
469
477
470
- static_assert (sizeof (InputSection) <= 160 , " InputSection is too big" );
478
+ static_assert (sizeof (InputSection) <= 152 , " InputSection is too big" );
471
479
472
480
class SyntheticSection : public InputSection {
473
481
public:
0 commit comments