| Rafael Espindola | 9d06ab6 | 2015-09-22 00:01:39 +0000 | [diff] [blame] | 1 | //===- InputSection.cpp ---------------------------------------------------===// | 
| Michael J. Spencer | 84487f1 | 2015-07-24 21:03:07 +0000 | [diff] [blame] | 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 |  | 
| Rafael Espindola | 9d06ab6 | 2015-09-22 00:01:39 +0000 | [diff] [blame] | 10 | #include "InputSection.h" | 
| Rafael Espindola | 551dfd8 | 2015-09-25 19:24:57 +0000 | [diff] [blame] | 11 | #include "Config.h" | 
| Rafael Espindola | 192e1fa | 2015-08-06 15:08:23 +0000 | [diff] [blame] | 12 | #include "Error.h" | 
| Michael J. Spencer | 67bc8d6 | 2015-08-27 23:15:56 +0000 | [diff] [blame] | 13 | #include "InputFiles.h" | 
| Rafael Espindola | 4ea0021 | 2015-09-21 22:01:00 +0000 | [diff] [blame] | 14 | #include "OutputSections.h" | 
| Rafael Espindola | 01205f7 | 2015-09-22 18:19:46 +0000 | [diff] [blame] | 15 | #include "Target.h" | 
| Rafael Espindola | 4ea0021 | 2015-09-21 22:01:00 +0000 | [diff] [blame] | 16 |  | 
| Simon Atanasyan | 860fbf0 | 2016-02-25 21:33:56 +0000 | [diff] [blame] | 17 | #include "llvm/Support/Endian.h" | 
|  | 18 |  | 
| Michael J. Spencer | 84487f1 | 2015-07-24 21:03:07 +0000 | [diff] [blame] | 19 | using namespace llvm; | 
|  | 20 | using namespace llvm::ELF; | 
| Rafael Espindola | 4ea0021 | 2015-09-21 22:01:00 +0000 | [diff] [blame] | 21 | using namespace llvm::object; | 
| Simon Atanasyan | 860fbf0 | 2016-02-25 21:33:56 +0000 | [diff] [blame] | 22 | using namespace llvm::support::endian; | 
| Michael J. Spencer | 84487f1 | 2015-07-24 21:03:07 +0000 | [diff] [blame] | 23 |  | 
|  | 24 | using namespace lld; | 
| Rafael Espindola | e0df00b | 2016-02-28 00:25:54 +0000 | [diff] [blame] | 25 | using namespace lld::elf; | 
| Michael J. Spencer | 84487f1 | 2015-07-24 21:03:07 +0000 | [diff] [blame] | 26 |  | 
|  | 27 | template <class ELFT> | 
| Rui Ueyama | f714955 | 2016-03-11 18:46:51 +0000 | [diff] [blame] | 28 | InputSectionBase<ELFT>::InputSectionBase(elf::ObjectFile<ELFT> *File, | 
| Rafael Espindola | c159c96 | 2015-10-19 21:00:02 +0000 | [diff] [blame] | 29 | const Elf_Shdr *Header, | 
|  | 30 | Kind SectionKind) | 
| Rui Ueyama | 0b28952 | 2016-02-25 18:43:51 +0000 | [diff] [blame] | 31 | : Header(Header), File(File), SectionKind(SectionKind), Repl(this) { | 
| Rui Ueyama | 8fc070d | 2016-02-24 00:23:15 +0000 | [diff] [blame] | 32 | // The garbage collector sets sections' Live bits. | 
|  | 33 | // If GC is disabled, all sections are considered live by default. | 
| Rui Ueyama | 733153d | 2016-02-24 18:33:35 +0000 | [diff] [blame] | 34 | Live = !Config->GcSections; | 
| Rui Ueyama | 5ac5891 | 2016-02-24 00:38:18 +0000 | [diff] [blame] | 35 |  | 
|  | 36 | // The ELF spec states that a value of 0 means the section has | 
|  | 37 | // no alignment constraits. | 
| Rui Ueyama | 733153d | 2016-02-24 18:33:35 +0000 | [diff] [blame] | 38 | Align = std::max<uintX_t>(Header->sh_addralign, 1); | 
| Rui Ueyama | 8fc070d | 2016-02-24 00:23:15 +0000 | [diff] [blame] | 39 | } | 
| Rafael Espindola | c159c96 | 2015-10-19 21:00:02 +0000 | [diff] [blame] | 40 |  | 
|  | 41 | template <class ELFT> StringRef InputSectionBase<ELFT>::getSectionName() const { | 
| Rafael Espindola | 75714f6 | 2016-03-03 22:24:39 +0000 | [diff] [blame] | 42 | return check(File->getObj().getSectionName(this->Header)); | 
| Rafael Espindola | c159c96 | 2015-10-19 21:00:02 +0000 | [diff] [blame] | 43 | } | 
|  | 44 |  | 
|  | 45 | template <class ELFT> | 
|  | 46 | ArrayRef<uint8_t> InputSectionBase<ELFT>::getSectionData() const { | 
| Rafael Espindola | 75714f6 | 2016-03-03 22:24:39 +0000 | [diff] [blame] | 47 | return check(this->File->getObj().getSectionContents(this->Header)); | 
| Rafael Espindola | c159c96 | 2015-10-19 21:00:02 +0000 | [diff] [blame] | 48 | } | 
|  | 49 |  | 
|  | 50 | template <class ELFT> | 
|  | 51 | typename ELFFile<ELFT>::uintX_t | 
| Rafael Espindola | db9bf4d | 2015-11-11 16:50:37 +0000 | [diff] [blame] | 52 | InputSectionBase<ELFT>::getOffset(uintX_t Offset) { | 
|  | 53 | switch (SectionKind) { | 
|  | 54 | case Regular: | 
|  | 55 | return cast<InputSection<ELFT>>(this)->OutSecOff + Offset; | 
| Rafael Espindola | 0c6a4f1 | 2015-11-11 19:54:14 +0000 | [diff] [blame] | 56 | case EHFrame: | 
|  | 57 | return cast<EHInputSection<ELFT>>(this)->getOffset(Offset); | 
| Rafael Espindola | db9bf4d | 2015-11-11 16:50:37 +0000 | [diff] [blame] | 58 | case Merge: | 
|  | 59 | return cast<MergeInputSection<ELFT>>(this)->getOffset(Offset); | 
| Simon Atanasyan | 1d7df40 | 2015-12-20 10:57:34 +0000 | [diff] [blame] | 60 | case MipsReginfo: | 
| Rui Ueyama | 58a636a | 2016-01-06 22:01:25 +0000 | [diff] [blame] | 61 | // MIPS .reginfo sections are consumed by the linker, | 
|  | 62 | // so it should never be copied to output. | 
|  | 63 | llvm_unreachable("MIPS .reginfo reached writeTo()."); | 
| Rafael Espindola | db9bf4d | 2015-11-11 16:50:37 +0000 | [diff] [blame] | 64 | } | 
| George Rimar | 777f963 | 2016-03-12 08:31:34 +0000 | [diff] [blame] | 65 | llvm_unreachable("invalid section kind"); | 
| Rafael Espindola | db9bf4d | 2015-11-11 16:50:37 +0000 | [diff] [blame] | 66 | } | 
|  | 67 |  | 
|  | 68 | template <class ELFT> | 
|  | 69 | typename ELFFile<ELFT>::uintX_t | 
| Rafael Espindola | 48225b4 | 2015-10-23 19:55:11 +0000 | [diff] [blame] | 70 | InputSectionBase<ELFT>::getOffset(const Elf_Sym &Sym) { | 
| Rafael Espindola | db9bf4d | 2015-11-11 16:50:37 +0000 | [diff] [blame] | 71 | return getOffset(Sym.st_value); | 
| Rafael Espindola | c159c96 | 2015-10-19 21:00:02 +0000 | [diff] [blame] | 72 | } | 
|  | 73 |  | 
| Rui Ueyama | 1250464 | 2015-10-27 21:51:13 +0000 | [diff] [blame] | 74 | // Returns a section that Rel relocation is pointing to. | 
|  | 75 | template <class ELFT> | 
|  | 76 | InputSectionBase<ELFT> * | 
| Rui Ueyama | d7e4a28 | 2016-02-24 00:23:13 +0000 | [diff] [blame] | 77 | InputSectionBase<ELFT>::getRelocTarget(const Elf_Rel &Rel) const { | 
| Rui Ueyama | 1250464 | 2015-10-27 21:51:13 +0000 | [diff] [blame] | 78 | // Global symbol | 
|  | 79 | uint32_t SymIndex = Rel.getSymbol(Config->Mips64EL); | 
| Rafael Espindola | 67d72c0 | 2016-03-11 12:06:30 +0000 | [diff] [blame] | 80 | SymbolBody &B = File->getSymbolBody(SymIndex).repl(); | 
| Rafael Espindola | 1f5b70f | 2016-03-11 14:21:37 +0000 | [diff] [blame] | 81 | InputSectionBase<ELFT> *S = nullptr; | 
| Rafael Espindola | 67d72c0 | 2016-03-11 12:06:30 +0000 | [diff] [blame] | 82 | if (auto *D = dyn_cast<DefinedRegular<ELFT>>(&B)) | 
| Rafael Espindola | 1f5b70f | 2016-03-11 14:21:37 +0000 | [diff] [blame] | 83 | S = D->Section; | 
|  | 84 | if (S) | 
|  | 85 | return S->Repl; | 
| Rui Ueyama | 1250464 | 2015-10-27 21:51:13 +0000 | [diff] [blame] | 86 | return nullptr; | 
|  | 87 | } | 
|  | 88 |  | 
|  | 89 | template <class ELFT> | 
|  | 90 | InputSectionBase<ELFT> * | 
| Rui Ueyama | d7e4a28 | 2016-02-24 00:23:13 +0000 | [diff] [blame] | 91 | InputSectionBase<ELFT>::getRelocTarget(const Elf_Rela &Rel) const { | 
| Rui Ueyama | 1250464 | 2015-10-27 21:51:13 +0000 | [diff] [blame] | 92 | return getRelocTarget(reinterpret_cast<const Elf_Rel &>(Rel)); | 
|  | 93 | } | 
|  | 94 |  | 
| Rafael Espindola | c159c96 | 2015-10-19 21:00:02 +0000 | [diff] [blame] | 95 | template <class ELFT> | 
| Rui Ueyama | f714955 | 2016-03-11 18:46:51 +0000 | [diff] [blame] | 96 | InputSection<ELFT>::InputSection(elf::ObjectFile<ELFT> *F, | 
|  | 97 | const Elf_Shdr *Header) | 
| Rafael Espindola | c159c96 | 2015-10-19 21:00:02 +0000 | [diff] [blame] | 98 | : InputSectionBase<ELFT>(F, Header, Base::Regular) {} | 
|  | 99 |  | 
|  | 100 | template <class ELFT> | 
|  | 101 | bool InputSection<ELFT>::classof(const InputSectionBase<ELFT> *S) { | 
|  | 102 | return S->SectionKind == Base::Regular; | 
|  | 103 | } | 
| Michael J. Spencer | 84487f1 | 2015-07-24 21:03:07 +0000 | [diff] [blame] | 104 |  | 
| Rafael Espindola | 4ea0021 | 2015-09-21 22:01:00 +0000 | [diff] [blame] | 105 | template <class ELFT> | 
| George Rimar | 58941ee | 2016-02-25 08:23:37 +0000 | [diff] [blame] | 106 | InputSectionBase<ELFT> *InputSection<ELFT>::getRelocatedSection() { | 
|  | 107 | assert(this->Header->sh_type == SHT_RELA || this->Header->sh_type == SHT_REL); | 
|  | 108 | ArrayRef<InputSectionBase<ELFT> *> Sections = this->File->getSections(); | 
|  | 109 | return Sections[this->Header->sh_info]; | 
|  | 110 | } | 
|  | 111 |  | 
|  | 112 | // This is used for -r. We can't use memcpy to copy relocations because we need | 
|  | 113 | // to update symbol table offset and section index for each relocation. So we | 
|  | 114 | // copy relocations one by one. | 
|  | 115 | template <class ELFT> | 
| Rui Ueyama | fc467e7 | 2016-03-13 05:06:50 +0000 | [diff] [blame] | 116 | template <class RelTy> | 
| George Rimar | 58941ee | 2016-02-25 08:23:37 +0000 | [diff] [blame] | 117 | void InputSection<ELFT>::copyRelocations(uint8_t *Buf, | 
| Rui Ueyama | fc467e7 | 2016-03-13 05:06:50 +0000 | [diff] [blame] | 118 | iterator_range<const RelTy *> Rels) { | 
| George Rimar | 58941ee | 2016-02-25 08:23:37 +0000 | [diff] [blame] | 119 | InputSectionBase<ELFT> *RelocatedSection = getRelocatedSection(); | 
|  | 120 |  | 
| Rui Ueyama | fc467e7 | 2016-03-13 05:06:50 +0000 | [diff] [blame] | 121 | for (const RelTy &Rel : Rels) { | 
| George Rimar | 58941ee | 2016-02-25 08:23:37 +0000 | [diff] [blame] | 122 | uint32_t SymIndex = Rel.getSymbol(Config->Mips64EL); | 
|  | 123 | uint32_t Type = Rel.getType(Config->Mips64EL); | 
| Rafael Espindola | 67d72c0 | 2016-03-11 12:06:30 +0000 | [diff] [blame] | 124 | SymbolBody &Body = this->File->getSymbolBody(SymIndex).repl(); | 
| George Rimar | 58941ee | 2016-02-25 08:23:37 +0000 | [diff] [blame] | 125 |  | 
| Rui Ueyama | fc467e7 | 2016-03-13 05:06:50 +0000 | [diff] [blame] | 126 | RelTy *P = reinterpret_cast<RelTy *>(Buf); | 
|  | 127 | Buf += sizeof(RelTy); | 
| George Rimar | 58941ee | 2016-02-25 08:23:37 +0000 | [diff] [blame] | 128 |  | 
| George Rimar | 58941ee | 2016-02-25 08:23:37 +0000 | [diff] [blame] | 129 | P->r_offset = RelocatedSection->getOffset(Rel.r_offset); | 
| Rafael Espindola | 67d72c0 | 2016-03-11 12:06:30 +0000 | [diff] [blame] | 130 | P->setSymbolAndType(Body.DynsymIndex, Type, Config->Mips64EL); | 
| George Rimar | 58941ee | 2016-02-25 08:23:37 +0000 | [diff] [blame] | 131 | } | 
|  | 132 | } | 
|  | 133 |  | 
| Rui Ueyama | 2039847 | 2016-03-13 03:09:40 +0000 | [diff] [blame] | 134 | template <class RelTy> | 
|  | 135 | static uint32_t getMipsPairType(const RelTy *Rel, const SymbolBody &Sym) { | 
| Rui Ueyama | 2039847 | 2016-03-13 03:09:40 +0000 | [diff] [blame] | 136 | switch (Rel->getType(Config->Mips64EL)) { | 
| Simon Atanasyan | 860fbf0 | 2016-02-25 21:33:56 +0000 | [diff] [blame] | 137 | case R_MIPS_HI16: | 
|  | 138 | return R_MIPS_LO16; | 
| Simon Atanasyan | 92a3255 | 2016-03-12 11:58:15 +0000 | [diff] [blame] | 139 | case R_MIPS_GOT16: | 
| Rui Ueyama | 2039847 | 2016-03-13 03:09:40 +0000 | [diff] [blame] | 140 | return Sym.isLocal() ? R_MIPS_LO16 : R_MIPS_NONE; | 
| Simon Atanasyan | 860fbf0 | 2016-02-25 21:33:56 +0000 | [diff] [blame] | 141 | case R_MIPS_PCHI16: | 
|  | 142 | return R_MIPS_PCLO16; | 
|  | 143 | case R_MICROMIPS_HI16: | 
|  | 144 | return R_MICROMIPS_LO16; | 
|  | 145 | default: | 
|  | 146 | return R_MIPS_NONE; | 
|  | 147 | } | 
|  | 148 | } | 
|  | 149 |  | 
| George Rimar | 58941ee | 2016-02-25 08:23:37 +0000 | [diff] [blame] | 150 | template <class ELFT> | 
| Rui Ueyama | fc467e7 | 2016-03-13 05:06:50 +0000 | [diff] [blame] | 151 | template <class RelTy> | 
|  | 152 | uint8_t *InputSectionBase<ELFT>::findMipsPairedReloc(uint8_t *Buf, | 
|  | 153 | const RelTy *Rel, | 
|  | 154 | const RelTy *End) { | 
| Rui Ueyama | 2039847 | 2016-03-13 03:09:40 +0000 | [diff] [blame] | 155 | uint32_t SymIndex = Rel->getSymbol(Config->Mips64EL); | 
|  | 156 | SymbolBody &Sym = File->getSymbolBody(SymIndex).repl(); | 
|  | 157 | uint32_t Type = getMipsPairType(Rel, Sym); | 
|  | 158 |  | 
| Simon Atanasyan | 09b3e36 | 2015-12-01 21:24:45 +0000 | [diff] [blame] | 159 | // Some MIPS relocations use addend calculated from addend of the relocation | 
|  | 160 | // itself and addend of paired relocation. ABI requires to compute such | 
|  | 161 | // combined addend in case of REL relocation record format only. | 
|  | 162 | // See p. 4-17 at ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf | 
| Rui Ueyama | fc467e7 | 2016-03-13 05:06:50 +0000 | [diff] [blame] | 163 | if (RelTy::IsRela || Type == R_MIPS_NONE) | 
| Simon Atanasyan | 09b3e36 | 2015-12-01 21:24:45 +0000 | [diff] [blame] | 164 | return nullptr; | 
| Rui Ueyama | 2039847 | 2016-03-13 03:09:40 +0000 | [diff] [blame] | 165 |  | 
| Rui Ueyama | fc467e7 | 2016-03-13 05:06:50 +0000 | [diff] [blame] | 166 | for (const RelTy *RI = Rel; RI != End; ++RI) { | 
| Rui Ueyama | 2039847 | 2016-03-13 03:09:40 +0000 | [diff] [blame] | 167 | if (RI->getType(Config->Mips64EL) != Type) | 
| Simon Atanasyan | 09b3e36 | 2015-12-01 21:24:45 +0000 | [diff] [blame] | 168 | continue; | 
| Rui Ueyama | 2039847 | 2016-03-13 03:09:40 +0000 | [diff] [blame] | 169 | if (RI->getSymbol(Config->Mips64EL) != SymIndex) | 
| Simon Atanasyan | dddbeb7 | 2015-12-13 06:49:08 +0000 | [diff] [blame] | 170 | continue; | 
| Rui Ueyama | 2039847 | 2016-03-13 03:09:40 +0000 | [diff] [blame] | 171 | uintX_t Offset = getOffset(RI->r_offset); | 
| Simon Atanasyan | 09b3e36 | 2015-12-01 21:24:45 +0000 | [diff] [blame] | 172 | if (Offset == (uintX_t)-1) | 
|  | 173 | return nullptr; | 
|  | 174 | return Buf + Offset; | 
|  | 175 | } | 
|  | 176 | return nullptr; | 
|  | 177 | } | 
|  | 178 |  | 
|  | 179 | template <class ELFT> | 
| Rui Ueyama | fc467e7 | 2016-03-13 05:06:50 +0000 | [diff] [blame] | 180 | template <class RelTy> | 
| Simon Atanasyan | 09b3e36 | 2015-12-01 21:24:45 +0000 | [diff] [blame] | 181 | void InputSectionBase<ELFT>::relocate(uint8_t *Buf, uint8_t *BufEnd, | 
| Rui Ueyama | fc467e7 | 2016-03-13 05:06:50 +0000 | [diff] [blame] | 182 | iterator_range<const RelTy *> Rels) { | 
| George Rimar | 6713cf8 | 2015-11-25 21:46:05 +0000 | [diff] [blame] | 183 | size_t Num = Rels.end() - Rels.begin(); | 
|  | 184 | for (size_t I = 0; I < Num; ++I) { | 
| Rui Ueyama | fc467e7 | 2016-03-13 05:06:50 +0000 | [diff] [blame] | 185 | const RelTy &RI = *(Rels.begin() + I); | 
| Rafael Espindola | 0c6a4f1 | 2015-11-11 19:54:14 +0000 | [diff] [blame] | 186 | uintX_t Offset = getOffset(RI.r_offset); | 
|  | 187 | if (Offset == (uintX_t)-1) | 
|  | 188 | continue; | 
|  | 189 |  | 
| George Rimar | a4ab97d | 2016-03-11 12:57:52 +0000 | [diff] [blame] | 190 | uintX_t A = getAddend<ELFT>(RI); | 
|  | 191 | uint32_t SymIndex = RI.getSymbol(Config->Mips64EL); | 
|  | 192 | uint32_t Type = RI.getType(Config->Mips64EL); | 
| Rafael Espindola | 0c6a4f1 | 2015-11-11 19:54:14 +0000 | [diff] [blame] | 193 | uint8_t *BufLoc = Buf + Offset; | 
|  | 194 | uintX_t AddrLoc = OutSec->getVA() + Offset; | 
| Michael J. Spencer | 1e22561 | 2015-11-11 01:00:24 +0000 | [diff] [blame] | 195 |  | 
| Rafael Espindola | d405f47 | 2016-03-04 21:37:09 +0000 | [diff] [blame] | 196 | if (Target->pointsToLocalDynamicGotEntry(Type) && | 
| Rui Ueyama | baf1651 | 2016-01-29 00:20:12 +0000 | [diff] [blame] | 197 | !Target->canRelaxTls(Type, nullptr)) { | 
| Michael J. Spencer | 1e22561 | 2015-11-11 01:00:24 +0000 | [diff] [blame] | 198 | Target->relocateOne(BufLoc, BufEnd, Type, AddrLoc, | 
| George Rimar | 1d9738c | 2016-03-11 12:53:17 +0000 | [diff] [blame] | 199 | Out<ELFT>::Got->getTlsIndexVA() + A); | 
| Michael J. Spencer | 1e22561 | 2015-11-11 01:00:24 +0000 | [diff] [blame] | 200 | continue; | 
|  | 201 | } | 
| Rafael Espindola | 4ea0021 | 2015-09-21 22:01:00 +0000 | [diff] [blame] | 202 |  | 
| Rafael Espindola | 67d72c0 | 2016-03-11 12:06:30 +0000 | [diff] [blame] | 203 | SymbolBody &Body = File->getSymbolBody(SymIndex).repl(); | 
| George Rimar | 0b8ed1d | 2015-12-21 10:37:33 +0000 | [diff] [blame] | 204 |  | 
| Rafael Espindola | 67d72c0 | 2016-03-11 12:06:30 +0000 | [diff] [blame] | 205 | if (Target->canRelaxTls(Type, &Body)) { | 
| George Rimar | 0b8ed1d | 2015-12-21 10:37:33 +0000 | [diff] [blame] | 206 | uintX_t SymVA; | 
| Rafael Espindola | 38e5d4e | 2016-03-11 13:04:28 +0000 | [diff] [blame] | 207 | if (Target->needsGot(Type, Body)) | 
| Rafael Espindola | 67d72c0 | 2016-03-11 12:06:30 +0000 | [diff] [blame] | 208 | SymVA = Body.getGotVA<ELFT>(); | 
| George Rimar | 0b8ed1d | 2015-12-21 10:37:33 +0000 | [diff] [blame] | 209 | else | 
| Rafael Espindola | 67d72c0 | 2016-03-11 12:06:30 +0000 | [diff] [blame] | 210 | SymVA = Body.getVA<ELFT>(); | 
| George Rimar | 0b8ed1d | 2015-12-21 10:37:33 +0000 | [diff] [blame] | 211 | // By optimizing TLS relocations, it is sometimes needed to skip | 
|  | 212 | // relocations that immediately follow TLS relocations. This function | 
|  | 213 | // knows how many slots we need to skip. | 
| Rui Ueyama | c516ae1 | 2016-01-29 02:33:45 +0000 | [diff] [blame] | 214 | I += Target->relaxTls(BufLoc, BufEnd, Type, AddrLoc, SymVA, Body); | 
| George Rimar | 0b8ed1d | 2015-12-21 10:37:33 +0000 | [diff] [blame] | 215 | continue; | 
|  | 216 | } | 
|  | 217 |  | 
| Rafael Espindola | 87d9f10 | 2016-03-11 12:19:05 +0000 | [diff] [blame] | 218 | // PPC64 has a special relocation representing the TOC base pointer | 
|  | 219 | // that does not have a corresponding symbol. | 
|  | 220 | if (Config->EMachine == EM_PPC64 && RI.getType(false) == R_PPC64_TOC) { | 
|  | 221 | uintX_t SymVA = getPPC64TocBase() + A; | 
|  | 222 | Target->relocateOne(BufLoc, BufEnd, Type, AddrLoc, SymVA, 0); | 
|  | 223 | continue; | 
|  | 224 | } | 
|  | 225 |  | 
| Rafael Espindola | 38e5d4e | 2016-03-11 13:04:28 +0000 | [diff] [blame] | 226 | if (Target->isTlsGlobalDynamicRel(Type) && | 
|  | 227 | !Target->canRelaxTls(Type, &Body)) { | 
|  | 228 | Target->relocateOne(BufLoc, BufEnd, Type, AddrLoc, | 
|  | 229 | Out<ELFT>::Got->getGlobalDynAddr(Body) + A); | 
|  | 230 | continue; | 
|  | 231 | } | 
|  | 232 |  | 
|  | 233 | uintX_t SymVA = Body.getVA<ELFT>(A); | 
|  | 234 | bool CBP = canBePreempted(Body); | 
|  | 235 | uint8_t *PairedLoc = nullptr; | 
| Simon Atanasyan | 92a3255 | 2016-03-12 11:58:15 +0000 | [diff] [blame] | 236 | if (Config->EMachine == EM_MIPS) | 
| Rui Ueyama | 2039847 | 2016-03-13 03:09:40 +0000 | [diff] [blame] | 237 | PairedLoc = findMipsPairedReloc(Buf, &RI, Rels.end()); | 
| Rafael Espindola | 38e5d4e | 2016-03-11 13:04:28 +0000 | [diff] [blame] | 238 |  | 
|  | 239 | if (Target->needsPlt<ELFT>(Type, Body)) { | 
|  | 240 | SymVA = Body.getPltVA<ELFT>() + A; | 
|  | 241 | } else if (Target->needsGot(Type, Body)) { | 
|  | 242 | if (Config->EMachine == EM_MIPS && !CBP) { | 
|  | 243 | if (Body.isLocal()) { | 
| Simon Atanasyan | 56ab5f0 | 2016-01-21 05:33:23 +0000 | [diff] [blame] | 244 | // R_MIPS_GOT16 relocation against local symbol requires index of | 
|  | 245 | // a local GOT entry which contains page address corresponds | 
| Simon Atanasyan | 860fbf0 | 2016-02-25 21:33:56 +0000 | [diff] [blame] | 246 | // to sum of the symbol address and addend. The addend in that case | 
|  | 247 | // is calculated using addends from R_MIPS_GOT16 and paired | 
|  | 248 | // R_MIPS_LO16 relocations. | 
|  | 249 | const endianness E = ELFT::TargetEndianness; | 
| Simon Atanasyan | 860fbf0 | 2016-02-25 21:33:56 +0000 | [diff] [blame] | 250 | uint64_t AHL = read32<E>(BufLoc) << 16; | 
| Simon Atanasyan | 92a3255 | 2016-03-12 11:58:15 +0000 | [diff] [blame] | 251 | if (PairedLoc) | 
|  | 252 | AHL += SignExtend64<16>(read32<E>(PairedLoc)); | 
| Simon Atanasyan | 860fbf0 | 2016-02-25 21:33:56 +0000 | [diff] [blame] | 253 | SymVA = Out<ELFT>::Got->getMipsLocalPageAddr(SymVA + AHL); | 
| Rafael Espindola | 38e5d4e | 2016-03-11 13:04:28 +0000 | [diff] [blame] | 254 | } else { | 
| Simon Atanasyan | 019049f | 2016-03-11 13:57:53 +0000 | [diff] [blame] | 255 | // For non-local symbols GOT entries should contain their full | 
|  | 256 | // addresses. But if such symbol cannot be preempted, we do not | 
|  | 257 | // have to put them into the "global" part of GOT and use dynamic | 
|  | 258 | // linker to determine their actual addresses. That is why we | 
|  | 259 | // create GOT entries for them in the "local" part of GOT. | 
| Rafael Espindola | 38e5d4e | 2016-03-11 13:04:28 +0000 | [diff] [blame] | 260 | SymVA = Out<ELFT>::Got->getMipsLocalFullAddr(Body) + A; | 
|  | 261 | } | 
|  | 262 | } else { | 
|  | 263 | SymVA = Body.getGotVA<ELFT>() + A; | 
| Simon Atanasyan | 56ab5f0 | 2016-01-21 05:33:23 +0000 | [diff] [blame] | 264 | } | 
| Rafael Espindola | 67d72c0 | 2016-03-11 12:06:30 +0000 | [diff] [blame] | 265 | if (Body.IsTls) | 
| Rui Ueyama | 724d625 | 2016-01-29 01:49:32 +0000 | [diff] [blame] | 266 | Type = Target->getTlsGotRel(Type); | 
| Rafael Espindola | a350e26 | 2016-02-26 14:33:23 +0000 | [diff] [blame] | 267 | } else if (Target->isSizeRel(Type) && CBP) { | 
| Rui Ueyama | 3a7c2f6 | 2016-01-08 00:13:23 +0000 | [diff] [blame] | 268 | // A SIZE relocation is supposed to set a symbol size, but if a symbol | 
|  | 269 | // can be preempted, the size at runtime may be different than link time. | 
|  | 270 | // If that's the case, we leave the field alone rather than filling it | 
|  | 271 | // with a possibly incorrect value. | 
| George Rimar | d23970f | 2015-11-25 20:41:53 +0000 | [diff] [blame] | 272 | continue; | 
| Simon Atanasyan | 09dae7c | 2015-12-16 14:45:09 +0000 | [diff] [blame] | 273 | } else if (Config->EMachine == EM_MIPS) { | 
| Rafael Espindola | 38e5d4e | 2016-03-11 13:04:28 +0000 | [diff] [blame] | 274 | if (Type == R_MIPS_HI16 && &Body == Config->MipsGpDisp) { | 
|  | 275 | SymVA = getMipsGpAddr<ELFT>() - AddrLoc + A; | 
|  | 276 | } else if (Type == R_MIPS_LO16 && &Body == Config->MipsGpDisp) { | 
|  | 277 | SymVA = getMipsGpAddr<ELFT>() - AddrLoc + 4 + A; | 
|  | 278 | } else if (&Body == Config->MipsLocalGp) { | 
|  | 279 | SymVA = getMipsGpAddr<ELFT>() + A; | 
|  | 280 | } else if (Type == R_MIPS_GPREL16 || Type == R_MIPS_GPREL32) { | 
|  | 281 | // We need to adjust SymVA value in case of R_MIPS_GPREL16/32 | 
|  | 282 | // relocations because they use the following expression to calculate | 
|  | 283 | // the relocation's result for local symbol: S + A + GP0 - G. | 
|  | 284 | SymVA += File->getMipsGp0(); | 
| Rafael Espindola | 38e5d4e | 2016-03-11 13:04:28 +0000 | [diff] [blame] | 285 | } | 
| Rafael Espindola | 67d72c0 | 2016-03-11 12:06:30 +0000 | [diff] [blame] | 286 | } else if (!Target->needsCopyRel<ELFT>(Type, Body) && CBP) { | 
| Rafael Espindola | 1f04c44 | 2016-03-08 20:24:36 +0000 | [diff] [blame] | 287 | continue; | 
| Rui Ueyama | bb3c336 | 2015-10-12 20:28:23 +0000 | [diff] [blame] | 288 | } | 
| Rafael Espindola | 67d72c0 | 2016-03-11 12:06:30 +0000 | [diff] [blame] | 289 | uintX_t Size = Body.getSize<ELFT>(); | 
| Rafael Espindola | 38e5d4e | 2016-03-11 13:04:28 +0000 | [diff] [blame] | 290 | Target->relocateOne(BufLoc, BufEnd, Type, AddrLoc, SymVA, Size + A, | 
|  | 291 | PairedLoc); | 
| Rafael Espindola | 4ea0021 | 2015-09-21 22:01:00 +0000 | [diff] [blame] | 292 | } | 
|  | 293 | } | 
|  | 294 |  | 
| Rui Ueyama | 15ef5e1 | 2015-10-07 19:18:16 +0000 | [diff] [blame] | 295 | template <class ELFT> void InputSection<ELFT>::writeTo(uint8_t *Buf) { | 
| Rafael Espindola | c159c96 | 2015-10-19 21:00:02 +0000 | [diff] [blame] | 296 | if (this->Header->sh_type == SHT_NOBITS) | 
| Michael J. Spencer | 84487f1 | 2015-07-24 21:03:07 +0000 | [diff] [blame] | 297 | return; | 
|  | 298 | // Copy section contents from source object file to output file. | 
| Rafael Espindola | c159c96 | 2015-10-19 21:00:02 +0000 | [diff] [blame] | 299 | ArrayRef<uint8_t> Data = this->getSectionData(); | 
| George Rimar | 58941ee | 2016-02-25 08:23:37 +0000 | [diff] [blame] | 300 | ELFFile<ELFT> &EObj = this->File->getObj(); | 
|  | 301 |  | 
|  | 302 | // That happens with -r. In that case we need fix the relocation position and | 
|  | 303 | // target. No relocations are applied. | 
|  | 304 | if (this->Header->sh_type == SHT_RELA) { | 
|  | 305 | this->copyRelocations(Buf + OutSecOff, EObj.relas(this->Header)); | 
|  | 306 | return; | 
|  | 307 | } | 
|  | 308 | if (this->Header->sh_type == SHT_REL) { | 
|  | 309 | this->copyRelocations(Buf + OutSecOff, EObj.rels(this->Header)); | 
|  | 310 | return; | 
|  | 311 | } | 
|  | 312 |  | 
| Rui Ueyama | 55c3f89 | 2015-10-15 01:58:40 +0000 | [diff] [blame] | 313 | memcpy(Buf + OutSecOff, Data.data(), Data.size()); | 
| Rafael Espindola | 4ea0021 | 2015-09-21 22:01:00 +0000 | [diff] [blame] | 314 |  | 
| Rafael Espindola | 0c6a4f1 | 2015-11-11 19:54:14 +0000 | [diff] [blame] | 315 | uint8_t *BufEnd = Buf + OutSecOff + Data.size(); | 
| Rafael Espindola | 4ea0021 | 2015-09-21 22:01:00 +0000 | [diff] [blame] | 316 | // Iterate over all relocation sections that apply to this section. | 
| Rafael Espindola | 0c6a4f1 | 2015-11-11 19:54:14 +0000 | [diff] [blame] | 317 | for (const Elf_Shdr *RelSec : this->RelocSections) { | 
| Rafael Espindola | 4ea0021 | 2015-09-21 22:01:00 +0000 | [diff] [blame] | 318 | if (RelSec->sh_type == SHT_RELA) | 
| Rafael Espindola | 0c6a4f1 | 2015-11-11 19:54:14 +0000 | [diff] [blame] | 319 | this->relocate(Buf, BufEnd, EObj.relas(RelSec)); | 
| Rafael Espindola | 4ea0021 | 2015-09-21 22:01:00 +0000 | [diff] [blame] | 320 | else | 
| Rafael Espindola | 0c6a4f1 | 2015-11-11 19:54:14 +0000 | [diff] [blame] | 321 | this->relocate(Buf, BufEnd, EObj.rels(RelSec)); | 
| Rafael Espindola | 4ea0021 | 2015-09-21 22:01:00 +0000 | [diff] [blame] | 322 | } | 
| Michael J. Spencer | 84487f1 | 2015-07-24 21:03:07 +0000 | [diff] [blame] | 323 | } | 
|  | 324 |  | 
| Rafael Espindola | c159c96 | 2015-10-19 21:00:02 +0000 | [diff] [blame] | 325 | template <class ELFT> | 
| Rui Ueyama | 0b28952 | 2016-02-25 18:43:51 +0000 | [diff] [blame] | 326 | void InputSection<ELFT>::replace(InputSection<ELFT> *Other) { | 
|  | 327 | this->Align = std::max(this->Align, Other->Align); | 
|  | 328 | Other->Repl = this->Repl; | 
|  | 329 | Other->Live = false; | 
|  | 330 | } | 
|  | 331 |  | 
|  | 332 | template <class ELFT> | 
| Rafael Espindola | 0c6a4f1 | 2015-11-11 19:54:14 +0000 | [diff] [blame] | 333 | SplitInputSection<ELFT>::SplitInputSection( | 
| Rui Ueyama | f714955 | 2016-03-11 18:46:51 +0000 | [diff] [blame] | 334 | elf::ObjectFile<ELFT> *File, const Elf_Shdr *Header, | 
| Rafael Espindola | 0c6a4f1 | 2015-11-11 19:54:14 +0000 | [diff] [blame] | 335 | typename InputSectionBase<ELFT>::Kind SectionKind) | 
|  | 336 | : InputSectionBase<ELFT>(File, Header, SectionKind) {} | 
|  | 337 |  | 
|  | 338 | template <class ELFT> | 
| Rui Ueyama | f714955 | 2016-03-11 18:46:51 +0000 | [diff] [blame] | 339 | EHInputSection<ELFT>::EHInputSection(elf::ObjectFile<ELFT> *F, | 
| Rafael Espindola | 0c6a4f1 | 2015-11-11 19:54:14 +0000 | [diff] [blame] | 340 | const Elf_Shdr *Header) | 
| Rui Ueyama | da73532 | 2015-12-24 10:08:54 +0000 | [diff] [blame] | 341 | : SplitInputSection<ELFT>(F, Header, InputSectionBase<ELFT>::EHFrame) { | 
|  | 342 | // Mark .eh_frame sections as live by default because there are | 
|  | 343 | // usually no relocations that point to .eh_frames. Otherwise, | 
| George Rimar | e9e1d32 | 2016-02-18 15:17:01 +0000 | [diff] [blame] | 344 | // the garbage collector would drop all .eh_frame sections. | 
| Rui Ueyama | da73532 | 2015-12-24 10:08:54 +0000 | [diff] [blame] | 345 | this->Live = true; | 
|  | 346 | } | 
| Rafael Espindola | 0c6a4f1 | 2015-11-11 19:54:14 +0000 | [diff] [blame] | 347 |  | 
|  | 348 | template <class ELFT> | 
|  | 349 | bool EHInputSection<ELFT>::classof(const InputSectionBase<ELFT> *S) { | 
|  | 350 | return S->SectionKind == InputSectionBase<ELFT>::EHFrame; | 
|  | 351 | } | 
|  | 352 |  | 
|  | 353 | template <class ELFT> | 
|  | 354 | typename EHInputSection<ELFT>::uintX_t | 
|  | 355 | EHInputSection<ELFT>::getOffset(uintX_t Offset) { | 
| George Rimar | 6ab275c | 2015-12-25 09:51:42 +0000 | [diff] [blame] | 356 | // The file crtbeginT.o has relocations pointing to the start of an empty | 
|  | 357 | // .eh_frame that is known to be the first in the link. It does that to | 
|  | 358 | // identify the start of the output .eh_frame. Handle this special case. | 
|  | 359 | if (this->getSectionHdr()->sh_size == 0) | 
|  | 360 | return Offset; | 
| Rafael Espindola | 0c6a4f1 | 2015-11-11 19:54:14 +0000 | [diff] [blame] | 361 | std::pair<uintX_t, uintX_t> *I = this->getRangeAndSize(Offset).first; | 
|  | 362 | uintX_t Base = I->second; | 
| George Rimar | 4b40ebc | 2015-11-13 13:44:59 +0000 | [diff] [blame] | 363 | if (Base == uintX_t(-1)) | 
| Rafael Espindola | 0c6a4f1 | 2015-11-11 19:54:14 +0000 | [diff] [blame] | 364 | return -1; // Not in the output | 
|  | 365 |  | 
|  | 366 | uintX_t Addend = Offset - I->first; | 
|  | 367 | return Base + Addend; | 
|  | 368 | } | 
|  | 369 |  | 
|  | 370 | template <class ELFT> | 
| Rafael Espindola | 36a73d2 | 2016-03-11 16:32:46 +0000 | [diff] [blame] | 371 | MergeInputSection<ELFT>::MergeInputSection(elf::ObjectFile<ELFT> *F, | 
| Rafael Espindola | c159c96 | 2015-10-19 21:00:02 +0000 | [diff] [blame] | 372 | const Elf_Shdr *Header) | 
| Rafael Espindola | 0c6a4f1 | 2015-11-11 19:54:14 +0000 | [diff] [blame] | 373 | : SplitInputSection<ELFT>(F, Header, InputSectionBase<ELFT>::Merge) {} | 
| Rafael Espindola | c159c96 | 2015-10-19 21:00:02 +0000 | [diff] [blame] | 374 |  | 
|  | 375 | template <class ELFT> | 
|  | 376 | bool MergeInputSection<ELFT>::classof(const InputSectionBase<ELFT> *S) { | 
| Rafael Espindola | 0c6a4f1 | 2015-11-11 19:54:14 +0000 | [diff] [blame] | 377 | return S->SectionKind == InputSectionBase<ELFT>::Merge; | 
| Rafael Espindola | c159c96 | 2015-10-19 21:00:02 +0000 | [diff] [blame] | 378 | } | 
|  | 379 |  | 
| Rafael Espindola | c159c96 | 2015-10-19 21:00:02 +0000 | [diff] [blame] | 380 | template <class ELFT> | 
| Rafael Espindola | 0c6a4f1 | 2015-11-11 19:54:14 +0000 | [diff] [blame] | 381 | std::pair<std::pair<typename ELFFile<ELFT>::uintX_t, | 
|  | 382 | typename ELFFile<ELFT>::uintX_t> *, | 
|  | 383 | typename ELFFile<ELFT>::uintX_t> | 
|  | 384 | SplitInputSection<ELFT>::getRangeAndSize(uintX_t Offset) { | 
| Rafael Espindola | f82ed2a | 2015-10-24 22:51:01 +0000 | [diff] [blame] | 385 | ArrayRef<uint8_t> D = this->getSectionData(); | 
| Rui Ueyama | 7ba639b | 2015-10-25 16:25:04 +0000 | [diff] [blame] | 386 | StringRef Data((const char *)D.data(), D.size()); | 
| Rafael Espindola | f82ed2a | 2015-10-24 22:51:01 +0000 | [diff] [blame] | 387 | uintX_t Size = Data.size(); | 
|  | 388 | if (Offset >= Size) | 
| George Rimar | 777f963 | 2016-03-12 08:31:34 +0000 | [diff] [blame] | 389 | fatal("entry is past the end of the section"); | 
| Rafael Espindola | f82ed2a | 2015-10-24 22:51:01 +0000 | [diff] [blame] | 390 |  | 
|  | 391 | // Find the element this offset points to. | 
|  | 392 | auto I = std::upper_bound( | 
| Rafael Espindola | d04c12a | 2015-11-11 15:20:45 +0000 | [diff] [blame] | 393 | Offsets.begin(), Offsets.end(), Offset, | 
| Rafael Espindola | 1fe2d1e | 2015-11-11 15:55:00 +0000 | [diff] [blame] | 394 | [](const uintX_t &A, const std::pair<uintX_t, uintX_t> &B) { | 
| Rafael Espindola | f82ed2a | 2015-10-24 22:51:01 +0000 | [diff] [blame] | 395 | return A < B.first; | 
|  | 396 | }); | 
| Rafael Espindola | 3299499 | 2015-11-11 15:40:37 +0000 | [diff] [blame] | 397 | uintX_t End = I == Offsets.end() ? Data.size() : I->first; | 
| Rafael Espindola | f82ed2a | 2015-10-24 22:51:01 +0000 | [diff] [blame] | 398 | --I; | 
| Rafael Espindola | 0c6a4f1 | 2015-11-11 19:54:14 +0000 | [diff] [blame] | 399 | return std::make_pair(&*I, End); | 
|  | 400 | } | 
|  | 401 |  | 
|  | 402 | template <class ELFT> | 
|  | 403 | typename MergeInputSection<ELFT>::uintX_t | 
|  | 404 | MergeInputSection<ELFT>::getOffset(uintX_t Offset) { | 
| George Rimar | 4b40ebc | 2015-11-13 13:44:59 +0000 | [diff] [blame] | 405 | std::pair<std::pair<uintX_t, uintX_t> *, uintX_t> T = | 
| Rafael Espindola | 0c6a4f1 | 2015-11-11 19:54:14 +0000 | [diff] [blame] | 406 | this->getRangeAndSize(Offset); | 
|  | 407 | std::pair<uintX_t, uintX_t> *I = T.first; | 
|  | 408 | uintX_t End = T.second; | 
| Rafael Espindola | f82ed2a | 2015-10-24 22:51:01 +0000 | [diff] [blame] | 409 | uintX_t Start = I->first; | 
|  | 410 |  | 
|  | 411 | // Compute the Addend and if the Base is cached, return. | 
|  | 412 | uintX_t Addend = Offset - Start; | 
| Rafael Espindola | 3299499 | 2015-11-11 15:40:37 +0000 | [diff] [blame] | 413 | uintX_t &Base = I->second; | 
| Rafael Espindola | 1fe2d1e | 2015-11-11 15:55:00 +0000 | [diff] [blame] | 414 | if (Base != uintX_t(-1)) | 
| Rafael Espindola | f82ed2a | 2015-10-24 22:51:01 +0000 | [diff] [blame] | 415 | return Base + Addend; | 
|  | 416 |  | 
| Hal Finkel | f950595 | 2015-11-25 23:54:53 +0000 | [diff] [blame] | 417 | // Map the base to the offset in the output section and cache it. | 
| Rafael Espindola | 0c6a4f1 | 2015-11-11 19:54:14 +0000 | [diff] [blame] | 418 | ArrayRef<uint8_t> D = this->getSectionData(); | 
|  | 419 | StringRef Data((const char *)D.data(), D.size()); | 
| Rafael Espindola | f82ed2a | 2015-10-24 22:51:01 +0000 | [diff] [blame] | 420 | StringRef Entry = Data.substr(Start, End - Start); | 
|  | 421 | Base = | 
|  | 422 | static_cast<MergeOutputSection<ELFT> *>(this->OutSec)->getOffset(Entry); | 
|  | 423 | return Base + Addend; | 
| Rafael Espindola | 5d83ccd | 2015-08-13 19:18:30 +0000 | [diff] [blame] | 424 | } | 
|  | 425 |  | 
| Simon Atanasyan | 1d7df40 | 2015-12-20 10:57:34 +0000 | [diff] [blame] | 426 | template <class ELFT> | 
| Rui Ueyama | f714955 | 2016-03-11 18:46:51 +0000 | [diff] [blame] | 427 | MipsReginfoInputSection<ELFT>::MipsReginfoInputSection(elf::ObjectFile<ELFT> *F, | 
| Rui Ueyama | 70eed36 | 2016-01-06 22:42:43 +0000 | [diff] [blame] | 428 | const Elf_Shdr *Hdr) | 
|  | 429 | : InputSectionBase<ELFT>(F, Hdr, InputSectionBase<ELFT>::MipsReginfo) { | 
|  | 430 | // Initialize this->Reginfo. | 
| Simon Atanasyan | 1d7df40 | 2015-12-20 10:57:34 +0000 | [diff] [blame] | 431 | ArrayRef<uint8_t> D = this->getSectionData(); | 
| Rui Ueyama | 70eed36 | 2016-01-06 22:42:43 +0000 | [diff] [blame] | 432 | if (D.size() != sizeof(Elf_Mips_RegInfo<ELFT>)) | 
| George Rimar | 777f963 | 2016-03-12 08:31:34 +0000 | [diff] [blame] | 433 | fatal("invalid size of .reginfo section"); | 
| Rui Ueyama | 70eed36 | 2016-01-06 22:42:43 +0000 | [diff] [blame] | 434 | Reginfo = reinterpret_cast<const Elf_Mips_RegInfo<ELFT> *>(D.data()); | 
| Simon Atanasyan | 57830b6 | 2015-12-25 13:02:13 +0000 | [diff] [blame] | 435 | } | 
|  | 436 |  | 
| Simon Atanasyan | 1d7df40 | 2015-12-20 10:57:34 +0000 | [diff] [blame] | 437 | template <class ELFT> | 
|  | 438 | bool MipsReginfoInputSection<ELFT>::classof(const InputSectionBase<ELFT> *S) { | 
|  | 439 | return S->SectionKind == InputSectionBase<ELFT>::MipsReginfo; | 
|  | 440 | } | 
|  | 441 |  | 
| Rafael Espindola | e0df00b | 2016-02-28 00:25:54 +0000 | [diff] [blame] | 442 | template class elf::InputSectionBase<ELF32LE>; | 
|  | 443 | template class elf::InputSectionBase<ELF32BE>; | 
|  | 444 | template class elf::InputSectionBase<ELF64LE>; | 
|  | 445 | template class elf::InputSectionBase<ELF64BE>; | 
| Rafael Espindola | c159c96 | 2015-10-19 21:00:02 +0000 | [diff] [blame] | 446 |  | 
| Rafael Espindola | e0df00b | 2016-02-28 00:25:54 +0000 | [diff] [blame] | 447 | template class elf::InputSection<ELF32LE>; | 
|  | 448 | template class elf::InputSection<ELF32BE>; | 
|  | 449 | template class elf::InputSection<ELF64LE>; | 
|  | 450 | template class elf::InputSection<ELF64BE>; | 
| Rafael Espindola | c159c96 | 2015-10-19 21:00:02 +0000 | [diff] [blame] | 451 |  | 
| Rafael Espindola | e0df00b | 2016-02-28 00:25:54 +0000 | [diff] [blame] | 452 | template class elf::EHInputSection<ELF32LE>; | 
|  | 453 | template class elf::EHInputSection<ELF32BE>; | 
|  | 454 | template class elf::EHInputSection<ELF64LE>; | 
|  | 455 | template class elf::EHInputSection<ELF64BE>; | 
| Rafael Espindola | 0c6a4f1 | 2015-11-11 19:54:14 +0000 | [diff] [blame] | 456 |  | 
| Rafael Espindola | e0df00b | 2016-02-28 00:25:54 +0000 | [diff] [blame] | 457 | template class elf::MergeInputSection<ELF32LE>; | 
|  | 458 | template class elf::MergeInputSection<ELF32BE>; | 
|  | 459 | template class elf::MergeInputSection<ELF64LE>; | 
|  | 460 | template class elf::MergeInputSection<ELF64BE>; | 
| Simon Atanasyan | 1d7df40 | 2015-12-20 10:57:34 +0000 | [diff] [blame] | 461 |  | 
| Rafael Espindola | e0df00b | 2016-02-28 00:25:54 +0000 | [diff] [blame] | 462 | template class elf::MipsReginfoInputSection<ELF32LE>; | 
|  | 463 | template class elf::MipsReginfoInputSection<ELF32BE>; | 
|  | 464 | template class elf::MipsReginfoInputSection<ELF64LE>; | 
|  | 465 | template class elf::MipsReginfoInputSection<ELF64BE>; |