blob: 1b45ec7a5592bc8f75b2e22a13dac70aafa0c21c [file] [log] [blame]
Rafael Espindola9d06ab62015-09-22 00:01:39 +00001//===- InputSection.cpp ---------------------------------------------------===//
Michael J. Spencer84487f12015-07-24 21:03:07 +00002//
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
Rafael Espindola9d06ab62015-09-22 00:01:39 +000010#include "InputSection.h"
Rafael Espindola551dfd82015-09-25 19:24:57 +000011#include "Config.h"
Rafael Espindola192e1fa2015-08-06 15:08:23 +000012#include "Error.h"
Michael J. Spencer67bc8d62015-08-27 23:15:56 +000013#include "InputFiles.h"
Rafael Espindola4ea00212015-09-21 22:01:00 +000014#include "OutputSections.h"
Rafael Espindola01205f72015-09-22 18:19:46 +000015#include "Target.h"
Rafael Espindola4ea00212015-09-21 22:01:00 +000016
Michael J. Spencer84487f12015-07-24 21:03:07 +000017using namespace llvm;
18using namespace llvm::ELF;
Rafael Espindola4ea00212015-09-21 22:01:00 +000019using namespace llvm::object;
Michael J. Spencer84487f12015-07-24 21:03:07 +000020
21using namespace lld;
22using namespace lld::elf2;
23
24template <class ELFT>
Rafael Espindolac159c962015-10-19 21:00:02 +000025InputSectionBase<ELFT>::InputSectionBase(ObjectFile<ELFT> *File,
26 const Elf_Shdr *Header,
27 Kind SectionKind)
28 : Header(Header), File(File), SectionKind(SectionKind) {}
29
30template <class ELFT> StringRef InputSectionBase<ELFT>::getSectionName() const {
31 ErrorOr<StringRef> Name = File->getObj().getSectionName(this->Header);
32 error(Name);
33 return *Name;
34}
35
36template <class ELFT>
37ArrayRef<uint8_t> InputSectionBase<ELFT>::getSectionData() const {
38 ErrorOr<ArrayRef<uint8_t>> Ret =
39 this->File->getObj().getSectionContents(this->Header);
40 error(Ret);
41 return *Ret;
42}
43
44template <class ELFT>
45typename ELFFile<ELFT>::uintX_t
Rafael Espindoladb9bf4d2015-11-11 16:50:37 +000046InputSectionBase<ELFT>::getOffset(uintX_t Offset) {
47 switch (SectionKind) {
48 case Regular:
49 return cast<InputSection<ELFT>>(this)->OutSecOff + Offset;
Rafael Espindola0c6a4f12015-11-11 19:54:14 +000050 case EHFrame:
51 return cast<EHInputSection<ELFT>>(this)->getOffset(Offset);
Rafael Espindoladb9bf4d2015-11-11 16:50:37 +000052 case Merge:
53 return cast<MergeInputSection<ELFT>>(this)->getOffset(Offset);
Simon Atanasyan1d7df402015-12-20 10:57:34 +000054 case MipsReginfo:
55 return cast<MipsReginfoInputSection<ELFT>>(this)->getOffset(Offset);
Rafael Espindoladb9bf4d2015-11-11 16:50:37 +000056 }
Denis Protivensky1b1b34e2015-11-12 09:11:20 +000057 llvm_unreachable("Invalid section kind");
Rafael Espindoladb9bf4d2015-11-11 16:50:37 +000058}
59
60template <class ELFT>
61typename ELFFile<ELFT>::uintX_t
Rafael Espindola48225b42015-10-23 19:55:11 +000062InputSectionBase<ELFT>::getOffset(const Elf_Sym &Sym) {
Rafael Espindoladb9bf4d2015-11-11 16:50:37 +000063 return getOffset(Sym.st_value);
Rafael Espindolac159c962015-10-19 21:00:02 +000064}
65
Rui Ueyama12504642015-10-27 21:51:13 +000066// Returns a section that Rel relocation is pointing to.
67template <class ELFT>
68InputSectionBase<ELFT> *
69InputSectionBase<ELFT>::getRelocTarget(const Elf_Rel &Rel) {
70 // Global symbol
71 uint32_t SymIndex = Rel.getSymbol(Config->Mips64EL);
72 if (SymbolBody *B = File->getSymbolBody(SymIndex))
73 if (auto *D = dyn_cast<DefinedRegular<ELFT>>(B->repl()))
Rafael Espindola02ce26a2015-12-24 14:22:24 +000074 return D->Section;
Rui Ueyama12504642015-10-27 21:51:13 +000075 // Local symbol
76 if (const Elf_Sym *Sym = File->getLocalSymbol(SymIndex))
77 if (InputSectionBase<ELFT> *Sec = File->getSection(*Sym))
78 return Sec;
79 return nullptr;
80}
81
82template <class ELFT>
83InputSectionBase<ELFT> *
84InputSectionBase<ELFT>::getRelocTarget(const Elf_Rela &Rel) {
85 return getRelocTarget(reinterpret_cast<const Elf_Rel &>(Rel));
86}
87
Rafael Espindolac159c962015-10-19 21:00:02 +000088template <class ELFT>
Rafael Espindola53d5cea2015-09-21 17:47:00 +000089InputSection<ELFT>::InputSection(ObjectFile<ELFT> *F, const Elf_Shdr *Header)
Rafael Espindolac159c962015-10-19 21:00:02 +000090 : InputSectionBase<ELFT>(F, Header, Base::Regular) {}
91
92template <class ELFT>
93bool InputSection<ELFT>::classof(const InputSectionBase<ELFT> *S) {
94 return S->SectionKind == Base::Regular;
95}
Michael J. Spencer84487f12015-07-24 21:03:07 +000096
Rafael Espindola4ea00212015-09-21 22:01:00 +000097template <class ELFT>
Rafael Espindola4ea00212015-09-21 22:01:00 +000098template <bool isRela>
Simon Atanasyan09b3e362015-12-01 21:24:45 +000099uint8_t *
Simon Atanasyandddbeb72015-12-13 06:49:08 +0000100InputSectionBase<ELFT>::findMipsPairedReloc(uint8_t *Buf, uint32_t SymIndex,
101 uint32_t Type,
Simon Atanasyan09b3e362015-12-01 21:24:45 +0000102 RelIteratorRange<isRela> Rels) {
103 // Some MIPS relocations use addend calculated from addend of the relocation
104 // itself and addend of paired relocation. ABI requires to compute such
105 // combined addend in case of REL relocation record format only.
106 // See p. 4-17 at ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf
107 if (isRela || Config->EMachine != EM_MIPS)
108 return nullptr;
109 if (Type == R_MIPS_HI16)
110 Type = R_MIPS_LO16;
111 else if (Type == R_MIPS_PCHI16)
112 Type = R_MIPS_PCLO16;
113 else if (Type == R_MICROMIPS_HI16)
114 Type = R_MICROMIPS_LO16;
115 else
116 return nullptr;
117 for (const auto &RI : Rels) {
118 if (RI.getType(Config->Mips64EL) != Type)
119 continue;
Simon Atanasyandddbeb72015-12-13 06:49:08 +0000120 if (RI.getSymbol(Config->Mips64EL) != SymIndex)
121 continue;
Simon Atanasyan09b3e362015-12-01 21:24:45 +0000122 uintX_t Offset = getOffset(RI.r_offset);
123 if (Offset == (uintX_t)-1)
124 return nullptr;
125 return Buf + Offset;
126 }
127 return nullptr;
128}
129
130template <class ELFT>
George Rimar48651482015-12-11 08:59:37 +0000131static typename llvm::object::ELFFile<ELFT>::uintX_t
132getSymSize(SymbolBody &Body) {
Rafael Espindola4d4b06a2015-12-24 00:47:42 +0000133 if (auto *SS = dyn_cast<DefinedElf<ELFT>>(&Body))
George Rimar48651482015-12-11 08:59:37 +0000134 return SS->Sym.st_size;
135 return 0;
136}
137
138template <class ELFT>
Simon Atanasyan09b3e362015-12-01 21:24:45 +0000139template <bool isRela>
140void InputSectionBase<ELFT>::relocate(uint8_t *Buf, uint8_t *BufEnd,
141 RelIteratorRange<isRela> Rels) {
Rafael Espindola4ea00212015-09-21 22:01:00 +0000142 typedef Elf_Rel_Impl<ELFT, isRela> RelType;
George Rimar6713cf82015-11-25 21:46:05 +0000143 size_t Num = Rels.end() - Rels.begin();
144 for (size_t I = 0; I < Num; ++I) {
145 const RelType &RI = *(Rels.begin() + I);
Rui Ueyama64558522015-10-16 22:51:43 +0000146 uint32_t SymIndex = RI.getSymbol(Config->Mips64EL);
147 uint32_t Type = RI.getType(Config->Mips64EL);
Rafael Espindola0c6a4f12015-11-11 19:54:14 +0000148 uintX_t Offset = getOffset(RI.r_offset);
149 if (Offset == (uintX_t)-1)
150 continue;
151
152 uint8_t *BufLoc = Buf + Offset;
153 uintX_t AddrLoc = OutSec->getVA() + Offset;
Simon Atanasyan09b3e362015-12-01 21:24:45 +0000154 auto NextRelocs = llvm::make_range(&RI, Rels.end());
Michael J. Spencer1e225612015-11-11 01:00:24 +0000155
George Rimar6713cf82015-11-25 21:46:05 +0000156 if (Target->isTlsLocalDynamicReloc(Type) &&
157 !Target->isTlsOptimized(Type, nullptr)) {
Michael J. Spencer1e225612015-11-11 01:00:24 +0000158 Target->relocateOne(BufLoc, BufEnd, Type, AddrLoc,
George Rimarb17f7392015-12-01 18:24:07 +0000159 Out<ELFT>::Got->getLocalTlsIndexVA() +
Michael J. Spencer1e225612015-11-11 01:00:24 +0000160 getAddend<ELFT>(RI));
161 continue;
162 }
Rafael Espindola4ea00212015-09-21 22:01:00 +0000163
George Rimar0b8ed1d2015-12-21 10:37:33 +0000164 const Elf_Shdr *SymTab = File->getSymbolTable();
165 SymbolBody *Body = nullptr;
166 if (SymIndex >= SymTab->sh_info)
167 Body = File->getSymbolBody(SymIndex)->repl();
168
169 if (Target->isTlsOptimized(Type, Body)) {
170 uintX_t SymVA;
171 if (!Body)
172 SymVA = getLocalRelTarget(*File, RI, 0);
173 else if (Target->relocNeedsGot(Type, *Body))
174 SymVA = Out<ELFT>::Got->getEntryAddr(*Body);
175 else
176 SymVA = getSymVA<ELFT>(*Body);
177 // By optimizing TLS relocations, it is sometimes needed to skip
178 // relocations that immediately follow TLS relocations. This function
179 // knows how many slots we need to skip.
180 I += Target->relocateTlsOptimize(BufLoc, BufEnd, Type, AddrLoc, SymVA,
181 *Body);
182 continue;
183 }
184
Rafael Espindola4ea00212015-09-21 22:01:00 +0000185 // Handle relocations for local symbols -- they never get
186 // resolved so we don't allocate a SymbolBody.
George Rimar0b8ed1d2015-12-21 10:37:33 +0000187 uintX_t A = getAddend<ELFT>(RI);
188 if (!Body) {
189 uintX_t SymVA = getLocalRelTarget(*File, RI, A);
George Rimar48651482015-12-11 08:59:37 +0000190 Target->relocateOne(BufLoc, BufEnd, Type, AddrLoc, SymVA, 0,
Simon Atanasyandddbeb72015-12-13 06:49:08 +0000191 findMipsPairedReloc(Buf, SymIndex, Type, NextRelocs));
Rui Ueyamabb3c3362015-10-12 20:28:23 +0000192 continue;
Rafael Espindola4ea00212015-09-21 22:01:00 +0000193 }
194
George Rimar6713cf82015-11-25 21:46:05 +0000195 if (Target->isTlsGlobalDynamicReloc(Type) &&
George Rimar0b8ed1d2015-12-21 10:37:33 +0000196 !Target->isTlsOptimized(Type, Body)) {
Michael J. Spencer627ae702015-11-13 00:28:34 +0000197 Target->relocateOne(BufLoc, BufEnd, Type, AddrLoc,
George Rimar0b8ed1d2015-12-21 10:37:33 +0000198 Out<ELFT>::Got->getGlobalDynAddr(*Body) +
Michael J. Spencer627ae702015-11-13 00:28:34 +0000199 getAddend<ELFT>(RI));
200 continue;
201 }
202
George Rimar0b8ed1d2015-12-21 10:37:33 +0000203 uintX_t SymVA = getSymVA<ELFT>(*Body);
204 if (Target->relocNeedsPlt(Type, *Body)) {
205 SymVA = Out<ELFT>::Plt->getEntryAddr(*Body);
Igor Kudrine7ad0932015-11-17 17:47:53 +0000206 Type = Target->getPltRefReloc(Type);
George Rimar0b8ed1d2015-12-21 10:37:33 +0000207 } else if (Target->relocNeedsGot(Type, *Body)) {
208 SymVA = Out<ELFT>::Got->getEntryAddr(*Body);
209 if (Body->isTls())
George Rimar6f17e092015-12-17 09:32:21 +0000210 Type = Target->getTlsGotReloc(Type);
George Rimar0b8ed1d2015-12-21 10:37:33 +0000211 } else if (!Target->needsCopyRel(Type, *Body) &&
212 isa<SharedSymbol<ELFT>>(*Body)) {
Rui Ueyamabb3c3362015-10-12 20:28:23 +0000213 continue;
George Rimar0b8ed1d2015-12-21 10:37:33 +0000214 } else if (Target->isTlsDynReloc(Type, *Body) ||
215 Target->isSizeDynReloc(Type, *Body)) {
George Rimard23970f2015-11-25 20:41:53 +0000216 continue;
Simon Atanasyan09dae7c2015-12-16 14:45:09 +0000217 } else if (Config->EMachine == EM_MIPS) {
George Rimar0b8ed1d2015-12-21 10:37:33 +0000218 if (Type == R_MIPS_HI16 && Body == Config->MipsGpDisp)
Simon Atanasyan09dae7c2015-12-16 14:45:09 +0000219 SymVA = getMipsGpAddr<ELFT>() - AddrLoc;
George Rimar0b8ed1d2015-12-21 10:37:33 +0000220 else if (Type == R_MIPS_LO16 && Body == Config->MipsGpDisp)
Simon Atanasyan09dae7c2015-12-16 14:45:09 +0000221 SymVA = getMipsGpAddr<ELFT>() - AddrLoc + 4;
Rui Ueyamabb3c3362015-10-12 20:28:23 +0000222 }
George Rimar0b8ed1d2015-12-21 10:37:33 +0000223 uintX_t Size = getSymSize<ELFT>(*Body);
George Rimar48651482015-12-11 08:59:37 +0000224 Target->relocateOne(BufLoc, BufEnd, Type, AddrLoc, SymVA + A, Size + A,
Simon Atanasyandddbeb72015-12-13 06:49:08 +0000225 findMipsPairedReloc(Buf, SymIndex, Type, NextRelocs));
Rafael Espindola4ea00212015-09-21 22:01:00 +0000226 }
227}
228
Rui Ueyama15ef5e12015-10-07 19:18:16 +0000229template <class ELFT> void InputSection<ELFT>::writeTo(uint8_t *Buf) {
Rafael Espindolac159c962015-10-19 21:00:02 +0000230 if (this->Header->sh_type == SHT_NOBITS)
Michael J. Spencer84487f12015-07-24 21:03:07 +0000231 return;
232 // Copy section contents from source object file to output file.
Rafael Espindolac159c962015-10-19 21:00:02 +0000233 ArrayRef<uint8_t> Data = this->getSectionData();
Rui Ueyama55c3f892015-10-15 01:58:40 +0000234 memcpy(Buf + OutSecOff, Data.data(), Data.size());
Rafael Espindola4ea00212015-09-21 22:01:00 +0000235
Rafael Espindolac159c962015-10-19 21:00:02 +0000236 ELFFile<ELFT> &EObj = this->File->getObj();
Rafael Espindola0c6a4f12015-11-11 19:54:14 +0000237 uint8_t *BufEnd = Buf + OutSecOff + Data.size();
Rafael Espindola4ea00212015-09-21 22:01:00 +0000238 // Iterate over all relocation sections that apply to this section.
Rafael Espindola0c6a4f12015-11-11 19:54:14 +0000239 for (const Elf_Shdr *RelSec : this->RelocSections) {
Rafael Espindola4ea00212015-09-21 22:01:00 +0000240 if (RelSec->sh_type == SHT_RELA)
Rafael Espindola0c6a4f12015-11-11 19:54:14 +0000241 this->relocate(Buf, BufEnd, EObj.relas(RelSec));
Rafael Espindola4ea00212015-09-21 22:01:00 +0000242 else
Rafael Espindola0c6a4f12015-11-11 19:54:14 +0000243 this->relocate(Buf, BufEnd, EObj.rels(RelSec));
Rafael Espindola4ea00212015-09-21 22:01:00 +0000244 }
Michael J. Spencer84487f12015-07-24 21:03:07 +0000245}
246
Rafael Espindolac159c962015-10-19 21:00:02 +0000247template <class ELFT>
Rafael Espindola0c6a4f12015-11-11 19:54:14 +0000248SplitInputSection<ELFT>::SplitInputSection(
249 ObjectFile<ELFT> *File, const Elf_Shdr *Header,
250 typename InputSectionBase<ELFT>::Kind SectionKind)
251 : InputSectionBase<ELFT>(File, Header, SectionKind) {}
252
253template <class ELFT>
254EHInputSection<ELFT>::EHInputSection(ObjectFile<ELFT> *F,
255 const Elf_Shdr *Header)
Rui Ueyamada735322015-12-24 10:08:54 +0000256 : SplitInputSection<ELFT>(F, Header, InputSectionBase<ELFT>::EHFrame) {
257 // Mark .eh_frame sections as live by default because there are
258 // usually no relocations that point to .eh_frames. Otherwise,
259 // the garbage collector would drop all .eh_frame sections.
260 this->Live = true;
261}
Rafael Espindola0c6a4f12015-11-11 19:54:14 +0000262
263template <class ELFT>
264bool EHInputSection<ELFT>::classof(const InputSectionBase<ELFT> *S) {
265 return S->SectionKind == InputSectionBase<ELFT>::EHFrame;
266}
267
268template <class ELFT>
269typename EHInputSection<ELFT>::uintX_t
270EHInputSection<ELFT>::getOffset(uintX_t Offset) {
George Rimar6ab275c2015-12-25 09:51:42 +0000271 // The file crtbeginT.o has relocations pointing to the start of an empty
272 // .eh_frame that is known to be the first in the link. It does that to
273 // identify the start of the output .eh_frame. Handle this special case.
274 if (this->getSectionHdr()->sh_size == 0)
275 return Offset;
Rafael Espindola0c6a4f12015-11-11 19:54:14 +0000276 std::pair<uintX_t, uintX_t> *I = this->getRangeAndSize(Offset).first;
277 uintX_t Base = I->second;
George Rimar4b40ebc2015-11-13 13:44:59 +0000278 if (Base == uintX_t(-1))
Rafael Espindola0c6a4f12015-11-11 19:54:14 +0000279 return -1; // Not in the output
280
281 uintX_t Addend = Offset - I->first;
282 return Base + Addend;
283}
284
285template <class ELFT>
Rafael Espindolac159c962015-10-19 21:00:02 +0000286MergeInputSection<ELFT>::MergeInputSection(ObjectFile<ELFT> *F,
287 const Elf_Shdr *Header)
Rafael Espindola0c6a4f12015-11-11 19:54:14 +0000288 : SplitInputSection<ELFT>(F, Header, InputSectionBase<ELFT>::Merge) {}
Rafael Espindolac159c962015-10-19 21:00:02 +0000289
290template <class ELFT>
291bool MergeInputSection<ELFT>::classof(const InputSectionBase<ELFT> *S) {
Rafael Espindola0c6a4f12015-11-11 19:54:14 +0000292 return S->SectionKind == InputSectionBase<ELFT>::Merge;
Rafael Espindolac159c962015-10-19 21:00:02 +0000293}
294
Rafael Espindolac159c962015-10-19 21:00:02 +0000295template <class ELFT>
Rafael Espindola0c6a4f12015-11-11 19:54:14 +0000296std::pair<std::pair<typename ELFFile<ELFT>::uintX_t,
297 typename ELFFile<ELFT>::uintX_t> *,
298 typename ELFFile<ELFT>::uintX_t>
299SplitInputSection<ELFT>::getRangeAndSize(uintX_t Offset) {
Rafael Espindolaf82ed2a2015-10-24 22:51:01 +0000300 ArrayRef<uint8_t> D = this->getSectionData();
Rui Ueyama7ba639b2015-10-25 16:25:04 +0000301 StringRef Data((const char *)D.data(), D.size());
Rafael Espindolaf82ed2a2015-10-24 22:51:01 +0000302 uintX_t Size = Data.size();
303 if (Offset >= Size)
Rafael Espindolac159c962015-10-19 21:00:02 +0000304 error("Entry is past the end of the section");
Rafael Espindolaf82ed2a2015-10-24 22:51:01 +0000305
306 // Find the element this offset points to.
307 auto I = std::upper_bound(
Rafael Espindolad04c12a2015-11-11 15:20:45 +0000308 Offsets.begin(), Offsets.end(), Offset,
Rafael Espindola1fe2d1e2015-11-11 15:55:00 +0000309 [](const uintX_t &A, const std::pair<uintX_t, uintX_t> &B) {
Rafael Espindolaf82ed2a2015-10-24 22:51:01 +0000310 return A < B.first;
311 });
Rafael Espindola32994992015-11-11 15:40:37 +0000312 uintX_t End = I == Offsets.end() ? Data.size() : I->first;
Rafael Espindolaf82ed2a2015-10-24 22:51:01 +0000313 --I;
Rafael Espindola0c6a4f12015-11-11 19:54:14 +0000314 return std::make_pair(&*I, End);
315}
316
317template <class ELFT>
318typename MergeInputSection<ELFT>::uintX_t
319MergeInputSection<ELFT>::getOffset(uintX_t Offset) {
George Rimar4b40ebc2015-11-13 13:44:59 +0000320 std::pair<std::pair<uintX_t, uintX_t> *, uintX_t> T =
Rafael Espindola0c6a4f12015-11-11 19:54:14 +0000321 this->getRangeAndSize(Offset);
322 std::pair<uintX_t, uintX_t> *I = T.first;
323 uintX_t End = T.second;
Rafael Espindolaf82ed2a2015-10-24 22:51:01 +0000324 uintX_t Start = I->first;
325
326 // Compute the Addend and if the Base is cached, return.
327 uintX_t Addend = Offset - Start;
Rafael Espindola32994992015-11-11 15:40:37 +0000328 uintX_t &Base = I->second;
Rafael Espindola1fe2d1e2015-11-11 15:55:00 +0000329 if (Base != uintX_t(-1))
Rafael Espindolaf82ed2a2015-10-24 22:51:01 +0000330 return Base + Addend;
331
Hal Finkelf9505952015-11-25 23:54:53 +0000332 // Map the base to the offset in the output section and cache it.
Rafael Espindola0c6a4f12015-11-11 19:54:14 +0000333 ArrayRef<uint8_t> D = this->getSectionData();
334 StringRef Data((const char *)D.data(), D.size());
Rafael Espindolaf82ed2a2015-10-24 22:51:01 +0000335 StringRef Entry = Data.substr(Start, End - Start);
336 Base =
337 static_cast<MergeOutputSection<ELFT> *>(this->OutSec)->getOffset(Entry);
338 return Base + Addend;
Rafael Espindola5d83ccd2015-08-13 19:18:30 +0000339}
340
Simon Atanasyan1d7df402015-12-20 10:57:34 +0000341template <class ELFT>
342MipsReginfoInputSection<ELFT>::MipsReginfoInputSection(ObjectFile<ELFT> *F,
343 const Elf_Shdr *Header)
344 : InputSectionBase<ELFT>(F, Header, InputSectionBase<ELFT>::MipsReginfo) {}
345
346template <class ELFT>
347uint32_t MipsReginfoInputSection<ELFT>::getGeneralMask() const {
348 ArrayRef<uint8_t> D = this->getSectionData();
349 if (D.size() != sizeof(Elf_Mips_RegInfo))
350 error("Invalid size of .reginfo section");
351 return reinterpret_cast<const Elf_Mips_RegInfo *>(D.data())->ri_gprmask;
352}
353
354template <class ELFT>
355bool MipsReginfoInputSection<ELFT>::classof(const InputSectionBase<ELFT> *S) {
356 return S->SectionKind == InputSectionBase<ELFT>::MipsReginfo;
357}
358
Michael J. Spencer84487f12015-07-24 21:03:07 +0000359namespace lld {
360namespace elf2 {
Rafael Espindolac159c962015-10-19 21:00:02 +0000361template class InputSectionBase<object::ELF32LE>;
362template class InputSectionBase<object::ELF32BE>;
363template class InputSectionBase<object::ELF64LE>;
364template class InputSectionBase<object::ELF64BE>;
365
Rafael Espindola53d5cea2015-09-21 17:47:00 +0000366template class InputSection<object::ELF32LE>;
367template class InputSection<object::ELF32BE>;
368template class InputSection<object::ELF64LE>;
369template class InputSection<object::ELF64BE>;
Rafael Espindolac159c962015-10-19 21:00:02 +0000370
Rafael Espindola0c6a4f12015-11-11 19:54:14 +0000371template class EHInputSection<object::ELF32LE>;
372template class EHInputSection<object::ELF32BE>;
373template class EHInputSection<object::ELF64LE>;
374template class EHInputSection<object::ELF64BE>;
375
Rafael Espindolac159c962015-10-19 21:00:02 +0000376template class MergeInputSection<object::ELF32LE>;
377template class MergeInputSection<object::ELF32BE>;
378template class MergeInputSection<object::ELF64LE>;
379template class MergeInputSection<object::ELF64BE>;
Simon Atanasyan1d7df402015-12-20 10:57:34 +0000380
381template class MipsReginfoInputSection<object::ELF32LE>;
382template class MipsReginfoInputSection<object::ELF32BE>;
383template class MipsReginfoInputSection<object::ELF64LE>;
384template class MipsReginfoInputSection<object::ELF64BE>;
Michael J. Spencer84487f12015-07-24 21:03:07 +0000385}
386}