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 template <class ELFT> class GotSection final : public SyntheticSection {
110 void writeTo(uint8_t *Buf) override;
111 size_t getSize() const override { return Size; }
112 void finalizeContents() override;
113 bool empty() const 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 template <class ELFT> class SymbolTableSection final : public SyntheticSection {
406 typedef typename ELFT::Sym Elf_Sym;
408 SymbolTableSection(StringTableSection &StrTabSec);
410 void finalizeContents() override;
411 void postThunkContents() override;
412 void writeTo(uint8_t *Buf) override;
413 size_t getSize() const override { return getNumSymbols() * sizeof(Elf_Sym); }
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 // Outputs GNU Hash section. For detailed explanation see:
427 // https://blogs.oracle.com/ali/entry/gnu_hash_elf_sections
428 template <class ELFT>
429 class GnuHashTableSection final : public SyntheticSection {
431 GnuHashTableSection();
432 void finalizeContents() override;
433 void writeTo(uint8_t *Buf) override;
434 size_t getSize() const override { return Size; }
436 // Adds symbols to the hash table.
437 // Sorts the input to satisfy GNU hash section requirements.
438 void addSymbols(std::vector<SymbolTableEntry> &Symbols);
441 size_t getShift2() const { return Config->Is64 ? 6 : 5; }
443 void writeBloomFilter(uint8_t *Buf);
444 void writeHashTable(uint8_t *Buf);
452 std::vector<Entry> Symbols;
458 template <class ELFT> class HashTableSection final : public SyntheticSection {
461 void finalizeContents() override;
462 void writeTo(uint8_t *Buf) override;
463 size_t getSize() const override { return Size; }
469 // The PltSection is used for both the Plt and Iplt. The former always has a
470 // header as its first entry that is used at run-time to resolve lazy binding.
471 // The latter is used for GNU Ifunc symbols, that will be subject to a
472 // Target->IRelativeRel.
473 class PltSection : public SyntheticSection {
475 PltSection(size_t HeaderSize);
476 void writeTo(uint8_t *Buf) override;
477 size_t getSize() const override;
478 bool empty() const override { return Entries.empty(); }
481 template <class ELFT> void addEntry(SymbolBody &Sym);
484 void writeHeader(uint8_t *Buf){};
485 void addHeaderSymbols(){};
486 unsigned getPltRelocOff() const;
487 std::vector<std::pair<const SymbolBody *, unsigned>> Entries;
488 // Iplt always has HeaderSize of 0, the Plt HeaderSize is always non-zero
492 class GdbIndexSection final : public SyntheticSection {
493 const unsigned OffsetTypeSize = 4;
494 const unsigned CuListOffset = 6 * OffsetTypeSize;
495 const unsigned CompilationUnitSize = 16;
496 const unsigned AddressEntrySize = 16 + OffsetTypeSize;
497 const unsigned SymTabEntrySize = 2 * OffsetTypeSize;
501 void finalizeContents() override;
502 void writeTo(uint8_t *Buf) override;
503 size_t getSize() const override;
504 bool empty() const override;
506 // Pairs of [CU Offset, CU length].
507 std::vector<std::pair<uint64_t, uint64_t>> CompilationUnits;
509 llvm::StringTableBuilder StringPool;
511 GdbHashTab SymbolTable;
513 // The CU vector portion of the constant pool.
514 std::vector<std::vector<std::pair<uint32_t, uint8_t>>> CuVectors;
516 std::vector<AddressEntry> AddressArea;
519 void readDwarf(InputSection *Sec);
521 uint32_t CuTypesOffset;
522 uint32_t SymTabOffset;
523 uint32_t ConstantPoolOffset;
524 uint32_t StringPoolOffset;
526 size_t CuVectorsSize = 0;
527 std::vector<size_t> CuVectorsOffset;
529 bool Finalized = false;
532 // --eh-frame-hdr option tells linker to construct a header for all the
533 // .eh_frame sections. This header is placed to a section named .eh_frame_hdr
534 // and also to a PT_GNU_EH_FRAME segment.
535 // At runtime the unwinder then can find all the PT_GNU_EH_FRAME segments by
536 // calling dl_iterate_phdr.
537 // This section contains a lookup table for quick binary search of FDEs.
538 // Detailed info about internals can be found in Ian Lance Taylor's blog:
539 // http://www.airs.com/blog/archives/460 (".eh_frame")
540 // http://www.airs.com/blog/archives/462 (".eh_frame_hdr")
541 template <class ELFT> class EhFrameHeader final : public SyntheticSection {
544 void writeTo(uint8_t *Buf) override;
545 size_t getSize() const override;
546 void addFde(uint32_t Pc, uint32_t FdeVA);
547 bool empty() const override;
555 std::vector<FdeData> Fdes;
558 // For more information about .gnu.version and .gnu.version_r see:
559 // https://www.akkadia.org/drepper/symbol-versioning
561 // The .gnu.version_d section which has a section type of SHT_GNU_verdef shall
562 // contain symbol version definitions. The number of entries in this section
563 // shall be contained in the DT_VERDEFNUM entry of the .dynamic section.
564 // The section shall contain an array of Elf_Verdef structures, optionally
565 // followed by an array of Elf_Verdaux structures.
566 template <class ELFT>
567 class VersionDefinitionSection final : public SyntheticSection {
568 typedef typename ELFT::Verdef Elf_Verdef;
569 typedef typename ELFT::Verdaux Elf_Verdaux;
572 VersionDefinitionSection();
573 void finalizeContents() override;
574 size_t getSize() const override;
575 void writeTo(uint8_t *Buf) override;
578 void writeOne(uint8_t *Buf, uint32_t Index, StringRef Name, size_t NameOff);
580 unsigned FileDefNameOff;
583 // The .gnu.version section specifies the required version of each symbol in the
584 // dynamic symbol table. It contains one Elf_Versym for each dynamic symbol
585 // table entry. An Elf_Versym is just a 16-bit integer that refers to a version
586 // identifier defined in the either .gnu.version_r or .gnu.version_d section.
587 // The values 0 and 1 are reserved. All other values are used for versions in
588 // the own object or in any of the dependencies.
589 template <class ELFT>
590 class VersionTableSection final : public SyntheticSection {
591 typedef typename ELFT::Versym Elf_Versym;
594 VersionTableSection();
595 void finalizeContents() override;
596 size_t getSize() const override;
597 void writeTo(uint8_t *Buf) override;
598 bool empty() const override;
601 // The .gnu.version_r section defines the version identifiers used by
602 // .gnu.version. It contains a linked list of Elf_Verneed data structures. Each
603 // Elf_Verneed specifies the version requirements for a single DSO, and contains
604 // a reference to a linked list of Elf_Vernaux data structures which define the
605 // mapping from version identifiers to version names.
606 template <class ELFT> class VersionNeedSection final : public SyntheticSection {
607 typedef typename ELFT::Verneed Elf_Verneed;
608 typedef typename ELFT::Vernaux Elf_Vernaux;
610 // A vector of shared files that need Elf_Verneed data structures and the
611 // string table offsets of their sonames.
612 std::vector<std::pair<SharedFile<ELFT> *, size_t>> Needed;
614 // The next available version identifier.
618 VersionNeedSection();
619 void addSymbol(SharedSymbol *SS);
620 void finalizeContents() override;
621 void writeTo(uint8_t *Buf) override;
622 size_t getSize() const override;
623 size_t getNeedNum() const { return Needed.size(); }
624 bool empty() const override;
627 // MergeSyntheticSection is a class that allows us to put mergeable sections
628 // with different attributes in a single output sections. To do that
629 // we put them into MergeSyntheticSection synthetic input sections which are
630 // attached to regular output sections.
631 class MergeSyntheticSection final : public SyntheticSection {
633 MergeSyntheticSection(StringRef Name, uint32_t Type, uint64_t Flags,
635 void addSection(MergeInputSection *MS);
636 void writeTo(uint8_t *Buf) override;
637 void finalizeContents() override;
638 bool shouldTailMerge() const;
639 size_t getSize() const override;
642 void finalizeTailMerge();
643 void finalizeNoTailMerge();
645 bool Finalized = false;
646 llvm::StringTableBuilder Builder;
647 std::vector<MergeInputSection *> Sections;
650 // .MIPS.abiflags section.
651 template <class ELFT>
652 class MipsAbiFlagsSection final : public SyntheticSection {
653 typedef llvm::object::Elf_Mips_ABIFlags<ELFT> Elf_Mips_ABIFlags;
656 static MipsAbiFlagsSection *create();
658 MipsAbiFlagsSection(Elf_Mips_ABIFlags Flags);
659 size_t getSize() const override { return sizeof(Elf_Mips_ABIFlags); }
660 void writeTo(uint8_t *Buf) override;
663 Elf_Mips_ABIFlags Flags;
666 // .MIPS.options section.
667 template <class ELFT> class MipsOptionsSection final : public SyntheticSection {
668 typedef llvm::object::Elf_Mips_Options<ELFT> Elf_Mips_Options;
669 typedef llvm::object::Elf_Mips_RegInfo<ELFT> Elf_Mips_RegInfo;
672 static MipsOptionsSection *create();
674 MipsOptionsSection(Elf_Mips_RegInfo Reginfo);
675 void writeTo(uint8_t *Buf) override;
677 size_t getSize() const override {
678 return sizeof(Elf_Mips_Options) + sizeof(Elf_Mips_RegInfo);
682 Elf_Mips_RegInfo Reginfo;
685 // MIPS .reginfo section.
686 template <class ELFT> class MipsReginfoSection final : public SyntheticSection {
687 typedef llvm::object::Elf_Mips_RegInfo<ELFT> Elf_Mips_RegInfo;
690 static MipsReginfoSection *create();
692 MipsReginfoSection(Elf_Mips_RegInfo Reginfo);
693 size_t getSize() const override { return sizeof(Elf_Mips_RegInfo); }
694 void writeTo(uint8_t *Buf) override;
697 Elf_Mips_RegInfo Reginfo;
700 // This is a MIPS specific section to hold a space within the data segment
701 // of executable file which is pointed to by the DT_MIPS_RLD_MAP entry.
702 // See "Dynamic section" in Chapter 5 in the following document:
703 // ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf
704 class MipsRldMapSection : public SyntheticSection {
707 size_t getSize() const override { return Config->Wordsize; }
708 void writeTo(uint8_t *Buf) override;
711 class ARMExidxSentinelSection : public SyntheticSection {
713 ARMExidxSentinelSection();
714 size_t getSize() const override { return 8; }
715 void writeTo(uint8_t *Buf) override;
718 // A container for one or more linker generated thunks. Instances of these
719 // thunks including ARM interworking and Mips LA25 PI to non-PI thunks.
720 class ThunkSection : public SyntheticSection {
722 // ThunkSection in OS, with desired OutSecOff of Off
723 ThunkSection(OutputSection *OS, uint64_t Off);
725 // Add a newly created Thunk to this container:
726 // Thunk is given offset from start of this InputSection
727 // Thunk defines a symbol in this InputSection that can be used as target
729 void addThunk(Thunk *T);
730 size_t getSize() const override { return Size; }
731 void writeTo(uint8_t *Buf) override;
732 InputSection *getTargetInputSection() const;
735 std::vector<const Thunk *> Thunks;
739 template <class ELFT> InputSection *createCommonSection();
740 InputSection *createInterpSection();
741 template <class ELFT> MergeInputSection *createCommentSection();
742 template <class ELFT>
743 SymbolBody *addSyntheticLocal(StringRef Name, uint8_t Type, uint64_t Value,
744 uint64_t Size, InputSectionBase *Section);
746 // Linker generated sections which can be used as inputs.
748 static InputSection *ARMAttributes;
749 static BssSection *Bss;
750 static BssSection *BssRelRo;
751 static BuildIdSection *BuildId;
752 static InputSection *Common;
753 static StringTableSection *DynStrTab;
754 static InputSection *Interp;
755 static GdbIndexSection *GdbIndex;
756 static GotPltSection *GotPlt;
757 static IgotPltSection *IgotPlt;
758 static MipsGotSection *MipsGot;
759 static MipsRldMapSection *MipsRldMap;
760 static PltSection *Plt;
761 static PltSection *Iplt;
762 static StringTableSection *ShStrTab;
763 static StringTableSection *StrTab;
766 template <class ELFT> struct In : public InX {
767 static DynamicSection<ELFT> *Dynamic;
768 static SymbolTableSection<ELFT> *DynSymTab;
769 static EhFrameHeader<ELFT> *EhFrameHdr;
770 static GnuHashTableSection<ELFT> *GnuHashTab;
771 static GotSection<ELFT> *Got;
772 static EhFrameSection<ELFT> *EhFrame;
773 static HashTableSection<ELFT> *HashTab;
774 static RelocationSection<ELFT> *RelaDyn;
775 static RelocationSection<ELFT> *RelaPlt;
776 static RelocationSection<ELFT> *RelaIplt;
777 static SymbolTableSection<ELFT> *SymTab;
778 static VersionDefinitionSection<ELFT> *VerDef;
779 static VersionTableSection<ELFT> *VerSym;
780 static VersionNeedSection<ELFT> *VerNeed;
783 template <class ELFT> DynamicSection<ELFT> *In<ELFT>::Dynamic;
784 template <class ELFT> SymbolTableSection<ELFT> *In<ELFT>::DynSymTab;
785 template <class ELFT> EhFrameHeader<ELFT> *In<ELFT>::EhFrameHdr;
786 template <class ELFT> GnuHashTableSection<ELFT> *In<ELFT>::GnuHashTab;
787 template <class ELFT> GotSection<ELFT> *In<ELFT>::Got;
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> SymbolTableSection<ELFT> *In<ELFT>::SymTab;
794 template <class ELFT> VersionDefinitionSection<ELFT> *In<ELFT>::VerDef;
795 template <class ELFT> VersionTableSection<ELFT> *In<ELFT>::VerSym;
796 template <class ELFT> VersionNeedSection<ELFT> *In<ELFT>::VerNeed;