case InputSectionBase<ELFT>::Layout:
llvm_unreachable("Invalid section type");
}
- OwningSections.emplace_back(Sec);
+ Out<ELFT>::Pool.emplace_back(Sec);
return {Sec, true};
}
static OutputSectionBase<ELFT> *PreinitArray;
static OutputSectionBase<ELFT> *InitArray;
static OutputSectionBase<ELFT> *FiniArray;
+
+ // This pool owns dynamically-allocated output sections.
+ static std::vector<std::unique_ptr<OutputSectionBase<ELFT>>> Pool;
};
template <bool Is64Bits> struct SectionKey {
Key createKey(InputSectionBase<ELFT> *C, StringRef OutsecName);
llvm::SmallDenseMap<Key, OutputSectionBase<ELFT> *> Map;
- std::vector<std::unique_ptr<OutputSectionBase<ELFT>>> OwningSections;
};
template <class ELFT> BuildIdSection<ELFT> *Out<ELFT>::BuildId;
template <class ELFT> OutputSectionBase<ELFT> *Out<ELFT>::InitArray;
template <class ELFT> OutputSectionBase<ELFT> *Out<ELFT>::FiniArray;
+template <class ELFT>
+std::vector<std::unique_ptr<OutputSectionBase<ELFT>>> Out<ELFT>::Pool;
+
} // namespace elf
} // namespace lld