@@ -78,6 +78,12 @@ class SectionBase {
7878
7979 uint8_t partition = 1 ;
8080 uint32_t type;
81+
82+ // The file which contains this section. For InputSectionBase, its dynamic
83+ // type is usually ObjFile<ELFT>, but may be an InputFile of InternalKind
84+ // (for a synthetic section).
85+ InputFile *file;
86+
8187 StringRef name;
8288
8389 // The 1-indexed partition that this section is assigned to by the garbage
@@ -92,6 +98,7 @@ class SectionBase {
9298 uint32_t link;
9399 uint32_t info;
94100
101+ Ctx &getCtx () const ;
95102 OutputSection *getOutputSection ();
96103 const OutputSection *getOutputSection () const {
97104 return const_cast <SectionBase *>(this )->getOutputSection ();
@@ -108,12 +115,12 @@ class SectionBase {
108115 void markDead () { partition = 0 ; }
109116
110117protected:
111- constexpr SectionBase (Kind sectionKind, StringRef name, uint64_t flags ,
112- uint32_t entsize , uint32_t addralign , uint32_t type ,
113- uint32_t info, uint32_t link)
118+ constexpr SectionBase (Kind sectionKind, InputFile *file, StringRef name ,
119+ uint64_t flags , uint32_t entsize , uint32_t addralign ,
120+ uint32_t type, uint32_t info, uint32_t link)
114121 : sectionKind(sectionKind), bss(false ), keepUnique(false ), type(type),
115- name(name), flags(flags), addralign(addralign), entsize(entsize ),
116- link(link), info(info) {}
122+ file(file), name(name), flags(flags), addralign(addralign),
123+ entsize(entsize), link(link), info(info) {}
117124};
118125
119126struct SymbolAnchor {
@@ -150,11 +157,6 @@ class InputSectionBase : public SectionBase {
150157 return s->kind () != Output && s->kind () != Class;
151158 }
152159
153- // The file which contains this section. Its dynamic type is usually
154- // ObjFile<ELFT>, but may be an InputFile of InternalKind (for a synthetic
155- // section).
156- InputFile *file;
157-
158160 // Input sections are part of an output section. Special sections
159161 // like .eh_frame and merge sections are first combined into a
160162 // synthetic section that is then added to an output section. In all
0 commit comments