1 //===- SyntheticSection.h ---------------------------------------*- C++ -*-===//
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // Synthetic sections represent chunks of linker-created data. If you
11 // need to create a chunk of data that to be included in some section
12 // in the result, you probably want to create that as a synthetic section.
14 // Synthetic sections are designed as input sections as opposed to
15 // output sections because we want to allow them to be manipulated
16 // using linker scripts just like other input sections from regular
19 //===----------------------------------------------------------------------===//
21 #ifndef LLD_ELF_SYNTHETIC_SECTION_H
22 #define LLD_ELF_SYNTHETIC_SECTION_H
26 #include "InputSection.h"
27 #include "llvm/ADT/MapVector.h"
28 #include "llvm/MC/StringTableBuilder.h"
35 class SyntheticSection : public InputSection {
37 SyntheticSection(uint64_t Flags, uint32_t Type, uint32_t Alignment,
39 : InputSection(Flags, Type, Alignment, {}, Name,
40 InputSectionBase::Synthetic) {
44 virtual ~SyntheticSection() = default;
45 virtual void writeTo(uint8_t *Buf) = 0;
46 virtual size_t getSize() const = 0;
47 virtual void finalizeContents() {}
48 // If the section has the SHF_ALLOC flag and the size may be changed if
49 // thunks are added, update the section size.
50 virtual void updateAllocSize() {}
51 // If any additional finalization of contents are needed post thunk creation.
52 virtual void postThunkContents() {}
53 virtual bool empty() const { return false; }
54 uint64_t getVA() const;
56 static bool classof(const SectionBase *D) {
57 return D->kind() == InputSectionBase::Synthetic;
62 EhSectionPiece *Piece = nullptr;
63 std::vector<EhSectionPiece *> FdePieces;
66 // Section for .eh_frame.
67 template <class ELFT> class EhFrameSection final : public SyntheticSection {
68 typedef typename ELFT::Shdr Elf_Shdr;
69 typedef typename ELFT::Rel Elf_Rel;
70 typedef typename ELFT::Rela Elf_Rela;
72 void updateAlignment(uint64_t Val) {
73 if (Val > this->Alignment)
74 this->Alignment = Val;
79 void writeTo(uint8_t *Buf) override;
80 void finalizeContents() override;
81 bool empty() const override { return Sections.empty(); }
82 size_t getSize() const override { return Size; }
84 void addSection(InputSectionBase *S);
88 std::vector<EhInputSection *> Sections;
92 template <class RelTy>
93 void addSectionAux(EhInputSection *S, llvm::ArrayRef<RelTy> Rels);
95 template <class RelTy>
96 CieRecord *addCie(EhSectionPiece &Piece, ArrayRef<RelTy> Rels);
98 template <class RelTy>
99 bool isFdeLive(EhSectionPiece &Piece, ArrayRef<RelTy> Rels);
101 uint64_t getFdePc(uint8_t *Buf, size_t Off, uint8_t Enc);
103 std::vector<CieRecord *> Cies;
105 // CIE records are uniquified by their contents and personality functions.
106 llvm::DenseMap<std::pair<ArrayRef<uint8_t>, SymbolBody *>, CieRecord> CieMap;
109 class GotSection : public SyntheticSection {
112 size_t getSize() const override { return Size; }
113 void finalizeContents() override;
114 bool empty() const override;
115 void writeTo(uint8_t *Buf) override;
117 void addEntry(SymbolBody &Sym);
118 bool addDynTlsEntry(SymbolBody &Sym);
120 uint64_t getGlobalDynAddr(const SymbolBody &B) const;
121 uint64_t getGlobalDynOffset(const SymbolBody &B) const;
123 uint64_t getTlsIndexVA() { return this->getVA() + TlsIndexOff; }
124 uint32_t getTlsIndexOff() const { return TlsIndexOff; }
126 // Flag to force GOT to be in output if we have relocations
127 // that relies on its address.
128 bool HasGotOffRel = false;
131 size_t NumEntries = 0;
132 uint32_t TlsIndexOff = -1;
136 // .note.gnu.build-id section.
137 class BuildIdSection : public SyntheticSection {
138 // First 16 bytes are a header.
139 static const unsigned HeaderSize = 16;
143 void writeTo(uint8_t *Buf) override;
144 size_t getSize() const override { return HeaderSize + HashSize; }
145 void writeBuildId(llvm::ArrayRef<uint8_t> Buf);
148 void computeHash(llvm::ArrayRef<uint8_t> Buf,
149 std::function<void(uint8_t *, ArrayRef<uint8_t>)> Hash);
155 // BssSection is used to reserve space for copy relocations and common symbols.
156 // We create three instances of this class for .bss, .bss.rel.ro and "COMMON",
157 // that are used for writable symbols, read-only symbols and common symbols,
159 class BssSection final : public SyntheticSection {
161 BssSection(StringRef Name);
162 void writeTo(uint8_t *) override {}
163 bool empty() const override { return getSize() == 0; }
164 size_t reserveSpace(uint64_t Size, uint32_t Alignment);
165 size_t getSize() const override { return Size; }
171 class MipsGotSection final : public SyntheticSection {
174 void writeTo(uint8_t *Buf) override;
175 size_t getSize() const override { return Size; }
176 void updateAllocSize() override;
177 void finalizeContents() override;
178 bool empty() const override;
179 void addEntry(SymbolBody &Sym, int64_t Addend, RelExpr Expr);
180 bool addDynTlsEntry(SymbolBody &Sym);
182 uint64_t getPageEntryOffset(const SymbolBody &B, int64_t Addend) const;
183 uint64_t getBodyEntryOffset(const SymbolBody &B, int64_t Addend) const;
184 uint64_t getGlobalDynOffset(const SymbolBody &B) const;
186 // Returns the symbol which corresponds to the first entry of the global part
187 // of GOT on MIPS platform. It is required to fill up MIPS-specific dynamic
189 // Returns nullptr if the global part is empty.
190 const SymbolBody *getFirstGlobalEntry() const;
192 // Returns the number of entries in the local part of GOT including
193 // the number of reserved entries.
194 unsigned getLocalEntriesNum() const;
196 // Returns offset of TLS part of the MIPS GOT table. This part goes
197 // after 'local' and 'global' entries.
198 uint64_t getTlsOffset() const;
200 uint32_t getTlsIndexOff() const { return TlsIndexOff; }
202 uint64_t getGp() const;
205 // MIPS GOT consists of three parts: local, global and tls. Each part
206 // contains different types of entries. Here is a layout of GOT:
207 // - Header entries |
208 // - Page entries | Local part
209 // - Local entries (16-bit access) |
210 // - Local entries (32-bit access) |
211 // - Normal global entries || Global part
212 // - Reloc-only global entries ||
213 // - TLS entries ||| TLS part
216 // Two entries hold predefined value 0x0 and 0x80000000.
218 // These entries created by R_MIPS_GOT_PAGE relocation and R_MIPS_GOT16
219 // relocation against local symbols. They are initialized by higher 16-bit
220 // of the corresponding symbol's value. So each 64kb of address space
221 // requires a single GOT entry.
222 // Local entries (16-bit access):
223 // These entries created by GOT relocations against global non-preemptible
224 // symbols so dynamic linker is not necessary to resolve the symbol's
225 // values. "16-bit access" means that corresponding relocations address
226 // GOT using 16-bit index. Each unique Symbol-Addend pair has its own
228 // Local entries (32-bit access):
229 // These entries are the same as above but created by relocations which
230 // address GOT using 32-bit index (R_MIPS_GOT_HI16/LO16 etc).
231 // Normal global entries:
232 // These entries created by GOT relocations against preemptible global
233 // symbols. They need to be initialized by dynamic linker and they ordered
234 // exactly as the corresponding entries in the dynamic symbols table.
235 // Reloc-only global entries:
236 // These entries created for symbols that are referenced by dynamic
237 // relocations R_MIPS_REL32. These entries are not accessed with gp-relative
238 // addressing, but MIPS ABI requires that these entries be present in GOT.
240 // Entries created by TLS relocations.
242 // Number of "Header" entries.
243 static const unsigned HeaderEntriesNum = 2;
244 // Number of allocated "Page" entries.
245 uint32_t PageEntriesNum = 0;
246 // Map output sections referenced by MIPS GOT relocations
247 // to the first index of "Page" entries allocated for this section.
248 llvm::SmallMapVector<const OutputSection *, size_t, 16> PageIndexMap;
250 typedef std::pair<const SymbolBody *, uint64_t> GotEntry;
251 typedef std::vector<GotEntry> GotEntries;
252 // Map from Symbol-Addend pair to the GOT index.
253 llvm::DenseMap<GotEntry, size_t> EntryIndexMap;
254 // Local entries (16-bit access).
255 GotEntries LocalEntries;
256 // Local entries (32-bit access).
257 GotEntries LocalEntries32;
259 // Normal and reloc-only global entries.
260 GotEntries GlobalEntries;
263 std::vector<const SymbolBody *> TlsEntries;
265 uint32_t TlsIndexOff = -1;
269 class GotPltSection final : public SyntheticSection {
272 void addEntry(SymbolBody &Sym);
273 size_t getSize() const override;
274 void writeTo(uint8_t *Buf) override;
275 bool empty() const override { return Entries.empty(); }
278 std::vector<const SymbolBody *> Entries;
281 // The IgotPltSection is a Got associated with the PltSection for GNU Ifunc
282 // Symbols that will be relocated by Target->IRelativeRel.
283 // On most Targets the IgotPltSection will immediately follow the GotPltSection
284 // on ARM the IgotPltSection will immediately follow the GotSection.
285 class IgotPltSection final : public SyntheticSection {
288 void addEntry(SymbolBody &Sym);
289 size_t getSize() const override;
290 void writeTo(uint8_t *Buf) override;
291 bool empty() const override { return Entries.empty(); }
294 std::vector<const SymbolBody *> Entries;
297 class StringTableSection final : public SyntheticSection {
299 StringTableSection(StringRef Name, bool Dynamic);
300 unsigned addString(StringRef S, bool HashIt = true);
301 void writeTo(uint8_t *Buf) override;
302 size_t getSize() const override { return Size; }
303 bool isDynamic() const { return Dynamic; }
310 llvm::DenseMap<StringRef, unsigned> StringMap;
311 std::vector<StringRef> Strings;
316 DynamicReloc(uint32_t Type, const InputSectionBase *InputSec,
317 uint64_t OffsetInSec, bool UseSymVA, SymbolBody *Sym,
319 : Type(Type), Sym(Sym), InputSec(InputSec), OffsetInSec(OffsetInSec),
320 UseSymVA(UseSymVA), Addend(Addend) {}
322 uint64_t getOffset() const;
323 int64_t getAddend() const;
324 uint32_t getSymIndex() const;
325 const InputSectionBase *getInputSec() const { return InputSec; }
331 const InputSectionBase *InputSec = nullptr;
332 uint64_t OffsetInSec;
337 template <class ELFT> class DynamicSection final : public SyntheticSection {
338 typedef typename ELFT::Dyn Elf_Dyn;
339 typedef typename ELFT::Rel Elf_Rel;
340 typedef typename ELFT::Rela Elf_Rela;
341 typedef typename ELFT::Shdr Elf_Shdr;
342 typedef typename ELFT::Sym Elf_Sym;
344 // The .dynamic section contains information for the dynamic linker.
345 // The section consists of fixed size entries, which consist of
346 // type and value fields. Value are one of plain integers, symbol
347 // addresses, or section addresses. This struct represents the entry.
351 OutputSection *OutSec;
354 const SymbolBody *Sym;
356 enum KindT { SecAddr, SecSize, SymAddr, PlainInt, InSecAddr } Kind;
357 Entry(int32_t Tag, OutputSection *OutSec, KindT Kind = SecAddr)
358 : Tag(Tag), OutSec(OutSec), Kind(Kind) {}
359 Entry(int32_t Tag, InputSection *Sec)
360 : Tag(Tag), InSec(Sec), Kind(InSecAddr) {}
361 Entry(int32_t Tag, uint64_t Val) : Tag(Tag), Val(Val), Kind(PlainInt) {}
362 Entry(int32_t Tag, const SymbolBody *Sym)
363 : Tag(Tag), Sym(Sym), Kind(SymAddr) {}
366 // finalizeContents() fills this vector with the section contents.
367 std::vector<Entry> Entries;
371 void finalizeContents() override;
372 void writeTo(uint8_t *Buf) override;
373 size_t getSize() const override { return Size; }
377 void add(Entry E) { Entries.push_back(E); }
381 template <class ELFT> class RelocationSection final : public SyntheticSection {
382 typedef typename ELFT::Rel Elf_Rel;
383 typedef typename ELFT::Rela Elf_Rela;
386 RelocationSection(StringRef Name, bool Sort);
387 void addReloc(const DynamicReloc &Reloc);
388 unsigned getRelocOffset();
389 void finalizeContents() override;
390 void writeTo(uint8_t *Buf) override;
391 bool empty() const override { return Relocs.empty(); }
392 size_t getSize() const override { return Relocs.size() * this->Entsize; }
393 size_t getRelativeRelocCount() const { return NumRelativeRelocs; }
397 size_t NumRelativeRelocs = 0;
398 std::vector<DynamicReloc> Relocs;
401 struct SymbolTableEntry {
406 class SymbolTableBaseSection : public SyntheticSection {
408 SymbolTableBaseSection(StringTableSection &StrTabSec);
409 void finalizeContents() override;
410 void postThunkContents() override;
411 size_t getSize() const override { return getNumSymbols() * Entsize; }
412 void addSymbol(SymbolBody *Body);
413 unsigned getNumSymbols() const { return Symbols.size() + 1; }
414 size_t getSymbolIndex(SymbolBody *Body);
415 ArrayRef<SymbolTableEntry> getSymbols() const { return Symbols; }
418 // A vector of symbols and their string table offsets.
419 std::vector<SymbolTableEntry> Symbols;
421 StringTableSection &StrTabSec;
424 template <class ELFT>
425 class SymbolTableSection final : public SymbolTableBaseSection {
426 typedef typename ELFT::Sym Elf_Sym;
429 SymbolTableSection(StringTableSection &StrTabSec);
430 void writeTo(uint8_t *Buf) override;
433 // Outputs GNU Hash section. For detailed explanation see:
434 // https://blogs.oracle.com/ali/entry/gnu_hash_elf_sections
435 class GnuHashTableSection final : public SyntheticSection {
437 GnuHashTableSection();
438 void finalizeContents() override;
439 void writeTo(uint8_t *Buf) override;
440 size_t getSize() const override { return Size; }
442 // Adds symbols to the hash table.
443 // Sorts the input to satisfy GNU hash section requirements.
444 void addSymbols(std::vector<SymbolTableEntry> &Symbols);
447 size_t getShift2() const { return Config->Is64 ? 6 : 5; }
449 void writeBloomFilter(uint8_t *Buf);
450 void writeHashTable(uint8_t *Buf);
458 std::vector<Entry> Symbols;
464 template <class ELFT> class HashTableSection final : public SyntheticSection {
467 void finalizeContents() override;
468 void writeTo(uint8_t *Buf) override;
469 size_t getSize() const override { return Size; }
475 // The PltSection is used for both the Plt and Iplt. The former always has a
476 // header as its first entry that is used at run-time to resolve lazy binding.
477 // The latter is used for GNU Ifunc symbols, that will be subject to a
478 // Target->IRelativeRel.
479 class PltSection : public SyntheticSection {
481 PltSection(size_t HeaderSize);
482 void writeTo(uint8_t *Buf) override;
483 size_t getSize() const override;
484 bool empty() const override { return Entries.empty(); }
487 template <class ELFT> void addEntry(SymbolBody &Sym);
490 void writeHeader(uint8_t *Buf){};
491 void addHeaderSymbols(){};
492 unsigned getPltRelocOff() const;
493 std::vector<std::pair<const SymbolBody *, unsigned>> Entries;
494 // Iplt always has HeaderSize of 0, the Plt HeaderSize is always non-zero
498 class GdbIndexSection final : public SyntheticSection {
499 const unsigned OffsetTypeSize = 4;
500 const unsigned CuListOffset = 6 * OffsetTypeSize;
501 const unsigned CompilationUnitSize = 16;
502 const unsigned AddressEntrySize = 16 + OffsetTypeSize;
503 const unsigned SymTabEntrySize = 2 * OffsetTypeSize;
506 GdbIndexSection(std::vector<GdbIndexChunk> &&Chunks);
507 void finalizeContents() override;
508 void writeTo(uint8_t *Buf) override;
509 size_t getSize() const override;
510 bool empty() const override;
512 // Symbol table is a hash table for types and names.
513 // It is the area of gdb index.
514 GdbHashTab SymbolTable;
516 // CU vector is a part of constant pool area of section.
517 std::vector<std::set<uint32_t>> CuVectors;
519 // String pool is also a part of constant pool, it follows CU vectors.
520 llvm::StringTableBuilder StringPool;
522 // Each chunk contains information gathered from a debug sections of single
523 // object and used to build different areas of gdb index.
524 std::vector<GdbIndexChunk> Chunks;
529 uint32_t CuTypesOffset;
530 uint32_t SymTabOffset;
531 uint32_t ConstantPoolOffset;
532 uint32_t StringPoolOffset;
534 size_t CuVectorsSize = 0;
535 std::vector<size_t> CuVectorsOffset;
537 bool Finalized = false;
540 template <class ELFT> GdbIndexSection *createGdbIndex();
542 // --eh-frame-hdr option tells linker to construct a header for all the
543 // .eh_frame sections. This header is placed to a section named .eh_frame_hdr
544 // and also to a PT_GNU_EH_FRAME segment.
545 // At runtime the unwinder then can find all the PT_GNU_EH_FRAME segments by
546 // calling dl_iterate_phdr.
547 // This section contains a lookup table for quick binary search of FDEs.
548 // Detailed info about internals can be found in Ian Lance Taylor's blog:
549 // http://www.airs.com/blog/archives/460 (".eh_frame")
550 // http://www.airs.com/blog/archives/462 (".eh_frame_hdr")
551 template <class ELFT> class EhFrameHeader final : public SyntheticSection {
554 void writeTo(uint8_t *Buf) override;
555 size_t getSize() const override;
556 void addFde(uint32_t Pc, uint32_t FdeVA);
557 bool empty() const override;
565 std::vector<FdeData> Fdes;
568 // For more information about .gnu.version and .gnu.version_r see:
569 // https://www.akkadia.org/drepper/symbol-versioning
571 // The .gnu.version_d section which has a section type of SHT_GNU_verdef shall
572 // contain symbol version definitions. The number of entries in this section
573 // shall be contained in the DT_VERDEFNUM entry of the .dynamic section.
574 // The section shall contain an array of Elf_Verdef structures, optionally
575 // followed by an array of Elf_Verdaux structures.
576 template <class ELFT>
577 class VersionDefinitionSection final : public SyntheticSection {
578 typedef typename ELFT::Verdef Elf_Verdef;
579 typedef typename ELFT::Verdaux Elf_Verdaux;
582 VersionDefinitionSection();
583 void finalizeContents() override;
584 size_t getSize() const override;
585 void writeTo(uint8_t *Buf) override;
588 void writeOne(uint8_t *Buf, uint32_t Index, StringRef Name, size_t NameOff);
590 unsigned FileDefNameOff;
593 // The .gnu.version section specifies the required version of each symbol in the
594 // dynamic symbol table. It contains one Elf_Versym for each dynamic symbol
595 // table entry. An Elf_Versym is just a 16-bit integer that refers to a version
596 // identifier defined in the either .gnu.version_r or .gnu.version_d section.
597 // The values 0 and 1 are reserved. All other values are used for versions in
598 // the own object or in any of the dependencies.
599 template <class ELFT>
600 class VersionTableSection final : public SyntheticSection {
601 typedef typename ELFT::Versym Elf_Versym;
604 VersionTableSection();
605 void finalizeContents() override;
606 size_t getSize() const override;
607 void writeTo(uint8_t *Buf) override;
608 bool empty() const override;
611 // The .gnu.version_r section defines the version identifiers used by
612 // .gnu.version. It contains a linked list of Elf_Verneed data structures. Each
613 // Elf_Verneed specifies the version requirements for a single DSO, and contains
614 // a reference to a linked list of Elf_Vernaux data structures which define the
615 // mapping from version identifiers to version names.
616 template <class ELFT> class VersionNeedSection final : public SyntheticSection {
617 typedef typename ELFT::Verneed Elf_Verneed;
618 typedef typename ELFT::Vernaux Elf_Vernaux;
620 // A vector of shared files that need Elf_Verneed data structures and the
621 // string table offsets of their sonames.
622 std::vector<std::pair<SharedFile<ELFT> *, size_t>> Needed;
624 // The next available version identifier.
628 VersionNeedSection();
629 void addSymbol(SharedSymbol *SS);
630 void finalizeContents() override;
631 void writeTo(uint8_t *Buf) override;
632 size_t getSize() const override;
633 size_t getNeedNum() const { return Needed.size(); }
634 bool empty() const override;
637 // MergeSyntheticSection is a class that allows us to put mergeable sections
638 // with different attributes in a single output sections. To do that
639 // we put them into MergeSyntheticSection synthetic input sections which are
640 // attached to regular output sections.
641 class MergeSyntheticSection final : public SyntheticSection {
643 MergeSyntheticSection(StringRef Name, uint32_t Type, uint64_t Flags,
645 void addSection(MergeInputSection *MS);
646 void writeTo(uint8_t *Buf) override;
647 void finalizeContents() override;
648 bool shouldTailMerge() const;
649 size_t getSize() const override;
652 void finalizeTailMerge();
653 void finalizeNoTailMerge();
655 llvm::StringTableBuilder Builder;
656 std::vector<MergeInputSection *> Sections;
659 // .MIPS.abiflags section.
660 template <class ELFT>
661 class MipsAbiFlagsSection final : public SyntheticSection {
662 typedef llvm::object::Elf_Mips_ABIFlags<ELFT> Elf_Mips_ABIFlags;
665 static MipsAbiFlagsSection *create();
667 MipsAbiFlagsSection(Elf_Mips_ABIFlags Flags);
668 size_t getSize() const override { return sizeof(Elf_Mips_ABIFlags); }
669 void writeTo(uint8_t *Buf) override;
672 Elf_Mips_ABIFlags Flags;
675 // .MIPS.options section.
676 template <class ELFT> class MipsOptionsSection final : public SyntheticSection {
677 typedef llvm::object::Elf_Mips_Options<ELFT> Elf_Mips_Options;
678 typedef llvm::object::Elf_Mips_RegInfo<ELFT> Elf_Mips_RegInfo;
681 static MipsOptionsSection *create();
683 MipsOptionsSection(Elf_Mips_RegInfo Reginfo);
684 void writeTo(uint8_t *Buf) override;
686 size_t getSize() const override {
687 return sizeof(Elf_Mips_Options) + sizeof(Elf_Mips_RegInfo);
691 Elf_Mips_RegInfo Reginfo;
694 // MIPS .reginfo section.
695 template <class ELFT> class MipsReginfoSection final : public SyntheticSection {
696 typedef llvm::object::Elf_Mips_RegInfo<ELFT> Elf_Mips_RegInfo;
699 static MipsReginfoSection *create();
701 MipsReginfoSection(Elf_Mips_RegInfo Reginfo);
702 size_t getSize() const override { return sizeof(Elf_Mips_RegInfo); }
703 void writeTo(uint8_t *Buf) override;
706 Elf_Mips_RegInfo Reginfo;
709 // This is a MIPS specific section to hold a space within the data segment
710 // of executable file which is pointed to by the DT_MIPS_RLD_MAP entry.
711 // See "Dynamic section" in Chapter 5 in the following document:
712 // ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf
713 class MipsRldMapSection : public SyntheticSection {
716 size_t getSize() const override { return Config->Wordsize; }
717 void writeTo(uint8_t *Buf) override {}
720 class ARMExidxSentinelSection : public SyntheticSection {
722 ARMExidxSentinelSection();
723 size_t getSize() const override { return 8; }
724 void writeTo(uint8_t *Buf) override;
727 // A container for one or more linker generated thunks. Instances of these
728 // thunks including ARM interworking and Mips LA25 PI to non-PI thunks.
729 class ThunkSection : public SyntheticSection {
731 // ThunkSection in OS, with desired OutSecOff of Off
732 ThunkSection(OutputSection *OS, uint64_t Off);
734 // Add a newly created Thunk to this container:
735 // Thunk is given offset from start of this InputSection
736 // Thunk defines a symbol in this InputSection that can be used as target
738 void addThunk(Thunk *T);
739 size_t getSize() const override { return Size; }
740 void writeTo(uint8_t *Buf) override;
741 InputSection *getTargetInputSection() const;
744 std::vector<const Thunk *> Thunks;
748 template <class ELFT> InputSection *createCommonSection();
749 InputSection *createInterpSection();
750 template <class ELFT> MergeInputSection *createCommentSection();
751 void decompressAndMergeSections();
753 SymbolBody *addSyntheticLocal(StringRef Name, uint8_t Type, uint64_t Value,
754 uint64_t Size, InputSectionBase *Section);
756 // Linker generated sections which can be used as inputs.
758 static InputSection *ARMAttributes;
759 static BssSection *Bss;
760 static BssSection *BssRelRo;
761 static BuildIdSection *BuildId;
762 static InputSection *Common;
763 static SyntheticSection *Dynamic;
764 static StringTableSection *DynStrTab;
765 static SymbolTableBaseSection *DynSymTab;
766 static GnuHashTableSection *GnuHashTab;
767 static InputSection *Interp;
768 static GdbIndexSection *GdbIndex;
769 static GotSection *Got;
770 static GotPltSection *GotPlt;
771 static IgotPltSection *IgotPlt;
772 static MipsGotSection *MipsGot;
773 static MipsRldMapSection *MipsRldMap;
774 static PltSection *Plt;
775 static PltSection *Iplt;
776 static StringTableSection *ShStrTab;
777 static StringTableSection *StrTab;
778 static SymbolTableBaseSection *SymTab;
781 template <class ELFT> struct In : public InX {
782 static EhFrameHeader<ELFT> *EhFrameHdr;
783 static EhFrameSection<ELFT> *EhFrame;
784 static HashTableSection<ELFT> *HashTab;
785 static RelocationSection<ELFT> *RelaDyn;
786 static RelocationSection<ELFT> *RelaPlt;
787 static RelocationSection<ELFT> *RelaIplt;
788 static VersionDefinitionSection<ELFT> *VerDef;
789 static VersionTableSection<ELFT> *VerSym;
790 static VersionNeedSection<ELFT> *VerNeed;
793 template <class ELFT> EhFrameHeader<ELFT> *In<ELFT>::EhFrameHdr;
794 template <class ELFT> EhFrameSection<ELFT> *In<ELFT>::EhFrame;
795 template <class ELFT> HashTableSection<ELFT> *In<ELFT>::HashTab;
796 template <class ELFT> RelocationSection<ELFT> *In<ELFT>::RelaDyn;
797 template <class ELFT> RelocationSection<ELFT> *In<ELFT>::RelaPlt;
798 template <class ELFT> RelocationSection<ELFT> *In<ELFT>::RelaIplt;
799 template <class ELFT> VersionDefinitionSection<ELFT> *In<ELFT>::VerDef;
800 template <class ELFT> VersionTableSection<ELFT> *In<ELFT>::VerSym;
801 template <class ELFT> VersionNeedSection<ELFT> *In<ELFT>::VerNeed;