diff options
Diffstat (limited to 'contrib/llvm-project/lld/ELF/InputSection.h')
-rw-r--r-- | contrib/llvm-project/lld/ELF/InputSection.h | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/contrib/llvm-project/lld/ELF/InputSection.h b/contrib/llvm-project/lld/ELF/InputSection.h index 7ddc43916a0f..5319830b5d80 100644 --- a/contrib/llvm-project/lld/ELF/InputSection.h +++ b/contrib/llvm-project/lld/ELF/InputSection.h @@ -52,13 +52,6 @@ public: StringRef name; - // This pointer points to the "real" instance of this instance. - // Usually Repl == this. However, if ICF merges two sections, - // Repl pointer of one section points to another section. So, - // if you need to get a pointer to this instance, do not use - // this but instead this->Repl. - SectionBase *repl; - uint8_t sectionKind : 3; // The next two bit fields are only used by InputSectionBase, but we @@ -102,9 +95,9 @@ protected: constexpr SectionBase(Kind sectionKind, StringRef name, uint64_t flags, uint32_t entsize, uint32_t alignment, uint32_t type, uint32_t info, uint32_t link) - : name(name), repl(this), sectionKind(sectionKind), bss(false), - keepUnique(false), partition(0), alignment(alignment), flags(flags), - entsize(entsize), type(type), link(link), info(info) {} + : name(name), sectionKind(sectionKind), bss(false), keepUnique(false), + partition(0), alignment(alignment), flags(flags), entsize(entsize), + type(type), link(link), info(info) {} }; // This corresponds to a section of an input file. @@ -250,7 +243,7 @@ protected: // be found by looking at the next one). struct SectionPiece { SectionPiece(size_t off, uint32_t hash, bool live) - : inputOff(off), live(live || !config->gcSections), hash(hash >> 1) {} + : inputOff(off), live(live), hash(hash >> 1) {} uint32_t inputOff; uint32_t live : 1; @@ -278,7 +271,7 @@ public: // Splittable sections are handled as a sequence of data // rather than a single large blob of data. - std::vector<SectionPiece> pieces; + SmallVector<SectionPiece, 0> pieces; // Returns I'th piece's data. This function is very hot when // string merging is enabled, so we want to inline. @@ -367,6 +360,10 @@ public: template <class ELFT, class RelTy> void relocateNonAlloc(uint8_t *buf, llvm::ArrayRef<RelTy> rels); + // Points to the canonical section. If ICF folds two sections, repl pointer of + // one section points to the other. + InputSection *repl = this; + // Used by ICF. uint32_t eqClass[2] = {0, 0}; @@ -394,7 +391,7 @@ inline bool isDebugSection(const InputSectionBase &sec) { } // The list of all input sections. -extern std::vector<InputSectionBase *> inputSections; +extern SmallVector<InputSectionBase *, 0> inputSections; // The set of TOC entries (.toc + addend) for which we should not apply // toc-indirect to toc-relative relaxation. const Symbol * refers to the |