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"
33 class SyntheticSection : public InputSection {
35 SyntheticSection(uint64_t Flags, uint32_t Type, uint32_t Alignment,
37 : InputSection(Flags, Type, Alignment, {}, Name,
38 InputSectionBase::Synthetic) {
42 virtual ~SyntheticSection() = default;
43 virtual void writeTo(uint8_t *Buf) = 0;
44 virtual size_t getSize() const = 0;
45 virtual void finalizeContents() {}
46 // If the section has the SHF_ALLOC flag and the size may be changed if
47 // thunks are added, update the section size.
48 virtual void updateAllocSize() {}
49 // If any additional finalization of contents are needed post thunk creation.
50 virtual void postThunkContents() {}
51 virtual bool empty() const { return false; }
52 uint64_t getVA() const;
54 static bool classof(const InputSectionBase *D) {
55 return D->kind() == InputSectionBase::Synthetic;
60 EhSectionPiece *Piece = nullptr;
61 std::vector<EhSectionPiece *> FdePieces;
64 // Section for .eh_frame.
65 template <class ELFT> class EhFrameSection final : public SyntheticSection {
66 typedef typename ELFT::Shdr Elf_Shdr;
67 typedef typename ELFT::Rel Elf_Rel;
68 typedef typename ELFT::Rela Elf_Rela;
70 void updateAlignment(uint64_t Val) {
71 if (Val > this->Alignment)
72 this->Alignment = Val;
77 void writeTo(uint8_t *Buf) override;
78 void finalizeContents() override;
79 bool empty() const override { return Sections.empty(); }
80 size_t getSize() const override { return Size; }
82 void addSection(InputSectionBase *S);
86 std::vector<EhInputSection *> Sections;
90 template <class RelTy>
91 void addSectionAux(EhInputSection *S, llvm::ArrayRef<RelTy> Rels);
93 template <class RelTy>
94 CieRecord *addCie(EhSectionPiece &Piece, ArrayRef<RelTy> Rels);
96 template <class RelTy>
97 bool isFdeLive(EhSectionPiece &Piece, ArrayRef<RelTy> Rels);
99 uint64_t getFdePc(uint8_t *Buf, size_t Off, uint8_t Enc);
101 std::vector<CieRecord *> Cies;
103 // CIE records are uniquified by their contents and personality functions.
104 llvm::DenseMap<std::pair<ArrayRef<uint8_t>, SymbolBody *>, CieRecord> CieMap;
107 class GotBaseSection : public SyntheticSection {
110 size_t getSize() const override { return Size; }
111 void finalizeContents() override;
112 bool empty() const override;
114 void addEntry(SymbolBody &Sym);
115 bool addDynTlsEntry(SymbolBody &Sym);
117 uint64_t getGlobalDynAddr(const SymbolBody &B) const;
118 uint64_t getGlobalDynOffset(const SymbolBody &B) const;
120 uint64_t getTlsIndexVA() { return this->getVA() + TlsIndexOff; }
121 uint32_t getTlsIndexOff() const { return TlsIndexOff; }
123 // Flag to force GOT to be in output if we have relocations
124 // that relies on its address.
125 bool HasGotOffRel = false;
128 size_t NumEntries = 0;
129 uint32_t TlsIndexOff = -1;
133 template <class ELFT> class GotSection final : public GotBaseSection {
135 void writeTo(uint8_t *Buf) override;
138 // .note.gnu.build-id section.
139 class BuildIdSection : public SyntheticSection {
140 // First 16 bytes are a header.
141 static const unsigned HeaderSize = 16;
145 void writeTo(uint8_t *Buf) override;
146 size_t getSize() const override { return HeaderSize + HashSize; }
147 void writeBuildId(llvm::ArrayRef<uint8_t> Buf);
150 void computeHash(llvm::ArrayRef<uint8_t> Buf,
151 std::function<void(uint8_t *, ArrayRef<uint8_t>)> Hash);
157 // BssSection is used to reserve space for copy relocations and common symbols.
158 // We create three instances of this class for .bss, .bss.rel.ro and "COMMON",
159 // that are used for writable symbols, read-only symbols and common symbols,
161 class BssSection final : public SyntheticSection {
163 BssSection(StringRef Name);
164 void writeTo(uint8_t *) override {}
165 bool empty() const override { return getSize() == 0; }
166 size_t reserveSpace(uint64_t Size, uint32_t Alignment);
167 size_t getSize() const override { return Size; }
173 class MipsGotSection final : public SyntheticSection {
176 void writeTo(uint8_t *Buf) override;
177 size_t getSize() const override { return Size; }
178 void updateAllocSize() override;
179 void finalizeContents() override;
180 bool empty() const override;
181 void addEntry(SymbolBody &Sym, int64_t Addend, RelExpr Expr);
182 bool addDynTlsEntry(SymbolBody &Sym);
184 uint64_t getPageEntryOffset(const SymbolBody &B, int64_t Addend) const;
185 uint64_t getBodyEntryOffset(const SymbolBody &B, int64_t Addend) const;
186 uint64_t getGlobalDynOffset(const SymbolBody &B) const;
188 // Returns the symbol which corresponds to the first entry of the global part
189 // of GOT on MIPS platform. It is required to fill up MIPS-specific dynamic
191 // Returns nullptr if the global part is empty.
192 const SymbolBody *getFirstGlobalEntry() const;
194 // Returns the number of entries in the local part of GOT including
195 // the number of reserved entries.
196 unsigned getLocalEntriesNum() const;
198 // Returns offset of TLS part of the MIPS GOT table. This part goes
199 // after 'local' and 'global' entries.
200 uint64_t getTlsOffset() const;
202 uint32_t getTlsIndexOff() const { return TlsIndexOff; }
204 uint64_t getGp() const;
207 // MIPS GOT consists of three parts: local, global and tls. Each part
208 // contains different types of entries. Here is a layout of GOT:
209 // - Header entries |
210 // - Page entries | Local part
211 // - Local entries (16-bit access) |
212 // - Local entries (32-bit access) |
213 // - Normal global entries || Global part
214 // - Reloc-only global entries ||
215 // - TLS entries ||| TLS part
218 // Two entries hold predefined value 0x0 and 0x80000000.
220 // These entries created by R_MIPS_GOT_PAGE relocation and R_MIPS_GOT16
221 // relocation against local symbols. They are initialized by higher 16-bit
222 // of the corresponding symbol's value. So each 64kb of address space
223 // requires a single GOT entry.
224 // Local entries (16-bit access):
225 // These entries created by GOT relocations against global non-preemptible
226 // symbols so dynamic linker is not necessary to resolve the symbol's
227 // values. "16-bit access" means that corresponding relocations address
228 // GOT using 16-bit index. Each unique Symbol-Addend pair has its own
230 // Local entries (32-bit access):
231 // These entries are the same as above but created by relocations which
232 // address GOT using 32-bit index (R_MIPS_GOT_HI16/LO16 etc).
233 // Normal global entries:
234 // These entries created by GOT relocations against preemptible global
235 // symbols. They need to be initialized by dynamic linker and they ordered
236 // exactly as the corresponding entries in the dynamic symbols table.
237 // Reloc-only global entries:
238 // These entries created for symbols that are referenced by dynamic
239 // relocations R_MIPS_REL32. These entries are not accessed with gp-relative
240 // addressing, but MIPS ABI requires that these entries be present in GOT.
242 // Entries created by TLS relocations.
244 // Number of "Header" entries.
245 static const unsigned HeaderEntriesNum = 2;
246 // Number of allocated "Page" entries.
247 uint32_t PageEntriesNum = 0;
248 // Map output sections referenced by MIPS GOT relocations
249 // to the first index of "Page" entries allocated for this section.
250 llvm::SmallMapVector<const OutputSection *, size_t, 16> PageIndexMap;
252 typedef std::pair<const SymbolBody *, uint64_t> GotEntry;
253 typedef std::vector<GotEntry> GotEntries;
254 // Map from Symbol-Addend pair to the GOT index.
255 llvm::DenseMap<GotEntry, size_t> EntryIndexMap;
256 // Local entries (16-bit access).
257 GotEntries LocalEntries;
258 // Local entries (32-bit access).
259 GotEntries LocalEntries32;
261 // Normal and reloc-only global entries.
262 GotEntries GlobalEntries;
265 std::vector<const SymbolBody *> TlsEntries;
267 uint32_t TlsIndexOff = -1;
271 class GotPltSection final : public SyntheticSection {
274 void addEntry(SymbolBody &Sym);
275 size_t getSize() const override;
276 void writeTo(uint8_t *Buf) override;
277 bool empty() const override { return Entries.empty(); }
280 std::vector<const SymbolBody *> Entries;
283 // The IgotPltSection is a Got associated with the PltSection for GNU Ifunc
284 // Symbols that will be relocated by Target->IRelativeRel.
285 // On most Targets the IgotPltSection will immediately follow the GotPltSection
286 // on ARM the IgotPltSection will immediately follow the GotSection.
287 class IgotPltSection final : public SyntheticSection {
290 void addEntry(SymbolBody &Sym);
291 size_t getSize() const override;
292 void writeTo(uint8_t *Buf) override;
293 bool empty() const override { return Entries.empty(); }
296 std::vector<const SymbolBody *> Entries;
299 class StringTableSection final : public SyntheticSection {
301 StringTableSection(StringRef Name, bool Dynamic);
302 unsigned addString(StringRef S, bool HashIt = true);
303 void writeTo(uint8_t *Buf) override;
304 size_t getSize() const override { return Size; }
305 bool isDynamic() const { return Dynamic; }
312 llvm::DenseMap<StringRef, unsigned> StringMap;
313 std::vector<StringRef> Strings;
318 DynamicReloc(uint32_t Type, const InputSectionBase *InputSec,
319 uint64_t OffsetInSec, bool UseSymVA, SymbolBody *Sym,
321 : Type(Type), Sym(Sym), InputSec(InputSec), OffsetInSec(OffsetInSec),
322 UseSymVA(UseSymVA), Addend(Addend) {}
324 uint64_t getOffset() const;
325 int64_t getAddend() const;
326 uint32_t getSymIndex() const;
327 const InputSectionBase *getInputSec() const { return InputSec; }
333 const InputSectionBase *InputSec = nullptr;
334 uint64_t OffsetInSec;
339 template <class ELFT> class DynamicSection final : public SyntheticSection {
340 typedef typename ELFT::Dyn Elf_Dyn;
341 typedef typename ELFT::Rel Elf_Rel;
342 typedef typename ELFT::Rela Elf_Rela;
343 typedef typename ELFT::Shdr Elf_Shdr;
344 typedef typename ELFT::Sym Elf_Sym;
346 // The .dynamic section contains information for the dynamic linker.
347 // The section consists of fixed size entries, which consist of
348 // type and value fields. Value are one of plain integers, symbol
349 // addresses, or section addresses. This struct represents the entry.
353 OutputSection *OutSec;
356 const SymbolBody *Sym;
358 enum KindT { SecAddr, SecSize, SymAddr, PlainInt, InSecAddr } Kind;
359 Entry(int32_t Tag, OutputSection *OutSec, KindT Kind = SecAddr)
360 : Tag(Tag), OutSec(OutSec), Kind(Kind) {}
361 Entry(int32_t Tag, InputSection *Sec)
362 : Tag(Tag), InSec(Sec), Kind(InSecAddr) {}
363 Entry(int32_t Tag, uint64_t Val) : Tag(Tag), Val(Val), Kind(PlainInt) {}
364 Entry(int32_t Tag, const SymbolBody *Sym)
365 : Tag(Tag), Sym(Sym), Kind(SymAddr) {}
368 // finalizeContents() fills this vector with the section contents.
369 std::vector<Entry> Entries;
373 void finalizeContents() override;
374 void writeTo(uint8_t *Buf) override;
375 size_t getSize() const override { return Size; }
379 void add(Entry E) { Entries.push_back(E); }
383 template <class ELFT> class RelocationSection final : public SyntheticSection {
384 typedef typename ELFT::Rel Elf_Rel;
385 typedef typename ELFT::Rela Elf_Rela;
388 RelocationSection(StringRef Name, bool Sort);
389 void addReloc(const DynamicReloc &Reloc);
390 unsigned getRelocOffset();
391 void finalizeContents() override;
392 void writeTo(uint8_t *Buf) override;
393 bool empty() const override { return Relocs.empty(); }
394 size_t getSize() const override { return Relocs.size() * this->Entsize; }
395 size_t getRelativeRelocCount() const { return NumRelativeRelocs; }
399 size_t NumRelativeRelocs = 0;
400 std::vector<DynamicReloc> Relocs;
403 struct SymbolTableEntry {
408 class SymbolTableBaseSection : public SyntheticSection {
410 SymbolTableBaseSection(StringTableSection &StrTabSec);
411 void finalizeContents() override;
412 void postThunkContents() override;
413 size_t getSize() const override { return getNumSymbols() * Entsize; }
414 void addSymbol(SymbolBody *Body);
415 unsigned getNumSymbols() const { return Symbols.size() + 1; }
416 size_t getSymbolIndex(SymbolBody *Body);
417 ArrayRef<SymbolTableEntry> getSymbols() const { return Symbols; }
420 // A vector of symbols and their string table offsets.
421 std::vector<SymbolTableEntry> Symbols;
423 StringTableSection &StrTabSec;
426 template <class ELFT>
427 class SymbolTableSection final : public SymbolTableBaseSection {
428 typedef typename ELFT::Sym Elf_Sym;
431 SymbolTableSection(StringTableSection &StrTabSec);
432 void writeTo(uint8_t *Buf) override;
435 // Outputs GNU Hash section. For detailed explanation see:
436 // https://blogs.oracle.com/ali/entry/gnu_hash_elf_sections
437 class GnuHashTableSection final : public SyntheticSection {
439 GnuHashTableSection();
440 void finalizeContents() override;
441 void writeTo(uint8_t *Buf) override;
442 size_t getSize() const override { return Size; }
444 // Adds symbols to the hash table.
445 // Sorts the input to satisfy GNU hash section requirements.
446 void addSymbols(std::vector<SymbolTableEntry> &Symbols);
449 size_t getShift2() const { return Config->Is64 ? 6 : 5; }
451 void writeBloomFilter(uint8_t *Buf);
452 void writeHashTable(uint8_t *Buf);
460 std::vector<Entry> Symbols;
466 template <class ELFT> class HashTableSection final : public SyntheticSection {
469 void finalizeContents() override;
470 void writeTo(uint8_t *Buf) override;
471 size_t getSize() const override { return Size; }
477 // The PltSection is used for both the Plt and Iplt. The former always has a
478 // header as its first entry that is used at run-time to resolve lazy binding.
479 // The latter is used for GNU Ifunc symbols, that will be subject to a
480 // Target->IRelativeRel.
481 class PltSection : public SyntheticSection {
483 PltSection(size_t HeaderSize);
484 void writeTo(uint8_t *Buf) override;
485 size_t getSize() const override;
486 bool empty() const override { return Entries.empty(); }
489 template <class ELFT> void addEntry(SymbolBody &Sym);
492 void writeHeader(uint8_t *Buf){};
493 void addHeaderSymbols(){};
494 unsigned getPltRelocOff() const;
495 std::vector<std::pair<const SymbolBody *, unsigned>> Entries;
496 // Iplt always has HeaderSize of 0, the Plt HeaderSize is always non-zero
500 class GdbIndexSection final : public SyntheticSection {
501 const unsigned OffsetTypeSize = 4;
502 const unsigned CuListOffset = 6 * OffsetTypeSize;
503 const unsigned CompilationUnitSize = 16;
504 const unsigned AddressEntrySize = 16 + OffsetTypeSize;
505 const unsigned SymTabEntrySize = 2 * OffsetTypeSize;
509 void finalizeContents() override;
510 void writeTo(uint8_t *Buf) override;
511 size_t getSize() const override;
512 bool empty() const override;
514 // Pairs of [CU Offset, CU length].
515 std::vector<std::pair<uint64_t, uint64_t>> CompilationUnits;
517 llvm::StringTableBuilder StringPool;
519 GdbHashTab SymbolTable;
521 // The CU vector portion of the constant pool.
522 std::vector<std::vector<std::pair<uint32_t, uint8_t>>> CuVectors;
524 std::vector<AddressEntry> AddressArea;
527 void readDwarf(InputSection *Sec);
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 // --eh-frame-hdr option tells linker to construct a header for all the
541 // .eh_frame sections. This header is placed to a section named .eh_frame_hdr
542 // and also to a PT_GNU_EH_FRAME segment.
543 // At runtime the unwinder then can find all the PT_GNU_EH_FRAME segments by
544 // calling dl_iterate_phdr.
545 // This section contains a lookup table for quick binary search of FDEs.
546 // Detailed info about internals can be found in Ian Lance Taylor's blog:
547 // http://www.airs.com/blog/archives/460 (".eh_frame")
548 // http://www.airs.com/blog/archives/462 (".eh_frame_hdr")
549 template <class ELFT> class EhFrameHeader final : public SyntheticSection {
552 void writeTo(uint8_t *Buf) override;
553 size_t getSize() const override;
554 void addFde(uint32_t Pc, uint32_t FdeVA);
555 bool empty() const override;
563 std::vector<FdeData> Fdes;
566 // For more information about .gnu.version and .gnu.version_r see:
567 // https://www.akkadia.org/drepper/symbol-versioning
569 // The .gnu.version_d section which has a section type of SHT_GNU_verdef shall
570 // contain symbol version definitions. The number of entries in this section
571 // shall be contained in the DT_VERDEFNUM entry of the .dynamic section.
572 // The section shall contain an array of Elf_Verdef structures, optionally
573 // followed by an array of Elf_Verdaux structures.
574 template <class ELFT>
575 class VersionDefinitionSection final : public SyntheticSection {
576 typedef typename ELFT::Verdef Elf_Verdef;
577 typedef typename ELFT::Verdaux Elf_Verdaux;
580 VersionDefinitionSection();
581 void finalizeContents() override;
582 size_t getSize() const override;
583 void writeTo(uint8_t *Buf) override;
586 void writeOne(uint8_t *Buf, uint32_t Index, StringRef Name, size_t NameOff);
588 unsigned FileDefNameOff;
591 // The .gnu.version section specifies the required version of each symbol in the
592 // dynamic symbol table. It contains one Elf_Versym for each dynamic symbol
593 // table entry. An Elf_Versym is just a 16-bit integer that refers to a version
594 // identifier defined in the either .gnu.version_r or .gnu.version_d section.
595 // The values 0 and 1 are reserved. All other values are used for versions in
596 // the own object or in any of the dependencies.
597 template <class ELFT>
598 class VersionTableSection final : public SyntheticSection {
599 typedef typename ELFT::Versym Elf_Versym;
602 VersionTableSection();
603 void finalizeContents() override;
604 size_t getSize() const override;
605 void writeTo(uint8_t *Buf) override;
606 bool empty() const override;
609 // The .gnu.version_r section defines the version identifiers used by
610 // .gnu.version. It contains a linked list of Elf_Verneed data structures. Each
611 // Elf_Verneed specifies the version requirements for a single DSO, and contains
612 // a reference to a linked list of Elf_Vernaux data structures which define the
613 // mapping from version identifiers to version names.
614 template <class ELFT> class VersionNeedSection final : public SyntheticSection {
615 typedef typename ELFT::Verneed Elf_Verneed;
616 typedef typename ELFT::Vernaux Elf_Vernaux;
618 // A vector of shared files that need Elf_Verneed data structures and the
619 // string table offsets of their sonames.
620 std::vector<std::pair<SharedFile<ELFT> *, size_t>> Needed;
622 // The next available version identifier.
626 VersionNeedSection();
627 void addSymbol(SharedSymbol *SS);
628 void finalizeContents() override;
629 void writeTo(uint8_t *Buf) override;
630 size_t getSize() const override;
631 size_t getNeedNum() const { return Needed.size(); }
632 bool empty() const override;
635 // MergeSyntheticSection is a class that allows us to put mergeable sections
636 // with different attributes in a single output sections. To do that
637 // we put them into MergeSyntheticSection synthetic input sections which are
638 // attached to regular output sections.
639 class MergeSyntheticSection final : public SyntheticSection {
641 MergeSyntheticSection(StringRef Name, uint32_t Type, uint64_t Flags,
643 void addSection(MergeInputSection *MS);
644 void writeTo(uint8_t *Buf) override;
645 void finalizeContents() override;
646 bool shouldTailMerge() const;
647 size_t getSize() const override;
650 void finalizeTailMerge();
651 void finalizeNoTailMerge();
653 bool Finalized = false;
654 llvm::StringTableBuilder Builder;
655 std::vector<MergeInputSection *> Sections;
658 // .MIPS.abiflags section.
659 template <class ELFT>
660 class MipsAbiFlagsSection final : public SyntheticSection {
661 typedef llvm::object::Elf_Mips_ABIFlags<ELFT> Elf_Mips_ABIFlags;
664 static MipsAbiFlagsSection *create();
666 MipsAbiFlagsSection(Elf_Mips_ABIFlags Flags);
667 size_t getSize() const override { return sizeof(Elf_Mips_ABIFlags); }
668 void writeTo(uint8_t *Buf) override;
671 Elf_Mips_ABIFlags Flags;
674 // .MIPS.options section.
675 template <class ELFT> class MipsOptionsSection final : public SyntheticSection {
676 typedef llvm::object::Elf_Mips_Options<ELFT> Elf_Mips_Options;
677 typedef llvm::object::Elf_Mips_RegInfo<ELFT> Elf_Mips_RegInfo;
680 static MipsOptionsSection *create();
682 MipsOptionsSection(Elf_Mips_RegInfo Reginfo);
683 void writeTo(uint8_t *Buf) override;
685 size_t getSize() const override {
686 return sizeof(Elf_Mips_Options) + sizeof(Elf_Mips_RegInfo);
690 Elf_Mips_RegInfo Reginfo;
693 // MIPS .reginfo section.
694 template <class ELFT> class MipsReginfoSection final : public SyntheticSection {
695 typedef llvm::object::Elf_Mips_RegInfo<ELFT> Elf_Mips_RegInfo;
698 static MipsReginfoSection *create();
700 MipsReginfoSection(Elf_Mips_RegInfo Reginfo);
701 size_t getSize() const override { return sizeof(Elf_Mips_RegInfo); }
702 void writeTo(uint8_t *Buf) override;
705 Elf_Mips_RegInfo Reginfo;
708 // This is a MIPS specific section to hold a space within the data segment
709 // of executable file which is pointed to by the DT_MIPS_RLD_MAP entry.
710 // See "Dynamic section" in Chapter 5 in the following document:
711 // ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf
712 class MipsRldMapSection : public SyntheticSection {
715 size_t getSize() const override { return Config->Wordsize; }
716 void writeTo(uint8_t *Buf) override;
719 class ARMExidxSentinelSection : public SyntheticSection {
721 ARMExidxSentinelSection();
722 size_t getSize() const override { return 8; }
723 void writeTo(uint8_t *Buf) override;
726 // A container for one or more linker generated thunks. Instances of these
727 // thunks including ARM interworking and Mips LA25 PI to non-PI thunks.
728 class ThunkSection : public SyntheticSection {
730 // ThunkSection in OS, with desired OutSecOff of Off
731 ThunkSection(OutputSection *OS, uint64_t Off);
733 // Add a newly created Thunk to this container:
734 // Thunk is given offset from start of this InputSection
735 // Thunk defines a symbol in this InputSection that can be used as target
737 void addThunk(Thunk *T);
738 size_t getSize() const override { return Size; }
739 void writeTo(uint8_t *Buf) override;
740 InputSection *getTargetInputSection() const;
743 std::vector<const Thunk *> Thunks;
747 template <class ELFT> InputSection *createCommonSection();
748 InputSection *createInterpSection();
749 template <class ELFT> MergeInputSection *createCommentSection();
751 SymbolBody *addSyntheticLocal(StringRef Name, uint8_t Type, uint64_t Value,
752 uint64_t Size, InputSectionBase *Section);
754 // Linker generated sections which can be used as inputs.
756 static InputSection *ARMAttributes;
757 static BssSection *Bss;
758 static BssSection *BssRelRo;
759 static BuildIdSection *BuildId;
760 static InputSection *Common;
761 static SyntheticSection *Dynamic;
762 static StringTableSection *DynStrTab;
763 static SymbolTableBaseSection *DynSymTab;
764 static GnuHashTableSection *GnuHashTab;
765 static InputSection *Interp;
766 static GdbIndexSection *GdbIndex;
767 static GotBaseSection *Got;
768 static GotPltSection *GotPlt;
769 static IgotPltSection *IgotPlt;
770 static MipsGotSection *MipsGot;
771 static MipsRldMapSection *MipsRldMap;
772 static PltSection *Plt;
773 static PltSection *Iplt;
774 static StringTableSection *ShStrTab;
775 static StringTableSection *StrTab;
776 static SymbolTableBaseSection *SymTab;
779 template <class ELFT> struct In : public InX {
780 static EhFrameHeader<ELFT> *EhFrameHdr;
781 static EhFrameSection<ELFT> *EhFrame;
782 static HashTableSection<ELFT> *HashTab;
783 static RelocationSection<ELFT> *RelaDyn;
784 static RelocationSection<ELFT> *RelaPlt;
785 static RelocationSection<ELFT> *RelaIplt;
786 static VersionDefinitionSection<ELFT> *VerDef;
787 static VersionTableSection<ELFT> *VerSym;
788 static VersionNeedSection<ELFT> *VerNeed;
791 template <class ELFT> EhFrameHeader<ELFT> *In<ELFT>::EhFrameHdr;
792 template <class ELFT> EhFrameSection<ELFT> *In<ELFT>::EhFrame;
793 template <class ELFT> HashTableSection<ELFT> *In<ELFT>::HashTab;
794 template <class ELFT> RelocationSection<ELFT> *In<ELFT>::RelaDyn;
795 template <class ELFT> RelocationSection<ELFT> *In<ELFT>::RelaPlt;
796 template <class ELFT> RelocationSection<ELFT> *In<ELFT>::RelaIplt;
797 template <class ELFT> VersionDefinitionSection<ELFT> *In<ELFT>::VerDef;
798 template <class ELFT> VersionTableSection<ELFT> *In<ELFT>::VerSym;
799 template <class ELFT> VersionNeedSection<ELFT> *In<ELFT>::VerNeed;