1 //===- InputSection.cpp ---------------------------------------------------===//
2 //
3 //                             The LLVM Linker
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include "InputSection.h"
11 #include "Config.h"
12 #include "Error.h"
13 #include "InputFiles.h"
14 #include "OutputSections.h"
15 #include "Target.h"
16 
17 #include "llvm/Support/Endian.h"
18 
19 using namespace llvm;
20 using namespace llvm::ELF;
21 using namespace llvm::object;
22 using namespace llvm::support::endian;
23 
24 using namespace lld;
25 using namespace lld::elf;
26 
27 template <class ELFT>
28 InputSectionBase<ELFT>::InputSectionBase(elf::ObjectFile<ELFT> *File,
29                                          const Elf_Shdr *Header,
30                                          Kind SectionKind)
31     : Header(Header), File(File), SectionKind(SectionKind), Repl(this) {
32   // The garbage collector sets sections' Live bits.
33   // If GC is disabled, all sections are considered live by default.
34   Live = !Config->GcSections;
35 
36   // The ELF spec states that a value of 0 means the section has
37   // no alignment constraits.
38   Align = std::max<uintX_t>(Header->sh_addralign, 1);
39 }
40 
41 template <class ELFT> size_t InputSectionBase<ELFT>::getSize() const {
42   if (auto *D = dyn_cast<InputSection<ELFT>>(this))
43     if (D->getThunksSize() > 0)
44       return D->getThunkOff() + D->getThunksSize();
45   return Header->sh_size;
46 }
47 
48 template <class ELFT> StringRef InputSectionBase<ELFT>::getSectionName() const {
49   return check(File->getObj().getSectionName(this->Header));
50 }
51 
52 template <class ELFT>
53 ArrayRef<uint8_t> InputSectionBase<ELFT>::getSectionData() const {
54   return check(this->File->getObj().getSectionContents(this->Header));
55 }
56 
57 template <class ELFT>
58 typename ELFT::uint InputSectionBase<ELFT>::getOffset(uintX_t Offset) {
59   switch (SectionKind) {
60   case Regular:
61     return cast<InputSection<ELFT>>(this)->OutSecOff + Offset;
62   case EHFrame:
63     return cast<EHInputSection<ELFT>>(this)->getOffset(Offset);
64   case Merge:
65     return cast<MergeInputSection<ELFT>>(this)->getOffset(Offset);
66   case MipsReginfo:
67   case MipsOptions:
68     // MIPS .reginfo and .MIPS.options sections are consumed by the linker,
69     // so they should never be copied to output.
70     llvm_unreachable("MIPS reginfo/options section reached writeTo().");
71   }
72   llvm_unreachable("invalid section kind");
73 }
74 
75 template <class ELFT>
76 typename ELFT::uint
77 InputSectionBase<ELFT>::getOffset(const DefinedRegular<ELFT> &Sym) {
78   return getOffset(Sym.Value);
79 }
80 
81 template <class ELFT>
82 InputSection<ELFT>::InputSection(elf::ObjectFile<ELFT> *F,
83                                  const Elf_Shdr *Header)
84     : InputSectionBase<ELFT>(F, Header, Base::Regular) {}
85 
86 template <class ELFT>
87 bool InputSection<ELFT>::classof(const InputSectionBase<ELFT> *S) {
88   return S->SectionKind == Base::Regular;
89 }
90 
91 template <class ELFT>
92 InputSectionBase<ELFT> *InputSection<ELFT>::getRelocatedSection() {
93   assert(this->Header->sh_type == SHT_RELA || this->Header->sh_type == SHT_REL);
94   ArrayRef<InputSectionBase<ELFT> *> Sections = this->File->getSections();
95   return Sections[this->Header->sh_info];
96 }
97 
98 template <class ELFT> void InputSection<ELFT>::addThunk(SymbolBody &Body) {
99   Body.ThunkIndex = Thunks.size();
100   Thunks.push_back(&Body);
101 }
102 
103 template <class ELFT> uint64_t InputSection<ELFT>::getThunkOff() const {
104   return this->Header->sh_size;
105 }
106 
107 template <class ELFT> uint64_t InputSection<ELFT>::getThunksSize() const {
108   return Thunks.size() * Target->ThunkSize;
109 }
110 
111 // This is used for -r. We can't use memcpy to copy relocations because we need
112 // to update symbol table offset and section index for each relocation. So we
113 // copy relocations one by one.
114 template <class ELFT>
115 template <class RelTy>
116 void InputSection<ELFT>::copyRelocations(uint8_t *Buf, ArrayRef<RelTy> Rels) {
117   InputSectionBase<ELFT> *RelocatedSection = getRelocatedSection();
118 
119   for (const RelTy &Rel : Rels) {
120     uint32_t Type = Rel.getType(Config->Mips64EL);
121     SymbolBody &Body = this->File->getRelocTargetSym(Rel);
122 
123     RelTy *P = reinterpret_cast<RelTy *>(Buf);
124     Buf += sizeof(RelTy);
125 
126     P->r_offset = RelocatedSection->getOffset(Rel.r_offset);
127     P->setSymbolAndType(Body.DynsymIndex, Type, Config->Mips64EL);
128   }
129 }
130 
131 // Page(Expr) is the page address of the expression Expr, defined
132 // as (Expr & ~0xFFF). (This applies even if the machine page size
133 // supported by the platform has a different value.)
134 static uint64_t getAArch64Page(uint64_t Expr) {
135   return Expr & (~static_cast<uint64_t>(0xFFF));
136 }
137 
138 // For computing values, each R_RELAX_TLS_* corresponds to whatever expression
139 // the target uses in the mode this is being relaxed into. For example, anything
140 // that relaxes to LE just needs an R_TLS since that is what is used if we
141 // had a local exec expression to begin with.
142 static RelExpr getRelaxedExpr(RelExpr Expr) {
143   switch (Expr) {
144   default:
145     return Expr;
146   case R_RELAX_TLS_GD_TO_LE:
147     if (Config->EMachine == EM_386)
148       return R_NEG_TLS;
149     return R_TLS;
150   case R_RELAX_TLS_GD_TO_IE:
151     if (Config->EMachine == EM_386)
152       return R_GOT_FROM_END;
153     return R_GOT_PC;
154   case R_RELAX_TLS_IE_TO_LE:
155   case R_RELAX_TLS_LD_TO_LE:
156     return R_TLS;
157   }
158 }
159 
160 template <class ELFT>
161 static typename ELFT::uint
162 getSymVA(uint32_t Type, typename ELFT::uint A, typename ELFT::uint P,
163          const SymbolBody &Body, uint8_t *BufLoc,
164          const elf::ObjectFile<ELFT> &File, RelExpr Expr) {
165   typedef typename ELFT::uint uintX_t;
166   Expr = getRelaxedExpr(Expr);
167 
168   switch (Expr) {
169   case R_HINT:
170     llvm_unreachable("cannot relocate hint relocs");
171   case R_RELAX_TLS_GD_TO_LE:
172   case R_RELAX_TLS_GD_TO_IE:
173   case R_RELAX_TLS_IE_TO_LE:
174   case R_RELAX_TLS_LD_TO_LE:
175     llvm_unreachable("Should have been mapped");
176   case R_TLSLD:
177     return Out<ELFT>::Got->getTlsIndexOff() + A -
178            Out<ELFT>::Got->getNumEntries() * sizeof(uintX_t);
179   case R_TLSLD_PC:
180     return Out<ELFT>::Got->getTlsIndexVA() + A - P;
181   case R_THUNK:
182     return Body.getThunkVA<ELFT>();
183   case R_PPC_TOC:
184     return getPPC64TocBase() + A;
185   case R_TLSGD:
186     return Out<ELFT>::Got->getGlobalDynOffset(Body) + A -
187            Out<ELFT>::Got->getNumEntries() * sizeof(uintX_t);
188   case R_TLSGD_PC:
189     return Out<ELFT>::Got->getGlobalDynAddr(Body) + A - P;
190   case R_PLT:
191     return Body.getPltVA<ELFT>() + A;
192   case R_PLT_PC:
193   case R_PPC_PLT_OPD:
194     return Body.getPltVA<ELFT>() + A - P;
195   case R_SIZE:
196     return Body.getSize<ELFT>() + A;
197   case R_GOTREL:
198     return Body.getVA<ELFT>(A) - Out<ELFT>::Got->getVA();
199   case R_GOT_FROM_END:
200     return Body.getGotOffset<ELFT>() + A -
201            Out<ELFT>::Got->getNumEntries() * sizeof(uintX_t);
202   case R_GOT:
203     return Body.getGotVA<ELFT>() + A;
204   case R_GOT_PAGE_PC:
205     return getAArch64Page(Body.getGotVA<ELFT>() + A) - getAArch64Page(P);
206   case R_GOT_PC:
207     return Body.getGotVA<ELFT>() + A - P;
208   case R_GOTONLY_PC:
209     return Out<ELFT>::Got->getVA() + A - P;
210   case R_TLS:
211     if (Target->TcbSize)
212       return Body.getVA<ELFT>(A) +
213              alignTo(Target->TcbSize, Out<ELFT>::TlsPhdr->p_align);
214     return Body.getVA<ELFT>(A) - Out<ELFT>::TlsPhdr->p_memsz;
215   case R_NEG_TLS:
216     return Out<ELF32LE>::TlsPhdr->p_memsz - Body.getVA<ELFT>(A);
217   case R_ABS:
218     return Body.getVA<ELFT>(A);
219   case R_GOT_OFF:
220     return Body.getGotOffset<ELFT>() + A;
221   case R_MIPS_GOT_LOCAL_PAGE:
222     // If relocation against MIPS local symbol requires GOT entry, this entry
223     // should be initialized by 'page address'. This address is high 16-bits
224     // of sum the symbol's value and the addend.
225     return Out<ELFT>::Got->getMipsLocalPageOffset(Body.getVA<ELFT>(A));
226   case R_MIPS_GOT_LOCAL:
227     // For non-local symbols GOT entries should contain their full
228     // addresses. But if such symbol cannot be preempted, we do not
229     // have to put them into the "global" part of GOT and use dynamic
230     // linker to determine their actual addresses. That is why we
231     // create GOT entries for them in the "local" part of GOT.
232     return Out<ELFT>::Got->getMipsLocalEntryOffset(Body.getVA<ELFT>(A));
233   case R_PPC_OPD: {
234     uint64_t SymVA = Body.getVA<ELFT>(A);
235     // If we have an undefined weak symbol, we might get here with a symbol
236     // address of zero. That could overflow, but the code must be unreachable,
237     // so don't bother doing anything at all.
238     if (!SymVA)
239       return 0;
240     if (Out<ELF64BE>::Opd) {
241       // If this is a local call, and we currently have the address of a
242       // function-descriptor, get the underlying code address instead.
243       uint64_t OpdStart = Out<ELF64BE>::Opd->getVA();
244       uint64_t OpdEnd = OpdStart + Out<ELF64BE>::Opd->getSize();
245       bool InOpd = OpdStart <= SymVA && SymVA < OpdEnd;
246       if (InOpd)
247         SymVA = read64be(&Out<ELF64BE>::OpdBuf[SymVA - OpdStart]);
248     }
249     return SymVA - P;
250   }
251   case R_PC:
252     return Body.getVA<ELFT>(A) - P;
253   case R_PAGE_PC:
254     return getAArch64Page(Body.getVA<ELFT>(A)) - getAArch64Page(P);
255   }
256   llvm_unreachable("Invalid expression");
257 }
258 
259 // This function applies relocations to sections without SHF_ALLOC bit.
260 // Such sections are never mapped to memory at runtime. Debug sections are
261 // an example. Relocations in non-alloc sections are much easier to
262 // handle than in allocated sections because it will never need complex
263 // treatement such as GOT or PLT (because at runtime no one refers them).
264 // So, we handle relocations for non-alloc sections directly in this
265 // function as a performance optimization.
266 template <class ELFT>
267 template <class RelTy>
268 void InputSection<ELFT>::relocateNonAlloc(uint8_t *Buf, ArrayRef<RelTy> Rels) {
269   const unsigned Bits = sizeof(uintX_t) * 8;
270   for (const RelTy &Rel : Rels) {
271     uint32_t Type = Rel.getType(Config->Mips64EL);
272     uintX_t Offset = this->getOffset(Rel.r_offset);
273     uint8_t *BufLoc = Buf + Offset;
274     uintX_t Addend = getAddend<ELFT>(Rel);
275     if (!RelTy::IsRela)
276       Addend += Target->getImplicitAddend(BufLoc, Type);
277 
278     SymbolBody &Sym = this->File->getRelocTargetSym(Rel);
279     if (Target->getRelExpr(Type, Sym) != R_ABS) {
280       error(this->getSectionName() + " has non-ABS reloc");
281       return;
282     }
283 
284     uintX_t AddrLoc = this->OutSec->getVA() + Offset;
285     uint64_t SymVA = SignExtend64<Bits>(getSymVA<ELFT>(
286         Type, Addend, AddrLoc, Sym, BufLoc, *this->File, R_ABS));
287     Target->relocateOne(BufLoc, Type, SymVA);
288   }
289 }
290 
291 template <class ELFT>
292 void InputSectionBase<ELFT>::relocate(uint8_t *Buf, uint8_t *BufEnd) {
293   // scanReloc function in Writer.cpp constructs Relocations
294   // vector only for SHF_ALLOC'ed sections. For other sections,
295   // we handle relocations directly here.
296   auto *IS = dyn_cast<InputSection<ELFT>>(this);
297   if (IS && !(IS->Header->sh_flags & SHF_ALLOC)) {
298     for (const Elf_Shdr *RelSec : IS->RelocSections) {
299       if (RelSec->sh_type == SHT_RELA)
300         IS->relocateNonAlloc(Buf, IS->File->getObj().relas(RelSec));
301       else
302         IS->relocateNonAlloc(Buf, IS->File->getObj().rels(RelSec));
303     }
304     return;
305   }
306 
307   const unsigned Bits = sizeof(uintX_t) * 8;
308   for (const Relocation &Rel : Relocations) {
309     uintX_t Offset = Rel.Offset;
310     uint8_t *BufLoc = Buf + Offset;
311     uint32_t Type = Rel.Type;
312     uintX_t A = Rel.Addend;
313 
314     uintX_t AddrLoc = OutSec->getVA() + Offset;
315     RelExpr Expr = Rel.Expr;
316     uint64_t SymVA = SignExtend64<Bits>(
317         getSymVA<ELFT>(Type, A, AddrLoc, *Rel.Sym, BufLoc, *File, Expr));
318 
319     if (Expr == R_PPC_PLT_OPD) {
320       uint32_t Nop = 0x60000000;
321       if (BufLoc + 8 <= BufEnd && read32be(BufLoc + 4) == Nop)
322         write32be(BufLoc + 4, 0xe8410028); // ld %r2, 40(%r1)
323     }
324 
325     switch (Expr) {
326     case R_RELAX_TLS_IE_TO_LE:
327       Target->relaxTlsIeToLe(BufLoc, Type, SymVA);
328       break;
329     case R_RELAX_TLS_LD_TO_LE:
330       Target->relaxTlsLdToLe(BufLoc, Type, SymVA);
331       break;
332     case R_RELAX_TLS_GD_TO_LE:
333       Target->relaxTlsGdToLe(BufLoc, Type, SymVA);
334       break;
335     case R_RELAX_TLS_GD_TO_IE:
336       Target->relaxTlsGdToIe(BufLoc, Type, SymVA);
337       break;
338     default:
339       Target->relocateOne(BufLoc, Type, SymVA);
340       break;
341     }
342   }
343 }
344 
345 template <class ELFT> void InputSection<ELFT>::writeTo(uint8_t *Buf) {
346   if (this->Header->sh_type == SHT_NOBITS)
347     return;
348   ELFFile<ELFT> &EObj = this->File->getObj();
349 
350   // If -r is given, then an InputSection may be a relocation section.
351   if (this->Header->sh_type == SHT_RELA) {
352     copyRelocations(Buf + OutSecOff, EObj.relas(this->Header));
353     return;
354   }
355   if (this->Header->sh_type == SHT_REL) {
356     copyRelocations(Buf + OutSecOff, EObj.rels(this->Header));
357     return;
358   }
359 
360   // Copy section contents from source object file to output file.
361   ArrayRef<uint8_t> Data = this->getSectionData();
362   memcpy(Buf + OutSecOff, Data.data(), Data.size());
363 
364   // Iterate over all relocation sections that apply to this section.
365   uint8_t *BufEnd = Buf + OutSecOff + Data.size();
366   this->relocate(Buf, BufEnd);
367 
368   // The section might have a data/code generated by the linker and need
369   // to be written after the section. Usually these are thunks - small piece
370   // of code used to jump between "incompatible" functions like PIC and non-PIC
371   // or if the jump target too far and its address does not fit to the short
372   // jump istruction.
373   if (!Thunks.empty()) {
374     Buf += OutSecOff + getThunkOff();
375     for (const SymbolBody *S : Thunks) {
376       Target->writeThunk(Buf, S->getVA<ELFT>());
377       Buf += Target->ThunkSize;
378     }
379   }
380 }
381 
382 template <class ELFT>
383 void InputSection<ELFT>::replace(InputSection<ELFT> *Other) {
384   this->Align = std::max(this->Align, Other->Align);
385   Other->Repl = this->Repl;
386   Other->Live = false;
387 }
388 
389 template <class ELFT>
390 SplitInputSection<ELFT>::SplitInputSection(
391     elf::ObjectFile<ELFT> *File, const Elf_Shdr *Header,
392     typename InputSectionBase<ELFT>::Kind SectionKind)
393     : InputSectionBase<ELFT>(File, Header, SectionKind) {}
394 
395 template <class ELFT>
396 EHInputSection<ELFT>::EHInputSection(elf::ObjectFile<ELFT> *F,
397                                      const Elf_Shdr *Header)
398     : SplitInputSection<ELFT>(F, Header, InputSectionBase<ELFT>::EHFrame) {
399   // Mark .eh_frame sections as live by default because there are
400   // usually no relocations that point to .eh_frames. Otherwise,
401   // the garbage collector would drop all .eh_frame sections.
402   this->Live = true;
403 }
404 
405 template <class ELFT>
406 bool EHInputSection<ELFT>::classof(const InputSectionBase<ELFT> *S) {
407   return S->SectionKind == InputSectionBase<ELFT>::EHFrame;
408 }
409 
410 template <class ELFT>
411 typename ELFT::uint EHInputSection<ELFT>::getOffset(uintX_t Offset) {
412   // The file crtbeginT.o has relocations pointing to the start of an empty
413   // .eh_frame that is known to be the first in the link. It does that to
414   // identify the start of the output .eh_frame. Handle this special case.
415   if (this->getSectionHdr()->sh_size == 0)
416     return Offset;
417   SectionPiece *Piece = this->getSectionPiece(Offset);
418   if (Piece->OutputOff == size_t(-1))
419     return -1; // Not in the output
420 
421   uintX_t Addend = Offset - Piece->InputOff;
422   return Piece->OutputOff + Addend;
423 }
424 
425 static size_t findNull(ArrayRef<uint8_t> A, size_t EntSize) {
426   // Optimize the common case.
427   StringRef S((const char *)A.data(), A.size());
428   if (EntSize == 1)
429     return S.find(0);
430 
431   for (unsigned I = 0, N = S.size(); I != N; I += EntSize) {
432     const char *B = S.begin() + I;
433     if (std::all_of(B, B + EntSize, [](char C) { return C == 0; }))
434       return I;
435   }
436   return StringRef::npos;
437 }
438 
439 template <class ELFT>
440 MergeInputSection<ELFT>::MergeInputSection(elf::ObjectFile<ELFT> *F,
441                                            const Elf_Shdr *Header)
442     : SplitInputSection<ELFT>(F, Header, InputSectionBase<ELFT>::Merge) {
443   uintX_t EntSize = Header->sh_entsize;
444   ArrayRef<uint8_t> Data = this->getSectionData();
445 
446   if (Header->sh_flags & SHF_STRINGS) {
447     uintX_t Offset = 0;
448     while (!Data.empty()) {
449       size_t End = findNull(Data, EntSize);
450       if (End == StringRef::npos)
451         fatal("string is not null terminated");
452       uintX_t Size = End + EntSize;
453       this->Pieces.emplace_back(Offset, Data.slice(0, Size));
454       Data = Data.slice(Size);
455       Offset += Size;
456     }
457     return;
458   }
459 
460   // If this is not of type string, every entry has the same size.
461   size_t Size = Data.size();
462   assert((Size % EntSize) == 0);
463   for (unsigned I = 0, N = Size; I != N; I += EntSize)
464     this->Pieces.emplace_back(I, Data.slice(I, EntSize));
465 }
466 
467 template <class ELFT>
468 bool MergeInputSection<ELFT>::classof(const InputSectionBase<ELFT> *S) {
469   return S->SectionKind == InputSectionBase<ELFT>::Merge;
470 }
471 
472 template <class ELFT>
473 SectionPiece *SplitInputSection<ELFT>::getSectionPiece(uintX_t Offset) {
474   ArrayRef<uint8_t> D = this->getSectionData();
475   StringRef Data((const char *)D.data(), D.size());
476   uintX_t Size = Data.size();
477   if (Offset >= Size)
478     fatal("entry is past the end of the section");
479 
480   // Find the element this offset points to.
481   auto I = std::upper_bound(
482       Pieces.begin(), Pieces.end(), Offset,
483       [](const uintX_t &A, const SectionPiece &B) { return A < B.InputOff; });
484   --I;
485   return &*I;
486 }
487 
488 template <class ELFT>
489 typename ELFT::uint MergeInputSection<ELFT>::getOffset(uintX_t Offset) {
490   SectionPiece &Piece = *this->getSectionPiece(Offset);
491   assert(Piece.Live);
492 
493   // Compute the Addend and if the Base is cached, return.
494   uintX_t Addend = Offset - Piece.InputOff;
495   if (Piece.OutputOff != size_t(-1))
496     return Piece.OutputOff + Addend;
497 
498   // Map the base to the offset in the output section and cache it.
499   ArrayRef<uint8_t> D = this->getSectionData();
500   StringRef Data((const char *)D.data(), D.size());
501   StringRef Entry = Data.substr(Piece.InputOff, Piece.size());
502   auto *MOS = static_cast<MergeOutputSection<ELFT> *>(this->OutSec);
503   Piece.OutputOff = MOS->getOffset(Entry);
504   return Piece.OutputOff + Addend;
505 }
506 
507 template <class ELFT>
508 MipsReginfoInputSection<ELFT>::MipsReginfoInputSection(elf::ObjectFile<ELFT> *F,
509                                                        const Elf_Shdr *Hdr)
510     : InputSectionBase<ELFT>(F, Hdr, InputSectionBase<ELFT>::MipsReginfo) {
511   // Initialize this->Reginfo.
512   ArrayRef<uint8_t> D = this->getSectionData();
513   if (D.size() != sizeof(Elf_Mips_RegInfo<ELFT>)) {
514     error("invalid size of .reginfo section");
515     return;
516   }
517   Reginfo = reinterpret_cast<const Elf_Mips_RegInfo<ELFT> *>(D.data());
518 }
519 
520 template <class ELFT>
521 bool MipsReginfoInputSection<ELFT>::classof(const InputSectionBase<ELFT> *S) {
522   return S->SectionKind == InputSectionBase<ELFT>::MipsReginfo;
523 }
524 
525 template <class ELFT>
526 MipsOptionsInputSection<ELFT>::MipsOptionsInputSection(elf::ObjectFile<ELFT> *F,
527                                                        const Elf_Shdr *Hdr)
528     : InputSectionBase<ELFT>(F, Hdr, InputSectionBase<ELFT>::MipsOptions) {
529   // Find ODK_REGINFO option in the section's content.
530   ArrayRef<uint8_t> D = this->getSectionData();
531   while (!D.empty()) {
532     if (D.size() < sizeof(Elf_Mips_Options<ELFT>)) {
533       error("invalid size of .MIPS.options section");
534       break;
535     }
536     auto *O = reinterpret_cast<const Elf_Mips_Options<ELFT> *>(D.data());
537     if (O->kind == ODK_REGINFO) {
538       Reginfo = &O->getRegInfo();
539       break;
540     }
541     D = D.slice(O->size);
542   }
543 }
544 
545 template <class ELFT>
546 bool MipsOptionsInputSection<ELFT>::classof(const InputSectionBase<ELFT> *S) {
547   return S->SectionKind == InputSectionBase<ELFT>::MipsOptions;
548 }
549 
550 template class elf::InputSectionBase<ELF32LE>;
551 template class elf::InputSectionBase<ELF32BE>;
552 template class elf::InputSectionBase<ELF64LE>;
553 template class elf::InputSectionBase<ELF64BE>;
554 
555 template class elf::InputSection<ELF32LE>;
556 template class elf::InputSection<ELF32BE>;
557 template class elf::InputSection<ELF64LE>;
558 template class elf::InputSection<ELF64BE>;
559 
560 template class elf::SplitInputSection<ELF32LE>;
561 template class elf::SplitInputSection<ELF32BE>;
562 template class elf::SplitInputSection<ELF64LE>;
563 template class elf::SplitInputSection<ELF64BE>;
564 
565 template class elf::EHInputSection<ELF32LE>;
566 template class elf::EHInputSection<ELF32BE>;
567 template class elf::EHInputSection<ELF64LE>;
568 template class elf::EHInputSection<ELF64BE>;
569 
570 template class elf::MergeInputSection<ELF32LE>;
571 template class elf::MergeInputSection<ELF32BE>;
572 template class elf::MergeInputSection<ELF64LE>;
573 template class elf::MergeInputSection<ELF64BE>;
574 
575 template class elf::MipsReginfoInputSection<ELF32LE>;
576 template class elf::MipsReginfoInputSection<ELF32BE>;
577 template class elf::MipsReginfoInputSection<ELF64LE>;
578 template class elf::MipsReginfoInputSection<ELF64BE>;
579 
580 template class elf::MipsOptionsInputSection<ELF32LE>;
581 template class elf::MipsOptionsInputSection<ELF32BE>;
582 template class elf::MipsOptionsInputSection<ELF64LE>;
583 template class elf::MipsOptionsInputSection<ELF64BE>;
584