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 template <class ELFT>
139 static typename ELFT::uint
140 getSymVA(uint32_t Type, typename ELFT::uint A, typename ELFT::uint P,
141          const SymbolBody &Body, uint8_t *BufLoc,
142          const elf::ObjectFile<ELFT> &File, RelExpr Expr) {
143   typedef typename ELFT::uint uintX_t;
144   switch (Expr) {
145   case R_HINT:
146     llvm_unreachable("cannot relocate hint relocs");
147   case R_TLSLD:
148     return Out<ELFT>::Got->getTlsIndexOff() + A -
149            Out<ELFT>::Got->getNumEntries() * sizeof(uintX_t);
150   case R_TLSLD_PC:
151     return Out<ELFT>::Got->getTlsIndexVA() + A - P;
152   case R_THUNK:
153     return Body.getThunkVA<ELFT>();
154   case R_PPC_TOC:
155     return getPPC64TocBase() + A;
156   case R_TLSGD:
157     return Out<ELFT>::Got->getGlobalDynOffset(Body) + A -
158            Out<ELFT>::Got->getNumEntries() * sizeof(uintX_t);
159   case R_TLSGD_PC:
160     return Out<ELFT>::Got->getGlobalDynAddr(Body) + A - P;
161   case R_PLT:
162     return Body.getPltVA<ELFT>() + A;
163   case R_PLT_PC:
164   case R_PPC_PLT_OPD:
165     return Body.getPltVA<ELFT>() + A - P;
166   case R_SIZE:
167     return Body.getSize<ELFT>() + A;
168   case R_GOTREL:
169     return Body.getVA<ELFT>(A) - Out<ELFT>::Got->getVA();
170   case R_GOT_FROM_END:
171     return Body.getGotOffset<ELFT>() + A -
172            Out<ELFT>::Got->getNumEntries() * sizeof(uintX_t);
173   case R_GOT:
174   case R_RELAX_TLS_GD_TO_IE:
175     return Body.getGotVA<ELFT>() + A;
176   case R_GOT_PAGE_PC:
177     return getAArch64Page(Body.getGotVA<ELFT>() + A) - getAArch64Page(P);
178   case R_GOT_PC:
179   case R_RELAX_TLS_GD_TO_IE_PC:
180     return Body.getGotVA<ELFT>() + A - P;
181   case R_GOTONLY_PC:
182     return Out<ELFT>::Got->getVA() + A - P;
183   case R_TLS:
184     return Body.getVA<ELFT>(A) - Out<ELFT>::TlsPhdr->p_memsz;
185   case R_NEG_TLS:
186     return Out<ELF32LE>::TlsPhdr->p_memsz - Body.getVA<ELFT>(A);
187   case R_ABS:
188   case R_RELAX_TLS_GD_TO_LE:
189   case R_RELAX_TLS_IE_TO_LE:
190   case R_RELAX_TLS_LD_TO_LE:
191     return Body.getVA<ELFT>(A);
192   case R_GOT_OFF:
193     return Body.getGotOffset<ELFT>() + A;
194   case R_MIPS_GOT_LOCAL:
195     // If relocation against MIPS local symbol requires GOT entry, this entry
196     // should be initialized by 'page address'. This address is high 16-bits
197     // of sum the symbol's value and the addend.
198     return Out<ELFT>::Got->getMipsLocalPageOffset(Body.getVA<ELFT>(A));
199   case R_MIPS_GOT:
200     // For non-local symbols GOT entries should contain their full
201     // addresses. But if such symbol cannot be preempted, we do not
202     // have to put them into the "global" part of GOT and use dynamic
203     // linker to determine their actual addresses. That is why we
204     // create GOT entries for them in the "local" part of GOT.
205     return Out<ELFT>::Got->getMipsLocalEntryOffset(Body.getVA<ELFT>(A));
206   case R_PPC_OPD: {
207     uint64_t SymVA = Body.getVA<ELFT>(A);
208     // If we have an undefined weak symbol, we might get here with a symbol
209     // address of zero. That could overflow, but the code must be unreachable,
210     // so don't bother doing anything at all.
211     if (!SymVA)
212       return 0;
213     if (Out<ELF64BE>::Opd) {
214       // If this is a local call, and we currently have the address of a
215       // function-descriptor, get the underlying code address instead.
216       uint64_t OpdStart = Out<ELF64BE>::Opd->getVA();
217       uint64_t OpdEnd = OpdStart + Out<ELF64BE>::Opd->getSize();
218       bool InOpd = OpdStart <= SymVA && SymVA < OpdEnd;
219       if (InOpd)
220         SymVA = read64be(&Out<ELF64BE>::OpdBuf[SymVA - OpdStart]);
221     }
222     return SymVA - P;
223   }
224   case R_PC:
225     return Body.getVA<ELFT>(A) - P;
226   case R_PAGE_PC:
227     return getAArch64Page(Body.getVA<ELFT>(A)) - getAArch64Page(P);
228   }
229   llvm_unreachable("Invalid expression");
230 }
231 
232 // This function applies relocations to sections without SHF_ALLOC bit.
233 // Such sections are never mapped to memory at runtime. Debug sections are
234 // an example. Relocations in non-alloc sections are much easier to
235 // handle than in allocated sections because it will never need complex
236 // treatement such as GOT or PLT (because at runtime no one refers them).
237 // So, we handle relocations for non-alloc sections directly in this
238 // function as a performance optimization.
239 template <class ELFT>
240 template <class RelTy>
241 void InputSection<ELFT>::relocateNonAlloc(uint8_t *Buf, ArrayRef<RelTy> Rels) {
242   const unsigned Bits = sizeof(uintX_t) * 8;
243   for (const RelTy &Rel : Rels) {
244     uint32_t Type = Rel.getType(Config->Mips64EL);
245     uintX_t Addend = getAddend<ELFT>(Rel);
246     if (!RelTy::IsRela)
247       Addend += Target->getImplicitAddend(Buf + Rel.r_offset, Type);
248 
249     SymbolBody &Sym = this->File->getRelocTargetSym(Rel);
250     if (Target->getRelExpr(Type, Sym) != R_ABS) {
251       error(this->getSectionName() + " has non-ABS reloc");
252       return;
253     }
254 
255     uintX_t Offset = this->getOffset(Rel.r_offset);
256     uint8_t *BufLoc = Buf + Offset;
257     uintX_t AddrLoc = this->OutSec->getVA() + Offset;
258     uint64_t SymVA = SignExtend64<Bits>(getSymVA<ELFT>(
259         Type, Addend, AddrLoc, Sym, BufLoc, *this->File, R_ABS));
260     Target->relocateOne(BufLoc, Type, SymVA);
261   }
262 }
263 
264 template <class ELFT>
265 void InputSectionBase<ELFT>::relocate(uint8_t *Buf, uint8_t *BufEnd) {
266   // scanReloc function in Writer.cpp constructs Relocations
267   // vector only for SHF_ALLOC'ed sections. For other sections,
268   // we handle relocations directly here.
269   auto *IS = dyn_cast<InputSection<ELFT>>(this);
270   if (IS && !(IS->Header->sh_flags & SHF_ALLOC)) {
271     for (const Elf_Shdr *RelSec : IS->RelocSections) {
272       if (RelSec->sh_type == SHT_RELA)
273         IS->relocateNonAlloc(Buf, IS->File->getObj().relas(RelSec));
274       else
275         IS->relocateNonAlloc(Buf, IS->File->getObj().rels(RelSec));
276     }
277     return;
278   }
279 
280   const unsigned Bits = sizeof(uintX_t) * 8;
281   for (const Relocation &Rel : Relocations) {
282     uintX_t Offset = Rel.Offset;
283     uint8_t *BufLoc = Buf + Offset;
284     uint32_t Type = Rel.Type;
285     uintX_t A = Rel.Addend;
286 
287     uintX_t AddrLoc = OutSec->getVA() + Offset;
288     RelExpr Expr = Rel.Expr;
289     uint64_t SymVA = SignExtend64<Bits>(
290         getSymVA<ELFT>(Type, A, AddrLoc, *Rel.Sym, BufLoc, *File, Expr));
291 
292     if (Expr == R_RELAX_TLS_IE_TO_LE) {
293       Target->relaxTlsIeToLe(BufLoc, Type, SymVA);
294       continue;
295     }
296     if (Expr == R_RELAX_TLS_LD_TO_LE) {
297       Target->relaxTlsLdToLe(BufLoc, Type, SymVA);
298       continue;
299     }
300     if (Expr == R_RELAX_TLS_GD_TO_LE) {
301       Target->relaxTlsGdToLe(BufLoc, Type, SymVA);
302       continue;
303     }
304     if (Expr == R_RELAX_TLS_GD_TO_IE_PC || Expr == R_RELAX_TLS_GD_TO_IE) {
305       Target->relaxTlsGdToIe(BufLoc, Type, SymVA);
306       continue;
307     }
308 
309     if (Expr == R_PPC_PLT_OPD) {
310       uint32_t Nop = 0x60000000;
311       if (BufLoc + 8 <= BufEnd && read32be(BufLoc + 4) == Nop)
312         write32be(BufLoc + 4, 0xe8410028); // ld %r2, 40(%r1)
313     }
314 
315     Target->relocateOne(BufLoc, Type, SymVA);
316   }
317 }
318 
319 template <class ELFT> void InputSection<ELFT>::writeTo(uint8_t *Buf) {
320   if (this->Header->sh_type == SHT_NOBITS)
321     return;
322   ELFFile<ELFT> &EObj = this->File->getObj();
323 
324   // If -r is given, then an InputSection may be a relocation section.
325   if (this->Header->sh_type == SHT_RELA) {
326     copyRelocations(Buf + OutSecOff, EObj.relas(this->Header));
327     return;
328   }
329   if (this->Header->sh_type == SHT_REL) {
330     copyRelocations(Buf + OutSecOff, EObj.rels(this->Header));
331     return;
332   }
333 
334   // Copy section contents from source object file to output file.
335   ArrayRef<uint8_t> Data = this->getSectionData();
336   memcpy(Buf + OutSecOff, Data.data(), Data.size());
337 
338   // Iterate over all relocation sections that apply to this section.
339   uint8_t *BufEnd = Buf + OutSecOff + Data.size();
340   this->relocate(Buf, BufEnd);
341 
342   // The section might have a data/code generated by the linker and need
343   // to be written after the section. Usually these are thunks - small piece
344   // of code used to jump between "incompatible" functions like PIC and non-PIC
345   // or if the jump target too far and its address does not fit to the short
346   // jump istruction.
347   if (!Thunks.empty()) {
348     Buf += OutSecOff + getThunkOff();
349     for (const SymbolBody *S : Thunks) {
350       Target->writeThunk(Buf, S->getVA<ELFT>());
351       Buf += Target->ThunkSize;
352     }
353   }
354 }
355 
356 template <class ELFT>
357 void InputSection<ELFT>::replace(InputSection<ELFT> *Other) {
358   this->Align = std::max(this->Align, Other->Align);
359   Other->Repl = this->Repl;
360   Other->Live = false;
361 }
362 
363 template <class ELFT>
364 SplitInputSection<ELFT>::SplitInputSection(
365     elf::ObjectFile<ELFT> *File, const Elf_Shdr *Header,
366     typename InputSectionBase<ELFT>::Kind SectionKind)
367     : InputSectionBase<ELFT>(File, Header, SectionKind) {}
368 
369 template <class ELFT>
370 EHInputSection<ELFT>::EHInputSection(elf::ObjectFile<ELFT> *F,
371                                      const Elf_Shdr *Header)
372     : SplitInputSection<ELFT>(F, Header, InputSectionBase<ELFT>::EHFrame) {
373   // Mark .eh_frame sections as live by default because there are
374   // usually no relocations that point to .eh_frames. Otherwise,
375   // the garbage collector would drop all .eh_frame sections.
376   this->Live = true;
377 }
378 
379 template <class ELFT>
380 bool EHInputSection<ELFT>::classof(const InputSectionBase<ELFT> *S) {
381   return S->SectionKind == InputSectionBase<ELFT>::EHFrame;
382 }
383 
384 template <class ELFT>
385 typename ELFT::uint EHInputSection<ELFT>::getOffset(uintX_t Offset) {
386   // The file crtbeginT.o has relocations pointing to the start of an empty
387   // .eh_frame that is known to be the first in the link. It does that to
388   // identify the start of the output .eh_frame. Handle this special case.
389   if (this->getSectionHdr()->sh_size == 0)
390     return Offset;
391   std::pair<uintX_t, uintX_t> *I = this->getRangeAndSize(Offset).first;
392   uintX_t Base = I->second;
393   if (Base == uintX_t(-1))
394     return -1; // Not in the output
395 
396   uintX_t Addend = Offset - I->first;
397   return Base + Addend;
398 }
399 
400 static size_t findNull(StringRef S, size_t EntSize) {
401   // Optimize the common case.
402   if (EntSize == 1)
403     return S.find(0);
404 
405   for (unsigned I = 0, N = S.size(); I != N; I += EntSize) {
406     const char *B = S.begin() + I;
407     if (std::all_of(B, B + EntSize, [](char C) { return C == 0; }))
408       return I;
409   }
410   return StringRef::npos;
411 }
412 
413 template <class ELFT>
414 MergeInputSection<ELFT>::MergeInputSection(elf::ObjectFile<ELFT> *F,
415                                            const Elf_Shdr *Header)
416     : SplitInputSection<ELFT>(F, Header, InputSectionBase<ELFT>::Merge) {
417   uintX_t EntSize = Header->sh_entsize;
418   ArrayRef<uint8_t> D = this->getSectionData();
419   StringRef Data((const char *)D.data(), D.size());
420   std::vector<std::pair<uintX_t, uintX_t>> &Offsets = this->Offsets;
421 
422   uintX_t V = Config->GcSections ? MergeInputSection<ELFT>::PieceDead
423                                  : MergeInputSection<ELFT>::PieceLive;
424   if (Header->sh_flags & SHF_STRINGS) {
425     uintX_t Offset = 0;
426     while (!Data.empty()) {
427       size_t End = findNull(Data, EntSize);
428       if (End == StringRef::npos)
429         fatal("string is not null terminated");
430       Offsets.push_back(std::make_pair(Offset, V));
431       uintX_t Size = End + EntSize;
432       Data = Data.substr(Size);
433       Offset += Size;
434     }
435     return;
436   }
437 
438   // If this is not of type string, every entry has the same size.
439   size_t Size = Data.size();
440   assert((Size % EntSize) == 0);
441   for (unsigned I = 0, N = Size; I != N; I += EntSize)
442     Offsets.push_back(std::make_pair(I, V));
443 }
444 
445 template <class ELFT>
446 bool MergeInputSection<ELFT>::classof(const InputSectionBase<ELFT> *S) {
447   return S->SectionKind == InputSectionBase<ELFT>::Merge;
448 }
449 
450 template <class ELFT>
451 std::pair<std::pair<typename ELFT::uint, typename ELFT::uint> *,
452           typename ELFT::uint>
453 SplitInputSection<ELFT>::getRangeAndSize(uintX_t Offset) {
454   ArrayRef<uint8_t> D = this->getSectionData();
455   StringRef Data((const char *)D.data(), D.size());
456   uintX_t Size = Data.size();
457   if (Offset >= Size)
458     fatal("entry is past the end of the section");
459 
460   // Find the element this offset points to.
461   auto I = std::upper_bound(
462       Offsets.begin(), Offsets.end(), Offset,
463       [](const uintX_t &A, const std::pair<uintX_t, uintX_t> &B) {
464         return A < B.first;
465       });
466   uintX_t End = I == Offsets.end() ? Data.size() : I->first;
467   --I;
468   return std::make_pair(&*I, End);
469 }
470 
471 template <class ELFT>
472 typename ELFT::uint MergeInputSection<ELFT>::getOffset(uintX_t Offset) {
473   std::pair<std::pair<uintX_t, uintX_t> *, uintX_t> T =
474       this->getRangeAndSize(Offset);
475   std::pair<uintX_t, uintX_t> *I = T.first;
476   uintX_t End = T.second;
477   uintX_t Start = I->first;
478 
479   // Compute the Addend and if the Base is cached, return.
480   uintX_t Addend = Offset - Start;
481   uintX_t &Base = I->second;
482   assert(Base != MergeInputSection<ELFT>::PieceDead);
483   if (Base != MergeInputSection<ELFT>::PieceLive)
484     return Base + Addend;
485 
486   // Map the base to the offset in the output section and cache it.
487   ArrayRef<uint8_t> D = this->getSectionData();
488   StringRef Data((const char *)D.data(), D.size());
489   StringRef Entry = Data.substr(Start, End - Start);
490   auto *MOS = static_cast<MergeOutputSection<ELFT> *>(this->OutSec);
491   Base = MOS->getOffset(Entry);
492   return Base + Addend;
493 }
494 
495 template <class ELFT>
496 MipsReginfoInputSection<ELFT>::MipsReginfoInputSection(elf::ObjectFile<ELFT> *F,
497                                                        const Elf_Shdr *Hdr)
498     : InputSectionBase<ELFT>(F, Hdr, InputSectionBase<ELFT>::MipsReginfo) {
499   // Initialize this->Reginfo.
500   ArrayRef<uint8_t> D = this->getSectionData();
501   if (D.size() != sizeof(Elf_Mips_RegInfo<ELFT>)) {
502     error("invalid size of .reginfo section");
503     return;
504   }
505   Reginfo = reinterpret_cast<const Elf_Mips_RegInfo<ELFT> *>(D.data());
506 }
507 
508 template <class ELFT>
509 bool MipsReginfoInputSection<ELFT>::classof(const InputSectionBase<ELFT> *S) {
510   return S->SectionKind == InputSectionBase<ELFT>::MipsReginfo;
511 }
512 
513 template <class ELFT>
514 MipsOptionsInputSection<ELFT>::MipsOptionsInputSection(elf::ObjectFile<ELFT> *F,
515                                                        const Elf_Shdr *Hdr)
516     : InputSectionBase<ELFT>(F, Hdr, InputSectionBase<ELFT>::MipsOptions) {
517   // Find ODK_REGINFO option in the section's content.
518   ArrayRef<uint8_t> D = this->getSectionData();
519   while (!D.empty()) {
520     if (D.size() < sizeof(Elf_Mips_Options<ELFT>)) {
521       error("invalid size of .MIPS.options section");
522       break;
523     }
524     auto *O = reinterpret_cast<const Elf_Mips_Options<ELFT> *>(D.data());
525     if (O->kind == ODK_REGINFO) {
526       Reginfo = &O->getRegInfo();
527       break;
528     }
529     D = D.slice(O->size);
530   }
531 }
532 
533 template <class ELFT>
534 bool MipsOptionsInputSection<ELFT>::classof(const InputSectionBase<ELFT> *S) {
535   return S->SectionKind == InputSectionBase<ELFT>::MipsOptions;
536 }
537 
538 template class elf::InputSectionBase<ELF32LE>;
539 template class elf::InputSectionBase<ELF32BE>;
540 template class elf::InputSectionBase<ELF64LE>;
541 template class elf::InputSectionBase<ELF64BE>;
542 
543 template class elf::InputSection<ELF32LE>;
544 template class elf::InputSection<ELF32BE>;
545 template class elf::InputSection<ELF64LE>;
546 template class elf::InputSection<ELF64BE>;
547 
548 template class elf::SplitInputSection<ELF32LE>;
549 template class elf::SplitInputSection<ELF32BE>;
550 template class elf::SplitInputSection<ELF64LE>;
551 template class elf::SplitInputSection<ELF64BE>;
552 
553 template class elf::EHInputSection<ELF32LE>;
554 template class elf::EHInputSection<ELF32BE>;
555 template class elf::EHInputSection<ELF64LE>;
556 template class elf::EHInputSection<ELF64BE>;
557 
558 template class elf::MergeInputSection<ELF32LE>;
559 template class elf::MergeInputSection<ELF32BE>;
560 template class elf::MergeInputSection<ELF64LE>;
561 template class elf::MergeInputSection<ELF64BE>;
562 
563 template class elf::MipsReginfoInputSection<ELF32LE>;
564 template class elf::MipsReginfoInputSection<ELF32BE>;
565 template class elf::MipsReginfoInputSection<ELF64LE>;
566 template class elf::MipsReginfoInputSection<ELF64BE>;
567 
568 template class elf::MipsOptionsInputSection<ELF32LE>;
569 template class elf::MipsOptionsInputSection<ELF32BE>;
570 template class elf::MipsOptionsInputSection<ELF64LE>;
571 template class elf::MipsOptionsInputSection<ELF64BE>;
572