blob: ab20113f2588522c84c8062f4baf519613180eb8 [file] [log] [blame]
Lang Hamesa5216882014-07-17 18:54:50 +00001//===-- RuntimeDyldMachOAArch64.h -- MachO/AArch64 specific code. -*- C++ -*-=//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
Benjamin Kramera7c40ef2014-08-13 16:26:38 +000010#ifndef LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_TARGETS_RUNTIMEDYLDMACHOAARCH64_H
11#define LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_TARGETS_RUNTIMEDYLDMACHOAARCH64_H
Lang Hamesa5216882014-07-17 18:54:50 +000012
13#include "../RuntimeDyldMachO.h"
Juergen Ributzka0e913b12014-07-29 19:57:15 +000014#include "llvm/Support/Endian.h"
Lang Hamesa5216882014-07-17 18:54:50 +000015
16#define DEBUG_TYPE "dyld"
17
18namespace llvm {
19
20class RuntimeDyldMachOAArch64
21 : public RuntimeDyldMachOCRTPBase<RuntimeDyldMachOAArch64> {
22public:
Lang Hameseb195f02014-09-04 04:53:03 +000023
24 typedef uint64_t TargetPtrT;
25
Lang Hamesa5216882014-07-17 18:54:50 +000026 RuntimeDyldMachOAArch64(RTDyldMemoryManager *MM)
27 : RuntimeDyldMachOCRTPBase(MM) {}
28
29 unsigned getMaxStubSize() override { return 8; }
30
Lang Hamese5fc8262014-07-17 23:11:30 +000031 unsigned getStubAlignment() override { return 8; }
Lang Hamesa5216882014-07-17 18:54:50 +000032
Juergen Ributzkab13b52e2014-07-22 21:42:51 +000033 /// Extract the addend encoded in the instruction / memory location.
Lang Hames25d93092014-08-08 23:12:22 +000034 int64_t decodeAddend(const RelocationEntry &RE) const {
35 const SectionEntry &Section = Sections[RE.SectionID];
36 uint8_t *LocalAddress = Section.Address + RE.Offset;
37 unsigned NumBytes = 1 << RE.Size;
Juergen Ributzkab13b52e2014-07-22 21:42:51 +000038 int64_t Addend = 0;
39 // Verify that the relocation has the correct size and alignment.
Lang Hames25d93092014-08-08 23:12:22 +000040 switch (RE.RelType) {
Juergen Ributzkab13b52e2014-07-22 21:42:51 +000041 default:
42 llvm_unreachable("Unsupported relocation type!");
43 case MachO::ARM64_RELOC_UNSIGNED:
Juergen Ributzka0e913b12014-07-29 19:57:15 +000044 assert((NumBytes == 4 || NumBytes == 8) && "Invalid relocation size.");
Juergen Ributzkab13b52e2014-07-22 21:42:51 +000045 break;
46 case MachO::ARM64_RELOC_BRANCH26:
47 case MachO::ARM64_RELOC_PAGE21:
48 case MachO::ARM64_RELOC_PAGEOFF12:
49 case MachO::ARM64_RELOC_GOT_LOAD_PAGE21:
50 case MachO::ARM64_RELOC_GOT_LOAD_PAGEOFF12:
51 assert(NumBytes == 4 && "Invalid relocation size.");
52 assert((((uintptr_t)LocalAddress & 0x3) == 0) &&
53 "Instruction address is not aligned to 4 bytes.");
54 break;
55 }
56
Lang Hames25d93092014-08-08 23:12:22 +000057 switch (RE.RelType) {
Juergen Ributzkab13b52e2014-07-22 21:42:51 +000058 default:
59 llvm_unreachable("Unsupported relocation type!");
60 case MachO::ARM64_RELOC_UNSIGNED:
Juergen Ributzka0e913b12014-07-29 19:57:15 +000061 // This could be an unaligned memory location.
62 if (NumBytes == 4)
63 Addend = *reinterpret_cast<support::ulittle32_t *>(LocalAddress);
64 else
65 Addend = *reinterpret_cast<support::ulittle64_t *>(LocalAddress);
Juergen Ributzkab13b52e2014-07-22 21:42:51 +000066 break;
67 case MachO::ARM64_RELOC_BRANCH26: {
68 // Verify that the relocation points to the expected branch instruction.
Juergen Ributzka0e913b12014-07-29 19:57:15 +000069 auto *p = reinterpret_cast<support::aligned_ulittle32_t *>(LocalAddress);
Juergen Ributzkab13b52e2014-07-22 21:42:51 +000070 assert((*p & 0xFC000000) == 0x14000000 && "Expected branch instruction.");
71
72 // Get the 26 bit addend encoded in the branch instruction and sign-extend
73 // to 64 bit. The lower 2 bits are always zeros and are therefore implicit
74 // (<< 2).
75 Addend = (*p & 0x03FFFFFF) << 2;
76 Addend = SignExtend64(Addend, 28);
77 break;
78 }
79 case MachO::ARM64_RELOC_GOT_LOAD_PAGE21:
80 case MachO::ARM64_RELOC_PAGE21: {
81 // Verify that the relocation points to the expected adrp instruction.
Juergen Ributzka0e913b12014-07-29 19:57:15 +000082 auto *p = reinterpret_cast<support::aligned_ulittle32_t *>(LocalAddress);
Juergen Ributzkab13b52e2014-07-22 21:42:51 +000083 assert((*p & 0x9F000000) == 0x90000000 && "Expected adrp instruction.");
84
85 // Get the 21 bit addend encoded in the adrp instruction and sign-extend
86 // to 64 bit. The lower 12 bits (4096 byte page) are always zeros and are
87 // therefore implicit (<< 12).
88 Addend = ((*p & 0x60000000) >> 29) | ((*p & 0x01FFFFE0) >> 3) << 12;
89 Addend = SignExtend64(Addend, 33);
90 break;
91 }
92 case MachO::ARM64_RELOC_GOT_LOAD_PAGEOFF12: {
93 // Verify that the relocation points to one of the expected load / store
94 // instructions.
Juergen Ributzka0e913b12014-07-29 19:57:15 +000095 auto *p = reinterpret_cast<support::aligned_ulittle32_t *>(LocalAddress);
Juergen Ributzka0e957cf2014-07-22 22:02:19 +000096 (void)p;
Juergen Ributzkab13b52e2014-07-22 21:42:51 +000097 assert((*p & 0x3B000000) == 0x39000000 &&
98 "Only expected load / store instructions.");
99 } // fall-through
100 case MachO::ARM64_RELOC_PAGEOFF12: {
101 // Verify that the relocation points to one of the expected load / store
102 // or add / sub instructions.
Juergen Ributzka0e913b12014-07-29 19:57:15 +0000103 auto *p = reinterpret_cast<support::aligned_ulittle32_t *>(LocalAddress);
Juergen Ributzkab13b52e2014-07-22 21:42:51 +0000104 assert((((*p & 0x3B000000) == 0x39000000) ||
105 ((*p & 0x11C00000) == 0x11000000) ) &&
106 "Expected load / store or add/sub instruction.");
107
108 // Get the 12 bit addend encoded in the instruction.
109 Addend = (*p & 0x003FFC00) >> 10;
110
111 // Check which instruction we are decoding to obtain the implicit shift
112 // factor of the instruction.
113 int ImplicitShift = 0;
114 if ((*p & 0x3B000000) == 0x39000000) { // << load / store
115 // For load / store instructions the size is encoded in bits 31:30.
116 ImplicitShift = ((*p >> 30) & 0x3);
117 if (ImplicitShift == 0) {
118 // Check if this a vector op to get the correct shift value.
119 if ((*p & 0x04800000) == 0x04800000)
120 ImplicitShift = 4;
121 }
122 }
123 // Compensate for implicit shift.
124 Addend <<= ImplicitShift;
125 break;
126 }
127 }
128 return Addend;
129 }
130
Juergen Ributzkaf5609282014-07-22 21:42:55 +0000131 /// Extract the addend encoded in the instruction.
Juergen Ributzka0e913b12014-07-29 19:57:15 +0000132 void encodeAddend(uint8_t *LocalAddress, unsigned NumBytes,
133 MachO::RelocationInfoType RelType, int64_t Addend) const {
Juergen Ributzkaf5609282014-07-22 21:42:55 +0000134 // Verify that the relocation has the correct alignment.
135 switch (RelType) {
136 default:
137 llvm_unreachable("Unsupported relocation type!");
138 case MachO::ARM64_RELOC_UNSIGNED:
Juergen Ributzka0e913b12014-07-29 19:57:15 +0000139 assert((NumBytes == 4 || NumBytes == 8) && "Invalid relocation size.");
140 break;
Juergen Ributzkaf5609282014-07-22 21:42:55 +0000141 case MachO::ARM64_RELOC_BRANCH26:
142 case MachO::ARM64_RELOC_PAGE21:
143 case MachO::ARM64_RELOC_PAGEOFF12:
144 case MachO::ARM64_RELOC_GOT_LOAD_PAGE21:
145 case MachO::ARM64_RELOC_GOT_LOAD_PAGEOFF12:
Juergen Ributzka0e913b12014-07-29 19:57:15 +0000146 assert(NumBytes == 4 && "Invalid relocation size.");
Juergen Ributzkaf5609282014-07-22 21:42:55 +0000147 assert((((uintptr_t)LocalAddress & 0x3) == 0) &&
148 "Instruction address is not aligned to 4 bytes.");
149 break;
150 }
151
152 switch (RelType) {
153 default:
154 llvm_unreachable("Unsupported relocation type!");
Juergen Ributzka0e913b12014-07-29 19:57:15 +0000155 case MachO::ARM64_RELOC_UNSIGNED:
156 // This could be an unaligned memory location.
157 if (NumBytes == 4)
158 *reinterpret_cast<support::ulittle32_t *>(LocalAddress) = Addend;
159 else
160 *reinterpret_cast<support::ulittle64_t *>(LocalAddress) = Addend;
161 break;
Juergen Ributzkaf5609282014-07-22 21:42:55 +0000162 case MachO::ARM64_RELOC_BRANCH26: {
Juergen Ributzka0e913b12014-07-29 19:57:15 +0000163 auto *p = reinterpret_cast<support::aligned_ulittle32_t *>(LocalAddress);
Juergen Ributzkaf5609282014-07-22 21:42:55 +0000164 // Verify that the relocation points to the expected branch instruction.
Juergen Ributzkaf5609282014-07-22 21:42:55 +0000165 assert((*p & 0xFC000000) == 0x14000000 && "Expected branch instruction.");
166
167 // Verify addend value.
168 assert((Addend & 0x3) == 0 && "Branch target is not aligned");
169 assert(isInt<28>(Addend) && "Branch target is out of range.");
170
171 // Encode the addend as 26 bit immediate in the branch instruction.
172 *p = (*p & 0xFC000000) | ((uint32_t)(Addend >> 2) & 0x03FFFFFF);
173 break;
174 }
175 case MachO::ARM64_RELOC_GOT_LOAD_PAGE21:
176 case MachO::ARM64_RELOC_PAGE21: {
177 // Verify that the relocation points to the expected adrp instruction.
Juergen Ributzka0e913b12014-07-29 19:57:15 +0000178 auto *p = reinterpret_cast<support::aligned_ulittle32_t *>(LocalAddress);
Juergen Ributzkaf5609282014-07-22 21:42:55 +0000179 assert((*p & 0x9F000000) == 0x90000000 && "Expected adrp instruction.");
180
181 // Check that the addend fits into 21 bits (+ 12 lower bits).
182 assert((Addend & 0xFFF) == 0 && "ADRP target is not page aligned.");
183 assert(isInt<33>(Addend) && "Invalid page reloc value.");
184
185 // Encode the addend into the instruction.
186 uint32_t ImmLoValue = (uint32_t)(Addend << 17) & 0x60000000;
187 uint32_t ImmHiValue = (uint32_t)(Addend >> 9) & 0x00FFFFE0;
188 *p = (*p & 0x9F00001F) | ImmHiValue | ImmLoValue;
189 break;
190 }
191 case MachO::ARM64_RELOC_GOT_LOAD_PAGEOFF12: {
192 // Verify that the relocation points to one of the expected load / store
193 // instructions.
Juergen Ributzka0e913b12014-07-29 19:57:15 +0000194 auto *p = reinterpret_cast<support::aligned_ulittle32_t *>(LocalAddress);
Juergen Ributzkaf5609282014-07-22 21:42:55 +0000195 assert((*p & 0x3B000000) == 0x39000000 &&
196 "Only expected load / store instructions.");
NAKAMURA Takumiea4a8da2014-07-23 00:17:44 +0000197 (void)p;
Juergen Ributzkaf5609282014-07-22 21:42:55 +0000198 } // fall-through
199 case MachO::ARM64_RELOC_PAGEOFF12: {
200 // Verify that the relocation points to one of the expected load / store
201 // or add / sub instructions.
Juergen Ributzka0e913b12014-07-29 19:57:15 +0000202 auto *p = reinterpret_cast<support::aligned_ulittle32_t *>(LocalAddress);
Juergen Ributzkaf5609282014-07-22 21:42:55 +0000203 assert((((*p & 0x3B000000) == 0x39000000) ||
204 ((*p & 0x11C00000) == 0x11000000) ) &&
205 "Expected load / store or add/sub instruction.");
206
207 // Check which instruction we are decoding to obtain the implicit shift
208 // factor of the instruction and verify alignment.
209 int ImplicitShift = 0;
210 if ((*p & 0x3B000000) == 0x39000000) { // << load / store
211 // For load / store instructions the size is encoded in bits 31:30.
212 ImplicitShift = ((*p >> 30) & 0x3);
213 switch (ImplicitShift) {
214 case 0:
215 // Check if this a vector op to get the correct shift value.
216 if ((*p & 0x04800000) == 0x04800000) {
217 ImplicitShift = 4;
218 assert(((Addend & 0xF) == 0) &&
219 "128-bit LDR/STR not 16-byte aligned.");
220 }
221 break;
222 case 1:
223 assert(((Addend & 0x1) == 0) && "16-bit LDR/STR not 2-byte aligned.");
224 break;
225 case 2:
226 assert(((Addend & 0x3) == 0) && "32-bit LDR/STR not 4-byte aligned.");
227 break;
228 case 3:
229 assert(((Addend & 0x7) == 0) && "64-bit LDR/STR not 8-byte aligned.");
230 break;
231 }
232 }
233 // Compensate for implicit shift.
234 Addend >>= ImplicitShift;
235 assert(isUInt<12>(Addend) && "Addend cannot be encoded.");
236
237 // Encode the addend into the instruction.
238 *p = (*p & 0xFFC003FF) | ((uint32_t)(Addend << 10) & 0x003FFC00);
239 break;
240 }
241 }
242 }
243
Lang Hamesa5216882014-07-17 18:54:50 +0000244 relocation_iterator
245 processRelocationRef(unsigned SectionID, relocation_iterator RelI,
246 ObjectImage &ObjImg, ObjSectionToIDMap &ObjSectionToID,
247 const SymbolTableMap &Symbols, StubMap &Stubs) override {
248 const MachOObjectFile &Obj =
249 static_cast<const MachOObjectFile &>(*ObjImg.getObjectFile());
250 MachO::any_relocation_info RelInfo =
251 Obj.getRelocation(RelI->getRawDataRefImpl());
252
253 assert(!Obj.isRelocationScattered(RelInfo) && "");
254
255 // ARM64 has an ARM64_RELOC_ADDEND relocation type that carries an explicit
256 // addend for the following relocation. If found: (1) store the associated
257 // addend, (2) consume the next relocation, and (3) use the stored addend to
258 // override the addend.
Lang Hamesa5216882014-07-17 18:54:50 +0000259 int64_t ExplicitAddend = 0;
260 if (Obj.getAnyRelocationType(RelInfo) == MachO::ARM64_RELOC_ADDEND) {
261 assert(!Obj.getPlainRelocationExternal(RelInfo));
262 assert(!Obj.getAnyRelocationPCRel(RelInfo));
263 assert(Obj.getAnyRelocationLength(RelInfo) == 2);
Lang Hamesa5216882014-07-17 18:54:50 +0000264 int64_t RawAddend = Obj.getPlainRelocationSymbolNum(RelInfo);
265 // Sign-extend the 24-bit to 64-bit.
Juergen Ributzkadd19d332014-07-22 21:42:49 +0000266 ExplicitAddend = SignExtend64(RawAddend, 24);
Lang Hamesa5216882014-07-17 18:54:50 +0000267 ++RelI;
268 RelInfo = Obj.getRelocation(RelI->getRawDataRefImpl());
269 }
270
Lang Hames25d93092014-08-08 23:12:22 +0000271 RelocationEntry RE(getRelocationEntry(SectionID, ObjImg, RelI));
272 RE.Addend = decodeAddend(RE);
Lang Hamesa5216882014-07-17 18:54:50 +0000273 RelocationValueRef Value(
274 getRelocationValueRef(ObjImg, RelI, RE, ObjSectionToID, Symbols));
275
Juergen Ributzkadd19d332014-07-22 21:42:49 +0000276 assert((ExplicitAddend == 0 || RE.Addend == 0) && "Relocation has "\
277 "ARM64_RELOC_ADDEND and embedded addend in the instruction.");
278 if (ExplicitAddend) {
Lang Hames76774a52014-07-18 20:29:36 +0000279 RE.Addend = ExplicitAddend;
Lang Hamesa5216882014-07-17 18:54:50 +0000280 Value.Addend = ExplicitAddend;
Lang Hames76774a52014-07-18 20:29:36 +0000281 }
Lang Hamesa5216882014-07-17 18:54:50 +0000282
283 bool IsExtern = Obj.getPlainRelocationExternal(RelInfo);
284 if (!IsExtern && RE.IsPCRel)
Lang Hames13163652014-07-30 03:35:05 +0000285 makeValueAddendPCRel(Value, ObjImg, RelI, 1 << RE.Size);
Lang Hamesa5216882014-07-17 18:54:50 +0000286
287 RE.Addend = Value.Addend;
288
289 if (RE.RelType == MachO::ARM64_RELOC_GOT_LOAD_PAGE21 ||
290 RE.RelType == MachO::ARM64_RELOC_GOT_LOAD_PAGEOFF12)
291 processGOTRelocation(RE, Value, Stubs);
292 else {
293 if (Value.SymbolName)
294 addRelocationForSymbol(RE, Value.SymbolName);
295 else
296 addRelocationForSection(RE, Value.SectionID);
297 }
298
299 return ++RelI;
300 }
301
Benjamin Kramer8c90fd72014-09-03 11:41:21 +0000302 void resolveRelocation(const RelocationEntry &RE, uint64_t Value) override {
Lang Hamesa5216882014-07-17 18:54:50 +0000303 DEBUG(dumpRelocationToResolve(RE, Value));
304
305 const SectionEntry &Section = Sections[RE.SectionID];
306 uint8_t *LocalAddress = Section.Address + RE.Offset;
Juergen Ributzkafbd40c32014-07-29 19:57:11 +0000307 MachO::RelocationInfoType RelType =
308 static_cast<MachO::RelocationInfoType>(RE.RelType);
Lang Hamesa5216882014-07-17 18:54:50 +0000309
Juergen Ributzkafbd40c32014-07-29 19:57:11 +0000310 switch (RelType) {
Lang Hamesa5216882014-07-17 18:54:50 +0000311 default:
312 llvm_unreachable("Invalid relocation type!");
313 case MachO::ARM64_RELOC_UNSIGNED: {
314 assert(!RE.IsPCRel && "PCRel and ARM64_RELOC_UNSIGNED not supported");
315 // Mask in the target value a byte at a time (we don't have an alignment
316 // guarantee for the target address, so this is safest).
317 if (RE.Size < 2)
318 llvm_unreachable("Invalid size for ARM64_RELOC_UNSIGNED");
319
Juergen Ributzka0e913b12014-07-29 19:57:15 +0000320 encodeAddend(LocalAddress, 1 << RE.Size, RelType, Value + RE.Addend);
Lang Hamesa5216882014-07-17 18:54:50 +0000321 break;
322 }
323 case MachO::ARM64_RELOC_BRANCH26: {
324 assert(RE.IsPCRel && "not PCRel and ARM64_RELOC_BRANCH26 not supported");
Lang Hamesa5216882014-07-17 18:54:50 +0000325 // Check if branch is in range.
326 uint64_t FinalAddress = Section.LoadAddress + RE.Offset;
Juergen Ributzkaf5609282014-07-22 21:42:55 +0000327 int64_t PCRelVal = Value - FinalAddress + RE.Addend;
Juergen Ributzka0e913b12014-07-29 19:57:15 +0000328 encodeAddend(LocalAddress, /*Size=*/4, RelType, PCRelVal);
Lang Hamesa5216882014-07-17 18:54:50 +0000329 break;
330 }
331 case MachO::ARM64_RELOC_GOT_LOAD_PAGE21:
332 case MachO::ARM64_RELOC_PAGE21: {
333 assert(RE.IsPCRel && "not PCRel and ARM64_RELOC_PAGE21 not supported");
Lang Hamesa5216882014-07-17 18:54:50 +0000334 // Adjust for PC-relative relocation and offset.
335 uint64_t FinalAddress = Section.LoadAddress + RE.Offset;
Juergen Ributzkaf5609282014-07-22 21:42:55 +0000336 int64_t PCRelVal =
337 ((Value + RE.Addend) & (-4096)) - (FinalAddress & (-4096));
Juergen Ributzka0e913b12014-07-29 19:57:15 +0000338 encodeAddend(LocalAddress, /*Size=*/4, RelType, PCRelVal);
Lang Hamesa5216882014-07-17 18:54:50 +0000339 break;
340 }
341 case MachO::ARM64_RELOC_GOT_LOAD_PAGEOFF12:
342 case MachO::ARM64_RELOC_PAGEOFF12: {
343 assert(!RE.IsPCRel && "PCRel and ARM64_RELOC_PAGEOFF21 not supported");
Lang Hamesa5216882014-07-17 18:54:50 +0000344 // Add the offset from the symbol.
345 Value += RE.Addend;
346 // Mask out the page address and only use the lower 12 bits.
347 Value &= 0xFFF;
Juergen Ributzka0e913b12014-07-29 19:57:15 +0000348 encodeAddend(LocalAddress, /*Size=*/4, RelType, Value);
Lang Hamesa5216882014-07-17 18:54:50 +0000349 break;
350 }
351 case MachO::ARM64_RELOC_SUBTRACTOR:
352 case MachO::ARM64_RELOC_POINTER_TO_GOT:
353 case MachO::ARM64_RELOC_TLVP_LOAD_PAGE21:
354 case MachO::ARM64_RELOC_TLVP_LOAD_PAGEOFF12:
Juergen Ributzkaf5609282014-07-22 21:42:55 +0000355 llvm_unreachable("Relocation type not yet implemented!");
Lang Hamesa5216882014-07-17 18:54:50 +0000356 case MachO::ARM64_RELOC_ADDEND:
357 llvm_unreachable("ARM64_RELOC_ADDEND should have been handeled by "
358 "processRelocationRef!");
359 }
360 }
361
362 void finalizeSection(ObjectImage &ObjImg, unsigned SectionID,
363 const SectionRef &Section) {}
364
365private:
366 void processGOTRelocation(const RelocationEntry &RE,
367 RelocationValueRef &Value, StubMap &Stubs) {
368 assert(RE.Size == 2);
369 SectionEntry &Section = Sections[RE.SectionID];
370 StubMap::const_iterator i = Stubs.find(Value);
Lang Hames4ea28e22014-08-07 20:41:57 +0000371 uintptr_t Addr;
Lang Hamesa5216882014-07-17 18:54:50 +0000372 if (i != Stubs.end())
Lang Hames4ea28e22014-08-07 20:41:57 +0000373 Addr = reinterpret_cast<uintptr_t>(Section.Address) + i->second;
Lang Hamesa5216882014-07-17 18:54:50 +0000374 else {
375 // FIXME: There must be a better way to do this then to check and fix the
376 // alignment every time!!!
377 uintptr_t BaseAddress = uintptr_t(Section.Address);
378 uintptr_t StubAlignment = getStubAlignment();
379 uintptr_t StubAddress =
380 (BaseAddress + Section.StubOffset + StubAlignment - 1) &
381 -StubAlignment;
382 unsigned StubOffset = StubAddress - BaseAddress;
383 Stubs[Value] = StubOffset;
384 assert(((StubAddress % getStubAlignment()) == 0) &&
385 "GOT entry not aligned");
386 RelocationEntry GOTRE(RE.SectionID, StubOffset,
387 MachO::ARM64_RELOC_UNSIGNED, Value.Addend,
388 /*IsPCRel=*/false, /*Size=*/3);
389 if (Value.SymbolName)
390 addRelocationForSymbol(GOTRE, Value.SymbolName);
391 else
392 addRelocationForSection(GOTRE, Value.SectionID);
393 Section.StubOffset = StubOffset + getMaxStubSize();
Lang Hames4ea28e22014-08-07 20:41:57 +0000394 Addr = StubAddress;
Lang Hamesa5216882014-07-17 18:54:50 +0000395 }
396 RelocationEntry TargetRE(RE.SectionID, RE.Offset, RE.RelType, /*Addend=*/0,
397 RE.IsPCRel, RE.Size);
Lang Hames4ea28e22014-08-07 20:41:57 +0000398 resolveRelocation(TargetRE, static_cast<uint64_t>(Addr));
Lang Hamesa5216882014-07-17 18:54:50 +0000399 }
400};
401}
402
403#undef DEBUG_TYPE
404
Benjamin Kramera7c40ef2014-08-13 16:26:38 +0000405#endif