@@ -59,25 +59,17 @@ template <class ELFT> struct RelsOrRelas {
5959// sections.
6060class SectionBase {
6161public:
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+ };
7871
79- uint8_t partition = 1 ;
80- uint32_t type;
72+ Kind kind () const { return sectionKind; }
8173
8274 // The file which contains this section. For InputSectionBase, its dynamic
8375 // type is usually ObjFile<ELFT>, but may be an InputFile of InternalKind
@@ -93,11 +85,18 @@ class SectionBase {
9385
9486 // These corresponds to the fields in Elf_Shdr.
9587 uint64_t flags;
88+ uint32_t type;
9689 uint32_t link;
9790 uint32_t info;
9891 uint32_t addralign;
9992 uint32_t entsize;
10093
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+
101100 Ctx &getCtx () const ;
102101 OutputSection *getOutputSection ();
103102 const OutputSection *getOutputSection () const {
@@ -118,9 +117,9 @@ class SectionBase {
118117 constexpr SectionBase (Kind sectionKind, InputFile *file, StringRef name,
119118 uint32_t type, uint64_t flags, uint32_t link,
120119 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 ) {}
124123};
125124
126125struct SymbolAnchor {
@@ -157,6 +156,25 @@ class InputSectionBase : public SectionBase {
157156 return s->kind () != Output && s->kind () != Class;
158157 }
159158
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+
160178 // Input sections are part of an output section. Special sections
161179 // like .eh_frame and merge sections are first combined into a
162180 // synthetic section that is then added to an output section. In all
@@ -176,16 +194,6 @@ class InputSectionBase : public SectionBase {
176194 // be reset to zero after uses.
177195 uint32_t bytesDropped = 0 ;
178196
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-
189197 void drop_back (unsigned num) {
190198 assert (bytesDropped + num < 256 );
191199 bytesDropped += num;
@@ -467,7 +475,7 @@ class PotentialSpillSection : public InputSection {
467475 }
468476};
469477
470- static_assert (sizeof (InputSection) <= 160 , " InputSection is too big" );
478+ static_assert (sizeof (InputSection) <= 152 , " InputSection is too big" );
471479
472480class SyntheticSection : public InputSection {
473481public:
0 commit comments