Separate {Preinit,Init,Fini}Arrays from Out<ELFT>::Dynamic.
Even if an output is not a dynamic object, the output may have
.{preinit,init,fini} sections. Therefore, managing these sections
as Out<ELFT>::Dynamic's members is not correct.
llvm-svn: 278093
diff --git a/lld/ELF/OutputSections.h b/lld/ELF/OutputSections.h
index 4b40e78..5f5b691 100644
--- a/lld/ELF/OutputSections.h
+++ b/lld/ELF/OutputSections.h
@@ -527,10 +527,6 @@
explicit DynamicSection();
void finalize() override;
void writeTo(uint8_t *Buf) override;
-
- OutputSectionBase<ELFT> *PreInitArraySec = nullptr;
- OutputSectionBase<ELFT> *InitArraySec = nullptr;
- OutputSectionBase<ELFT> *FiniArraySec = nullptr;
};
template <class ELFT>
@@ -657,6 +653,10 @@
static Elf_Phdr *TlsPhdr;
static OutputSectionBase<ELFT> *ElfHeader;
static OutputSectionBase<ELFT> *ProgramHeaders;
+
+ static OutputSectionBase<ELFT> *PreinitArray;
+ static OutputSectionBase<ELFT> *InitArray;
+ static OutputSectionBase<ELFT> *FiniArray;
};
template <bool Is64Bits> struct SectionKey {
@@ -716,6 +716,9 @@
template <class ELFT> typename ELFT::Phdr *Out<ELFT>::TlsPhdr;
template <class ELFT> OutputSectionBase<ELFT> *Out<ELFT>::ElfHeader;
template <class ELFT> OutputSectionBase<ELFT> *Out<ELFT>::ProgramHeaders;
+template <class ELFT> OutputSectionBase<ELFT> *Out<ELFT>::PreinitArray;
+template <class ELFT> OutputSectionBase<ELFT> *Out<ELFT>::InitArray;
+template <class ELFT> OutputSectionBase<ELFT> *Out<ELFT>::FiniArray;
} // namespace elf
} // namespace lld