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 GotSection : public SyntheticSection {
110 size_t getSize() const override { return Size; }
111 void finalizeContents() override;
112 bool empty() const override;
113 void writeTo(uint8_t *Buf) override;
115 void addEntry(SymbolBody &Sym);
116 bool addDynTlsEntry(SymbolBody &Sym);
118 uint64_t getGlobalDynAddr(const SymbolBody &B) const;
119 uint64_t getGlobalDynOffset(const SymbolBody &B) const;
121 uint64_t getTlsIndexVA() { return this->getVA() + TlsIndexOff; }
122 uint32_t getTlsIndexOff() const { return TlsIndexOff; }
124 // Flag to force GOT to be in output if we have relocations
125 // that relies on its address.
126 bool HasGotOffRel = false;
129 size_t NumEntries = 0;
130 uint32_t TlsIndexOff = -1;
134 // .note.gnu.build-id section.
135 class BuildIdSection : public SyntheticSection {
136 // First 16 bytes are a header.
137 static const unsigned HeaderSize = 16;
141 void writeTo(uint8_t *Buf) override;
142 size_t getSize() const override { return HeaderSize + HashSize; }
143 void writeBuildId(llvm::ArrayRef<uint8_t> Buf);
146 void computeHash(llvm::ArrayRef<uint8_t> Buf,
147 std::function<void(uint8_t *, ArrayRef<uint8_t>)> Hash);
153 // BssSection is used to reserve space for copy relocations and common symbols.
154 // We create three instances of this class for .bss, .bss.rel.ro and "COMMON",
155 // that are used for writable symbols, read-only symbols and common symbols,
157 class BssSection final : public SyntheticSection {
159 BssSection(StringRef Name);
160 void writeTo(uint8_t *) override {}
161 bool empty() const override { return getSize() == 0; }
162 size_t reserveSpace(uint64_t Size, uint32_t Alignment);
163 size_t getSize() const override { return Size; }
169 class MipsGotSection final : public SyntheticSection {
172 void writeTo(uint8_t *Buf) override;
173 size_t getSize() const override { return Size; }
174 void updateAllocSize() override;
175 void finalizeContents() override;
176 bool empty() const override;
177 void addEntry(SymbolBody &Sym, int64_t Addend, RelExpr Expr);
178 bool addDynTlsEntry(SymbolBody &Sym);
180 uint64_t getPageEntryOffset(const SymbolBody &B, int64_t Addend) const;
181 uint64_t getBodyEntryOffset(const SymbolBody &B, int64_t Addend) const;
182 uint64_t getGlobalDynOffset(const SymbolBody &B) const;
184 // Returns the symbol which corresponds to the first entry of the global part
185 // of GOT on MIPS platform. It is required to fill up MIPS-specific dynamic
187 // Returns nullptr if the global part is empty.
188 const SymbolBody *getFirstGlobalEntry() const;
190 // Returns the number of entries in the local part of GOT including
191 // the number of reserved entries.
192 unsigned getLocalEntriesNum() const;
194 // Returns offset of TLS part of the MIPS GOT table. This part goes
195 // after 'local' and 'global' entries.
196 uint64_t getTlsOffset() const;
198 uint32_t getTlsIndexOff() const { return TlsIndexOff; }
200 uint64_t getGp() const;
203 // MIPS GOT consists of three parts: local, global and tls. Each part
204 // contains different types of entries. Here is a layout of GOT:
205 // - Header entries |
206 // - Page entries | Local part
207 // - Local entries (16-bit access) |
208 // - Local entries (32-bit access) |
209 // - Normal global entries || Global part
210 // - Reloc-only global entries ||
211 // - TLS entries ||| TLS part
214 // Two entries hold predefined value 0x0 and 0x80000000.
216 // These entries created by R_MIPS_GOT_PAGE relocation and R_MIPS_GOT16
217 // relocation against local symbols. They are initialized by higher 16-bit
218 // of the corresponding symbol's value. So each 64kb of address space
219 // requires a single GOT entry.
220 // Local entries (16-bit access):
221 // These entries created by GOT relocations against global non-preemptible
222 // symbols so dynamic linker is not necessary to resolve the symbol's
223 // values. "16-bit access" means that corresponding relocations address
224 // GOT using 16-bit index. Each unique Symbol-Addend pair has its own
226 // Local entries (32-bit access):
227 // These entries are the same as above but created by relocations which
228 // address GOT using 32-bit index (R_MIPS_GOT_HI16/LO16 etc).
229 // Normal global entries:
230 // These entries created by GOT relocations against preemptible global
231 // symbols. They need to be initialized by dynamic linker and they ordered
232 // exactly as the corresponding entries in the dynamic symbols table.
233 // Reloc-only global entries:
234 // These entries created for symbols that are referenced by dynamic
235 // relocations R_MIPS_REL32. These entries are not accessed with gp-relative
236 // addressing, but MIPS ABI requires that these entries be present in GOT.
238 // Entries created by TLS relocations.
240 // Number of "Header" entries.
241 static const unsigned HeaderEntriesNum = 2;
242 // Number of allocated "Page" entries.
243 uint32_t PageEntriesNum = 0;
244 // Map output sections referenced by MIPS GOT relocations
245 // to the first index of "Page" entries allocated for this section.
246 llvm::SmallMapVector<const OutputSection *, size_t, 16> PageIndexMap;
248 typedef std::pair<const SymbolBody *, uint64_t> GotEntry;
249 typedef std::vector<GotEntry> GotEntries;
250 // Map from Symbol-Addend pair to the GOT index.
251 llvm::DenseMap<GotEntry, size_t> EntryIndexMap;
252 // Local entries (16-bit access).
253 GotEntries LocalEntries;
254 // Local entries (32-bit access).
255 GotEntries LocalEntries32;
257 // Normal and reloc-only global entries.
258 GotEntries GlobalEntries;
261 std::vector<const SymbolBody *> TlsEntries;
263 uint32_t TlsIndexOff = -1;
267 class GotPltSection final : public SyntheticSection {
270 void addEntry(SymbolBody &Sym);
271 size_t getSize() const override;
272 void writeTo(uint8_t *Buf) override;
273 bool empty() const override { return Entries.empty(); }
276 std::vector<const SymbolBody *> Entries;
279 // The IgotPltSection is a Got associated with the PltSection for GNU Ifunc
280 // Symbols that will be relocated by Target->IRelativeRel.
281 // On most Targets the IgotPltSection will immediately follow the GotPltSection
282 // on ARM the IgotPltSection will immediately follow the GotSection.
283 class IgotPltSection final : public SyntheticSection {
286 void addEntry(SymbolBody &Sym);
287 size_t getSize() const override;
288 void writeTo(uint8_t *Buf) override;
289 bool empty() const override { return Entries.empty(); }
292 std::vector<const SymbolBody *> Entries;
295 class StringTableSection final : public SyntheticSection {
297 StringTableSection(StringRef Name, bool Dynamic);
298 unsigned addString(StringRef S, bool HashIt = true);
299 void writeTo(uint8_t *Buf) override;
300 size_t getSize() const override { return Size; }
301 bool isDynamic() const { return Dynamic; }
308 llvm::DenseMap<StringRef, unsigned> StringMap;
309 std::vector<StringRef> Strings;
314 DynamicReloc(uint32_t Type, const InputSectionBase *InputSec,
315 uint64_t OffsetInSec, bool UseSymVA, SymbolBody *Sym,
317 : Type(Type), Sym(Sym), InputSec(InputSec), OffsetInSec(OffsetInSec),
318 UseSymVA(UseSymVA), Addend(Addend) {}
320 uint64_t getOffset() const;
321 int64_t getAddend() const;
322 uint32_t getSymIndex() const;
323 const InputSectionBase *getInputSec() const { return InputSec; }
329 const InputSectionBase *InputSec = nullptr;
330 uint64_t OffsetInSec;
335 template <class ELFT> class DynamicSection final : public SyntheticSection {
336 typedef typename ELFT::Dyn Elf_Dyn;
337 typedef typename ELFT::Rel Elf_Rel;
338 typedef typename ELFT::Rela Elf_Rela;
339 typedef typename ELFT::Shdr Elf_Shdr;
340 typedef typename ELFT::Sym Elf_Sym;
342 // The .dynamic section contains information for the dynamic linker.
343 // The section consists of fixed size entries, which consist of
344 // type and value fields. Value are one of plain integers, symbol
345 // addresses, or section addresses. This struct represents the entry.
349 OutputSection *OutSec;
352 const SymbolBody *Sym;
354 enum KindT { SecAddr, SecSize, SymAddr, PlainInt, InSecAddr } Kind;
355 Entry(int32_t Tag, OutputSection *OutSec, KindT Kind = SecAddr)
356 : Tag(Tag), OutSec(OutSec), Kind(Kind) {}
357 Entry(int32_t Tag, InputSection *Sec)
358 : Tag(Tag), InSec(Sec), Kind(InSecAddr) {}
359 Entry(int32_t Tag, uint64_t Val) : Tag(Tag), Val(Val), Kind(PlainInt) {}
360 Entry(int32_t Tag, const SymbolBody *Sym)
361 : Tag(Tag), Sym(Sym), Kind(SymAddr) {}
364 // finalizeContents() fills this vector with the section contents.
365 std::vector<Entry> Entries;
369 void finalizeContents() override;
370 void writeTo(uint8_t *Buf) override;
371 size_t getSize() const override { return Size; }
375 void add(Entry E) { Entries.push_back(E); }
379 template <class ELFT> class RelocationSection final : public SyntheticSection {
380 typedef typename ELFT::Rel Elf_Rel;
381 typedef typename ELFT::Rela Elf_Rela;
384 RelocationSection(StringRef Name, bool Sort);
385 void addReloc(const DynamicReloc &Reloc);
386 unsigned getRelocOffset();
387 void finalizeContents() override;
388 void writeTo(uint8_t *Buf) override;
389 bool empty() const override { return Relocs.empty(); }
390 size_t getSize() const override { return Relocs.size() * this->Entsize; }
391 size_t getRelativeRelocCount() const { return NumRelativeRelocs; }
395 size_t NumRelativeRelocs = 0;
396 std::vector<DynamicReloc> Relocs;
399 struct SymbolTableEntry {
404 class SymbolTableBaseSection : public SyntheticSection {
406 SymbolTableBaseSection(StringTableSection &StrTabSec);
407 void finalizeContents() override;
408 void postThunkContents() override;
409 size_t getSize() const override { return getNumSymbols() * Entsize; }
410 void addSymbol(SymbolBody *Body);
411 unsigned getNumSymbols() const { return Symbols.size() + 1; }
412 size_t getSymbolIndex(SymbolBody *Body);
413 ArrayRef<SymbolTableEntry> getSymbols() const { return Symbols; }
416 // A vector of symbols and their string table offsets.
417 std::vector<SymbolTableEntry> Symbols;
419 StringTableSection &StrTabSec;
422 template <class ELFT>
423 class SymbolTableSection final : public SymbolTableBaseSection {
424 typedef typename ELFT::Sym Elf_Sym;
427 SymbolTableSection(StringTableSection &StrTabSec);
428 void writeTo(uint8_t *Buf) override;
431 // Outputs GNU Hash section. For detailed explanation see:
432 // https://blogs.oracle.com/ali/entry/gnu_hash_elf_sections
433 class GnuHashTableSection final : public SyntheticSection {
435 GnuHashTableSection();
436 void finalizeContents() override;
437 void writeTo(uint8_t *Buf) override;
438 size_t getSize() const override { return Size; }
440 // Adds symbols to the hash table.
441 // Sorts the input to satisfy GNU hash section requirements.
442 void addSymbols(std::vector<SymbolTableEntry> &Symbols);
445 size_t getShift2() const { return Config->Is64 ? 6 : 5; }
447 void writeBloomFilter(uint8_t *Buf);
448 void writeHashTable(uint8_t *Buf);
456 std::vector<Entry> Symbols;
462 template <class ELFT> class HashTableSection final : public SyntheticSection {
465 void finalizeContents() override;
466 void writeTo(uint8_t *Buf) override;
467 size_t getSize() const override { return Size; }
473 // The PltSection is used for both the Plt and Iplt. The former always has a
474 // header as its first entry that is used at run-time to resolve lazy binding.
475 // The latter is used for GNU Ifunc symbols, that will be subject to a
476 // Target->IRelativeRel.
477 class PltSection : public SyntheticSection {
479 PltSection(size_t HeaderSize);
480 void writeTo(uint8_t *Buf) override;
481 size_t getSize() const override;
482 bool empty() const override { return Entries.empty(); }
485 template <class ELFT> void addEntry(SymbolBody &Sym);
488 void writeHeader(uint8_t *Buf){};
489 void addHeaderSymbols(){};
490 unsigned getPltRelocOff() const;
491 std::vector<std::pair<const SymbolBody *, unsigned>> Entries;
492 // Iplt always has HeaderSize of 0, the Plt HeaderSize is always non-zero
496 class GdbIndexSection final : public SyntheticSection {
497 const unsigned OffsetTypeSize = 4;
498 const unsigned CuListOffset = 6 * OffsetTypeSize;
499 const unsigned CompilationUnitSize = 16;
500 const unsigned AddressEntrySize = 16 + OffsetTypeSize;
501 const unsigned SymTabEntrySize = 2 * OffsetTypeSize;
505 void finalizeContents() override;
506 void writeTo(uint8_t *Buf) override;
507 size_t getSize() const override;
508 bool empty() const override;
510 // Pairs of [CU Offset, CU length].
511 std::vector<std::pair<uint64_t, uint64_t>> CompilationUnits;
513 llvm::StringTableBuilder StringPool;
515 GdbHashTab SymbolTable;
517 // The CU vector portion of the constant pool.
518 std::vector<std::vector<std::pair<uint32_t, uint8_t>>> CuVectors;
520 std::vector<AddressEntry> AddressArea;
523 void readDwarf(InputSection *Sec);
525 uint32_t CuTypesOffset;
526 uint32_t SymTabOffset;
527 uint32_t ConstantPoolOffset;
528 uint32_t StringPoolOffset;
530 size_t CuVectorsSize = 0;
531 std::vector<size_t> CuVectorsOffset;
533 bool Finalized = false;
536 // --eh-frame-hdr option tells linker to construct a header for all the
537 // .eh_frame sections. This header is placed to a section named .eh_frame_hdr
538 // and also to a PT_GNU_EH_FRAME segment.
539 // At runtime the unwinder then can find all the PT_GNU_EH_FRAME segments by
540 // calling dl_iterate_phdr.
541 // This section contains a lookup table for quick binary search of FDEs.
542 // Detailed info about internals can be found in Ian Lance Taylor's blog:
543 // http://www.airs.com/blog/archives/460 (".eh_frame")
544 // http://www.airs.com/blog/archives/462 (".eh_frame_hdr")
545 template <class ELFT> class EhFrameHeader final : public SyntheticSection {
548 void writeTo(uint8_t *Buf) override;
549 size_t getSize() const override;
550 void addFde(uint32_t Pc, uint32_t FdeVA);
551 bool empty() const override;
559 std::vector<FdeData> Fdes;
562 // For more information about .gnu.version and .gnu.version_r see:
563 // https://www.akkadia.org/drepper/symbol-versioning
565 // The .gnu.version_d section which has a section type of SHT_GNU_verdef shall
566 // contain symbol version definitions. The number of entries in this section
567 // shall be contained in the DT_VERDEFNUM entry of the .dynamic section.
568 // The section shall contain an array of Elf_Verdef structures, optionally
569 // followed by an array of Elf_Verdaux structures.
570 template <class ELFT>
571 class VersionDefinitionSection final : public SyntheticSection {
572 typedef typename ELFT::Verdef Elf_Verdef;
573 typedef typename ELFT::Verdaux Elf_Verdaux;
576 VersionDefinitionSection();
577 void finalizeContents() override;
578 size_t getSize() const override;
579 void writeTo(uint8_t *Buf) override;
582 void writeOne(uint8_t *Buf, uint32_t Index, StringRef Name, size_t NameOff);
584 unsigned FileDefNameOff;
587 // The .gnu.version section specifies the required version of each symbol in the
588 // dynamic symbol table. It contains one Elf_Versym for each dynamic symbol
589 // table entry. An Elf_Versym is just a 16-bit integer that refers to a version
590 // identifier defined in the either .gnu.version_r or .gnu.version_d section.
591 // The values 0 and 1 are reserved. All other values are used for versions in
592 // the own object or in any of the dependencies.
593 template <class ELFT>
594 class VersionTableSection final : public SyntheticSection {
595 typedef typename ELFT::Versym Elf_Versym;
598 VersionTableSection();
599 void finalizeContents() override;
600 size_t getSize() const override;
601 void writeTo(uint8_t *Buf) override;
602 bool empty() const override;
605 // The .gnu.version_r section defines the version identifiers used by
606 // .gnu.version. It contains a linked list of Elf_Verneed data structures. Each
607 // Elf_Verneed specifies the version requirements for a single DSO, and contains
608 // a reference to a linked list of Elf_Vernaux data structures which define the
609 // mapping from version identifiers to version names.
610 template <class ELFT> class VersionNeedSection final : public SyntheticSection {
611 typedef typename ELFT::Verneed Elf_Verneed;
612 typedef typename ELFT::Vernaux Elf_Vernaux;
614 // A vector of shared files that need Elf_Verneed data structures and the
615 // string table offsets of their sonames.
616 std::vector<std::pair<SharedFile<ELFT> *, size_t>> Needed;
618 // The next available version identifier.
622 VersionNeedSection();
623 void addSymbol(SharedSymbol *SS);
624 void finalizeContents() override;
625 void writeTo(uint8_t *Buf) override;
626 size_t getSize() const override;
627 size_t getNeedNum() const { return Needed.size(); }
628 bool empty() const override;
631 // MergeSyntheticSection is a class that allows us to put mergeable sections
632 // with different attributes in a single output sections. To do that
633 // we put them into MergeSyntheticSection synthetic input sections which are
634 // attached to regular output sections.
635 class MergeSyntheticSection final : public SyntheticSection {
637 MergeSyntheticSection(StringRef Name, uint32_t Type, uint64_t Flags,
639 void addSection(MergeInputSection *MS);
640 void writeTo(uint8_t *Buf) override;
641 void finalizeContents() override;
642 bool shouldTailMerge() const;
643 size_t getSize() const override;
646 void finalizeTailMerge();
647 void finalizeNoTailMerge();
649 bool Finalized = false;
650 llvm::StringTableBuilder Builder;
651 std::vector<MergeInputSection *> Sections;
654 // .MIPS.abiflags section.
655 template <class ELFT>
656 class MipsAbiFlagsSection final : public SyntheticSection {
657 typedef llvm::object::Elf_Mips_ABIFlags<ELFT> Elf_Mips_ABIFlags;
660 static MipsAbiFlagsSection *create();
662 MipsAbiFlagsSection(Elf_Mips_ABIFlags Flags);
663 size_t getSize() const override { return sizeof(Elf_Mips_ABIFlags); }
664 void writeTo(uint8_t *Buf) override;
667 Elf_Mips_ABIFlags Flags;
670 // .MIPS.options section.
671 template <class ELFT> class MipsOptionsSection final : public SyntheticSection {
672 typedef llvm::object::Elf_Mips_Options<ELFT> Elf_Mips_Options;
673 typedef llvm::object::Elf_Mips_RegInfo<ELFT> Elf_Mips_RegInfo;
676 static MipsOptionsSection *create();
678 MipsOptionsSection(Elf_Mips_RegInfo Reginfo);
679 void writeTo(uint8_t *Buf) override;
681 size_t getSize() const override {
682 return sizeof(Elf_Mips_Options) + sizeof(Elf_Mips_RegInfo);
686 Elf_Mips_RegInfo Reginfo;
689 // MIPS .reginfo section.
690 template <class ELFT> class MipsReginfoSection final : public SyntheticSection {
691 typedef llvm::object::Elf_Mips_RegInfo<ELFT> Elf_Mips_RegInfo;
694 static MipsReginfoSection *create();
696 MipsReginfoSection(Elf_Mips_RegInfo Reginfo);
697 size_t getSize() const override { return sizeof(Elf_Mips_RegInfo); }
698 void writeTo(uint8_t *Buf) override;
701 Elf_Mips_RegInfo Reginfo;
704 // This is a MIPS specific section to hold a space within the data segment
705 // of executable file which is pointed to by the DT_MIPS_RLD_MAP entry.
706 // See "Dynamic section" in Chapter 5 in the following document:
707 // ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf
708 class MipsRldMapSection : public SyntheticSection {
711 size_t getSize() const override { return Config->Wordsize; }
712 void writeTo(uint8_t *Buf) override;
715 class ARMExidxSentinelSection : public SyntheticSection {
717 ARMExidxSentinelSection();
718 size_t getSize() const override { return 8; }
719 void writeTo(uint8_t *Buf) override;
722 // A container for one or more linker generated thunks. Instances of these
723 // thunks including ARM interworking and Mips LA25 PI to non-PI thunks.
724 class ThunkSection : public SyntheticSection {
726 // ThunkSection in OS, with desired OutSecOff of Off
727 ThunkSection(OutputSection *OS, uint64_t Off);
729 // Add a newly created Thunk to this container:
730 // Thunk is given offset from start of this InputSection
731 // Thunk defines a symbol in this InputSection that can be used as target
733 void addThunk(Thunk *T);
734 size_t getSize() const override { return Size; }
735 void writeTo(uint8_t *Buf) override;
736 InputSection *getTargetInputSection() const;
739 std::vector<const Thunk *> Thunks;
743 template <class ELFT> InputSection *createCommonSection();
744 InputSection *createInterpSection();
745 template <class ELFT> MergeInputSection *createCommentSection();
747 SymbolBody *addSyntheticLocal(StringRef Name, uint8_t Type, uint64_t Value,
748 uint64_t Size, InputSectionBase *Section);
750 // Linker generated sections which can be used as inputs.
752 static InputSection *ARMAttributes;
753 static BssSection *Bss;
754 static BssSection *BssRelRo;
755 static BuildIdSection *BuildId;
756 static InputSection *Common;
757 static SyntheticSection *Dynamic;
758 static StringTableSection *DynStrTab;
759 static SymbolTableBaseSection *DynSymTab;
760 static GnuHashTableSection *GnuHashTab;
761 static InputSection *Interp;
762 static GdbIndexSection *GdbIndex;
763 static GotSection *Got;
764 static GotPltSection *GotPlt;
765 static IgotPltSection *IgotPlt;
766 static MipsGotSection *MipsGot;
767 static MipsRldMapSection *MipsRldMap;
768 static PltSection *Plt;
769 static PltSection *Iplt;
770 static StringTableSection *ShStrTab;
771 static StringTableSection *StrTab;
772 static SymbolTableBaseSection *SymTab;
775 template <class ELFT> struct In : public InX {
776 static EhFrameHeader<ELFT> *EhFrameHdr;
777 static EhFrameSection<ELFT> *EhFrame;
778 static HashTableSection<ELFT> *HashTab;
779 static RelocationSection<ELFT> *RelaDyn;
780 static RelocationSection<ELFT> *RelaPlt;
781 static RelocationSection<ELFT> *RelaIplt;
782 static VersionDefinitionSection<ELFT> *VerDef;
783 static VersionTableSection<ELFT> *VerSym;
784 static VersionNeedSection<ELFT> *VerNeed;
787 template <class ELFT> EhFrameHeader<ELFT> *In<ELFT>::EhFrameHdr;
788 template <class ELFT> EhFrameSection<ELFT> *In<ELFT>::EhFrame;
789 template <class ELFT> HashTableSection<ELFT> *In<ELFT>::HashTab;
790 template <class ELFT> RelocationSection<ELFT> *In<ELFT>::RelaDyn;
791 template <class ELFT> RelocationSection<ELFT> *In<ELFT>::RelaPlt;
792 template <class ELFT> RelocationSection<ELFT> *In<ELFT>::RelaIplt;
793 template <class ELFT> VersionDefinitionSection<ELFT> *In<ELFT>::VerDef;
794 template <class ELFT> VersionTableSection<ELFT> *In<ELFT>::VerSym;
795 template <class ELFT> VersionNeedSection<ELFT> *In<ELFT>::VerNeed;