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