LLVM 23.0.0git
AArch64ELFObjectWriter.cpp
Go to the documentation of this file.
1//===-- AArch64ELFObjectWriter.cpp - AArch64 ELF Writer -------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file handles ELF-specific object emission, converting LLVM's internal
10// fixups into the appropriate relocations.
11//
12//===----------------------------------------------------------------------===//
13
18#include "llvm/MC/MCContext.h"
20#include "llvm/MC/MCFixup.h"
22#include "llvm/MC/MCSymbolELF.h"
23#include "llvm/MC/MCValue.h"
25#include <cassert>
26#include <cstdint>
27
28using namespace llvm;
29
30namespace {
31
32class AArch64ELFObjectWriter : public MCELFObjectTargetWriter {
33public:
34 AArch64ELFObjectWriter(uint8_t OSABI, bool IsILP32);
35
36 ~AArch64ELFObjectWriter() override = default;
37
38protected:
39 unsigned getRelocType(const MCFixup &, const MCValue &,
40 bool IsPCRel) const override;
41 bool needsRelocateWithSymbol(const MCValue &, unsigned Type) const override;
42 bool isNonILP32reloc(const MCFixup &Fixup, AArch64::Specifier RefKind) const;
43 void sortRelocs(std::vector<ELFRelocationEntry> &Relocs) override;
44
45 bool IsILP32;
46};
47
48} // end anonymous namespace
49
50AArch64ELFObjectWriter::AArch64ELFObjectWriter(uint8_t OSABI, bool IsILP32)
51 : MCELFObjectTargetWriter(/*Is64Bit*/ !IsILP32, OSABI, ELF::EM_AARCH64,
52 /*HasRelocationAddend*/ true),
53 IsILP32(IsILP32) {}
54
55#define R_CLS(rtype) \
56 IsILP32 ? ELF::R_AARCH64_P32_##rtype : ELF::R_AARCH64_##rtype
57
58// assumes IsILP32 is true
59bool AArch64ELFObjectWriter::isNonILP32reloc(const MCFixup &Fixup,
60 AArch64::Specifier RefKind) const {
61 if (Fixup.getKind() != AArch64::fixup_aarch64_movw)
62 return false;
63 switch (RefKind) {
76 reportError(Fixup.getLoc(),
77 "absolute MOV relocation is not supported in ILP32");
78 return true;
79 default:
80 return false;
81 }
82 return false;
83}
84
85unsigned AArch64ELFObjectWriter::getRelocType(const MCFixup &Fixup,
86 const MCValue &Target,
87 bool IsPCRel) const {
88 auto Kind = Fixup.getKind();
89 AArch64::Specifier RefKind =
90 static_cast<AArch64::Specifier>(Target.getSpecifier());
92 bool IsNC = AArch64::isNotChecked(RefKind);
93
94 switch (SymLoc) {
100 if (auto *SA = const_cast<MCSymbol *>(Target.getAddSym()))
101 static_cast<MCSymbolELF *>(SA)->setType(ELF::STT_TLS);
102 break;
103 default:
104 break;
105 }
106
107 switch (RefKind) {
109 case AArch64::S_PLT:
110 if (Kind == FK_Data_4)
111 break;
112 // Only R_AARCH64_PLT32/R_AARCH64_GOTPCREL32 defined at present, but can
113 // be extended to other sizes if additional relocations are defined.
114 reportError(Fixup.getLoc(), AArch64::getSpecifierName(RefKind) +
115 " can only be used in a .word directive");
116 return ELF::R_AARCH64_NONE;
117 default:
118 break;
119 }
120
121 // Extract the relocation type from the fixup kind, after applying STT_TLS as
122 // needed.
123 if (mc::isRelocation(Fixup.getKind()))
124 return Kind;
125
126 if (IsPCRel) {
127 switch (Kind) {
128 case FK_Data_1:
129 reportError(Fixup.getLoc(), "1-byte data relocations not supported");
130 return ELF::R_AARCH64_NONE;
131 case FK_Data_2:
132 return R_CLS(PREL16);
133 case FK_Data_4: {
134 return R_CLS(PREL32);
135 }
136 case FK_Data_8:
137 if (IsILP32) {
138 reportError(Fixup.getLoc(), "8 byte PC relative data "
139 "relocation is not supported in ILP32");
140 return ELF::R_AARCH64_NONE;
141 }
142 return ELF::R_AARCH64_PREL64;
144 if (SymLoc == AArch64::S_GOT_AUTH) {
145 if (IsILP32) {
146 reportError(Fixup.getLoc(),
147 "ADR AUTH relocation is not supported in ILP32");
148 return ELF::R_AARCH64_NONE;
149 }
150 return ELF::R_AARCH64_AUTH_GOT_ADR_PREL_LO21;
151 }
152 if (SymLoc != AArch64::S_ABS)
153 reportError(Fixup.getLoc(), "invalid symbol kind for ADR relocation");
154 return R_CLS(ADR_PREL_LO21);
156 if (SymLoc == AArch64::S_ABS && !IsNC)
157 return R_CLS(ADR_PREL_PG_HI21);
158 if (SymLoc == AArch64::S_ABS && IsNC) {
159 if (IsILP32) {
160 reportError(Fixup.getLoc(),
161 "invalid fixup for 32-bit pcrel ADRP instruction "
162 "VK_ABS VK_NC");
163 return ELF::R_AARCH64_NONE;
164 }
165 return ELF::R_AARCH64_ADR_PREL_PG_HI21_NC;
166 }
167 if (SymLoc == AArch64::S_GOT && !IsNC)
168 return R_CLS(ADR_GOT_PAGE);
169 if (SymLoc == AArch64::S_GOT_AUTH && !IsNC) {
170 if (IsILP32) {
171 reportError(Fixup.getLoc(),
172 "ADRP AUTH relocation is not supported in ILP32");
173 return ELF::R_AARCH64_NONE;
174 }
175 return ELF::R_AARCH64_AUTH_ADR_GOT_PAGE;
176 }
177 if (SymLoc == AArch64::S_GOTTPREL && !IsNC)
178 return R_CLS(TLSIE_ADR_GOTTPREL_PAGE21);
179 if (SymLoc == AArch64::S_TLSDESC && !IsNC)
180 return R_CLS(TLSDESC_ADR_PAGE21);
181 if (SymLoc == AArch64::S_TLSDESC_AUTH && !IsNC) {
182 if (IsILP32) {
183 reportError(Fixup.getLoc(),
184 "ADRP AUTH relocation is not supported in ILP32");
185 return ELF::R_AARCH64_NONE;
186 }
187 return ELF::R_AARCH64_AUTH_TLSDESC_ADR_PAGE21;
188 }
189 reportError(Fixup.getLoc(), "invalid symbol kind for ADRP relocation");
190 return ELF::R_AARCH64_NONE;
192 return R_CLS(JUMP26);
194 return R_CLS(CALL26);
196 if (SymLoc == AArch64::S_GOTTPREL)
197 return R_CLS(TLSIE_LD_GOTTPREL_PREL19);
198 if (SymLoc == AArch64::S_GOT)
199 return R_CLS(GOT_LD_PREL19);
200 if (SymLoc == AArch64::S_GOT_AUTH) {
201 if (IsILP32) {
202 reportError(Fixup.getLoc(),
203 "LDR AUTH relocation is not supported in ILP32");
204 return ELF::R_AARCH64_NONE;
205 }
206 return ELF::R_AARCH64_AUTH_GOT_LD_PREL19;
207 }
208 return R_CLS(LD_PREL_LO19);
210 return R_CLS(TSTBR14);
212 reportError(Fixup.getLoc(),
213 "relocation of PAC/AUT instructions is not supported");
214 return ELF::R_AARCH64_NONE;
217 Fixup.getLoc(),
218 "relocation of compare-and-branch instructions not supported");
219 return ELF::R_AARCH64_NONE;
221 return R_CLS(CONDBR19);
222 default:
223 reportError(Fixup.getLoc(), "Unsupported pc-relative fixup kind");
224 return ELF::R_AARCH64_NONE;
225 }
226 } else {
227 if (IsILP32 && isNonILP32reloc(Fixup, RefKind))
228 return ELF::R_AARCH64_NONE;
229 switch (Fixup.getKind()) {
230 case FK_Data_1:
231 reportError(Fixup.getLoc(), "1-byte data relocations not supported");
232 return ELF::R_AARCH64_NONE;
233 case FK_Data_2:
234 return R_CLS(ABS16);
235 case FK_Data_4:
236 if (!IsILP32) {
237 if (Target.getSpecifier() == AArch64::S_GOTPCREL)
238 return ELF::R_AARCH64_GOTPCREL32;
239 if (Target.getSpecifier() == AArch64::S_PLT)
240 return ELF::R_AARCH64_PLT32;
241 }
242 return R_CLS(ABS32);
243 case FK_Data_8: {
244 if (IsILP32) {
246 Fixup.getLoc(),
247 "8 byte absolute data relocation is not supported in ILP32");
248 return ELF::R_AARCH64_NONE;
249 }
250 if (RefKind == AArch64::S_AUTH || RefKind == AArch64::S_AUTHADDR)
251 return ELF::R_AARCH64_AUTH_ABS64;
252 if (RefKind == AArch64::S_DTPREL)
253 return ELF::R_AARCH64_TLS_DTPREL64;
254 if (RefKind == AArch64::S_FUNCINIT)
255 return ELF::R_AARCH64_FUNCINIT64;
256 return ELF::R_AARCH64_ABS64;
257 }
259 if (RefKind == AArch64::S_DTPREL_HI12)
260 return R_CLS(TLSLD_ADD_DTPREL_HI12);
261 if (RefKind == AArch64::S_TPREL_HI12)
262 return R_CLS(TLSLE_ADD_TPREL_HI12);
263 if (RefKind == AArch64::S_DTPREL_LO12_NC)
264 return R_CLS(TLSLD_ADD_DTPREL_LO12_NC);
265 if (RefKind == AArch64::S_DTPREL_LO12)
266 return R_CLS(TLSLD_ADD_DTPREL_LO12);
267 if (RefKind == AArch64::S_TPREL_LO12_NC)
268 return R_CLS(TLSLE_ADD_TPREL_LO12_NC);
269 if (RefKind == AArch64::S_TPREL_LO12)
270 return R_CLS(TLSLE_ADD_TPREL_LO12);
271 if (RefKind == AArch64::S_TLSDESC_LO12)
272 return R_CLS(TLSDESC_ADD_LO12);
273 if (RefKind == AArch64::S_TLSDESC_AUTH_LO12) {
274 if (IsILP32) {
275 reportError(Fixup.getLoc(),
276 "ADD AUTH relocation is not supported in ILP32");
277 return ELF::R_AARCH64_NONE;
278 }
279 return ELF::R_AARCH64_AUTH_TLSDESC_ADD_LO12;
280 }
281 if (RefKind == AArch64::S_GOT_AUTH_LO12 && IsNC) {
282 if (IsILP32) {
283 reportError(Fixup.getLoc(),
284 "ADD AUTH relocation is not supported in ILP32");
285 return ELF::R_AARCH64_NONE;
286 }
287 return ELF::R_AARCH64_AUTH_GOT_ADD_LO12_NC;
288 }
289 if (SymLoc == AArch64::S_ABS && IsNC)
290 return R_CLS(ADD_ABS_LO12_NC);
291
292 reportError(Fixup.getLoc(), "invalid fixup for add (uimm12) instruction");
293 return ELF::R_AARCH64_NONE;
295 if (SymLoc == AArch64::S_ABS && IsNC)
296 return R_CLS(LDST8_ABS_LO12_NC);
297 if (SymLoc == AArch64::S_DTPREL && !IsNC)
298 return R_CLS(TLSLD_LDST8_DTPREL_LO12);
299 if (SymLoc == AArch64::S_DTPREL && IsNC)
300 return R_CLS(TLSLD_LDST8_DTPREL_LO12_NC);
301 if (SymLoc == AArch64::S_TPREL && !IsNC)
302 return R_CLS(TLSLE_LDST8_TPREL_LO12);
303 if (SymLoc == AArch64::S_TPREL && IsNC)
304 return R_CLS(TLSLE_LDST8_TPREL_LO12_NC);
305
306 reportError(Fixup.getLoc(),
307 "invalid fixup for 8-bit load/store instruction");
308 return ELF::R_AARCH64_NONE;
310 if (SymLoc == AArch64::S_ABS && IsNC)
311 return R_CLS(LDST16_ABS_LO12_NC);
312 if (SymLoc == AArch64::S_DTPREL && !IsNC)
313 return R_CLS(TLSLD_LDST16_DTPREL_LO12);
314 if (SymLoc == AArch64::S_DTPREL && IsNC)
315 return R_CLS(TLSLD_LDST16_DTPREL_LO12_NC);
316 if (SymLoc == AArch64::S_TPREL && !IsNC)
317 return R_CLS(TLSLE_LDST16_TPREL_LO12);
318 if (SymLoc == AArch64::S_TPREL && IsNC)
319 return R_CLS(TLSLE_LDST16_TPREL_LO12_NC);
320
321 reportError(Fixup.getLoc(),
322 "invalid fixup for 16-bit load/store instruction");
323 return ELF::R_AARCH64_NONE;
325 if (SymLoc == AArch64::S_ABS && IsNC)
326 return R_CLS(LDST32_ABS_LO12_NC);
327 if (SymLoc == AArch64::S_DTPREL && !IsNC)
328 return R_CLS(TLSLD_LDST32_DTPREL_LO12);
329 if (SymLoc == AArch64::S_DTPREL && IsNC)
330 return R_CLS(TLSLD_LDST32_DTPREL_LO12_NC);
331 if (SymLoc == AArch64::S_TPREL && !IsNC)
332 return R_CLS(TLSLE_LDST32_TPREL_LO12);
333 if (SymLoc == AArch64::S_TPREL && IsNC)
334 return R_CLS(TLSLE_LDST32_TPREL_LO12_NC);
335 if (SymLoc == AArch64::S_GOT && IsNC) {
336 if (IsILP32)
337 return ELF::R_AARCH64_P32_LD32_GOT_LO12_NC;
338 reportError(Fixup.getLoc(), "4 byte unchecked GOT load/store "
339 "relocation is not supported in LP64");
340 return ELF::R_AARCH64_NONE;
341 }
342 if (SymLoc == AArch64::S_GOT && !IsNC) {
343 if (IsILP32) {
345 Fixup.getLoc(),
346 "4 byte checked GOT load/store relocation is not supported");
347 }
348 return ELF::R_AARCH64_NONE;
349 }
350 if (SymLoc == AArch64::S_GOTTPREL && IsNC) {
351 if (IsILP32)
352 return ELF::R_AARCH64_P32_TLSIE_LD32_GOTTPREL_LO12_NC;
353 reportError(Fixup.getLoc(), "32-bit load/store "
354 "relocation is not supported in LP64");
355 return ELF::R_AARCH64_NONE;
356 }
357 if (SymLoc == AArch64::S_TLSDESC && !IsNC) {
358 if (IsILP32)
359 return ELF::R_AARCH64_P32_TLSDESC_LD32_LO12;
361 Fixup.getLoc(),
362 "4 byte TLSDESC load/store relocation is not supported in LP64");
363 return ELF::R_AARCH64_NONE;
364 }
365
366 reportError(Fixup.getLoc(),
367 "invalid fixup for 32-bit load/store instruction "
368 "fixup_aarch64_ldst_imm12_scale4");
369 return ELF::R_AARCH64_NONE;
371 if (SymLoc == AArch64::S_ABS && IsNC)
372 return R_CLS(LDST64_ABS_LO12_NC);
373 if ((SymLoc == AArch64::S_GOT || SymLoc == AArch64::S_GOT_AUTH) && IsNC) {
374 AArch64::Specifier AddressLoc = AArch64::getAddressFrag(RefKind);
375 bool IsAuth = (SymLoc == AArch64::S_GOT_AUTH);
376 if (!IsILP32) {
377 if (AddressLoc == AArch64::S_LO15)
378 return ELF::R_AARCH64_LD64_GOTPAGE_LO15;
379 return (IsAuth ? ELF::R_AARCH64_AUTH_LD64_GOT_LO12_NC
380 : ELF::R_AARCH64_LD64_GOT_LO12_NC);
381 }
382 reportError(Fixup.getLoc(),
383 "64-bit load/store relocation is not supported in ILP32");
384 return ELF::R_AARCH64_NONE;
385 }
386 if (SymLoc == AArch64::S_DTPREL && !IsNC)
387 return R_CLS(TLSLD_LDST64_DTPREL_LO12);
388 if (SymLoc == AArch64::S_DTPREL && IsNC)
389 return R_CLS(TLSLD_LDST64_DTPREL_LO12_NC);
390 if (SymLoc == AArch64::S_TPREL && !IsNC)
391 return R_CLS(TLSLE_LDST64_TPREL_LO12);
392 if (SymLoc == AArch64::S_TPREL && IsNC)
393 return R_CLS(TLSLE_LDST64_TPREL_LO12_NC);
394 if (SymLoc == AArch64::S_GOTTPREL && IsNC) {
395 if (!IsILP32)
396 return ELF::R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC;
397 reportError(Fixup.getLoc(),
398 "64-bit load/store relocation is not supported in ILP32");
399 return ELF::R_AARCH64_NONE;
400 }
401 if (SymLoc == AArch64::S_TLSDESC) {
402 if (!IsILP32)
403 return ELF::R_AARCH64_TLSDESC_LD64_LO12;
404 reportError(Fixup.getLoc(),
405 "64-bit load/store relocation is not supported in ILP32");
406 return ELF::R_AARCH64_NONE;
407 }
408 if (SymLoc == AArch64::S_TLSDESC_AUTH) {
409 if (!IsILP32)
410 return ELF::R_AARCH64_AUTH_TLSDESC_LD64_LO12;
412 Fixup.getLoc(),
413 "64-bit load/store AUTH relocation is not supported in ILP32");
414 return ELF::R_AARCH64_NONE;
415 }
416 reportError(Fixup.getLoc(),
417 "invalid fixup for 64-bit load/store instruction");
418 return ELF::R_AARCH64_NONE;
420 if (SymLoc == AArch64::S_ABS && IsNC)
421 return R_CLS(LDST128_ABS_LO12_NC);
422 if (SymLoc == AArch64::S_DTPREL && !IsNC)
423 return R_CLS(TLSLD_LDST128_DTPREL_LO12);
424 if (SymLoc == AArch64::S_DTPREL && IsNC)
425 return R_CLS(TLSLD_LDST128_DTPREL_LO12_NC);
426 if (SymLoc == AArch64::S_TPREL && !IsNC)
427 return R_CLS(TLSLE_LDST128_TPREL_LO12);
428 if (SymLoc == AArch64::S_TPREL && IsNC)
429 return R_CLS(TLSLE_LDST128_TPREL_LO12_NC);
430
431 reportError(Fixup.getLoc(),
432 "invalid fixup for 128-bit load/store instruction");
433 return ELF::R_AARCH64_NONE;
434 // ILP32 case not reached here, tested with isNonILP32reloc
436 if (RefKind == AArch64::S_ABS_G3)
437 return ELF::R_AARCH64_MOVW_UABS_G3;
438 if (RefKind == AArch64::S_ABS_G2)
439 return ELF::R_AARCH64_MOVW_UABS_G2;
440 if (RefKind == AArch64::S_ABS_G2_S)
441 return ELF::R_AARCH64_MOVW_SABS_G2;
442 if (RefKind == AArch64::S_ABS_G2_NC)
443 return ELF::R_AARCH64_MOVW_UABS_G2_NC;
444 if (RefKind == AArch64::S_ABS_G1)
445 return R_CLS(MOVW_UABS_G1);
446 if (RefKind == AArch64::S_ABS_G1_S)
447 return ELF::R_AARCH64_MOVW_SABS_G1;
448 if (RefKind == AArch64::S_ABS_G1_NC)
449 return ELF::R_AARCH64_MOVW_UABS_G1_NC;
450 if (RefKind == AArch64::S_ABS_G0)
451 return R_CLS(MOVW_UABS_G0);
452 if (RefKind == AArch64::S_ABS_G0_S)
453 return R_CLS(MOVW_SABS_G0);
454 if (RefKind == AArch64::S_ABS_G0_NC)
455 return R_CLS(MOVW_UABS_G0_NC);
456 if (RefKind == AArch64::S_PREL_G3)
457 return ELF::R_AARCH64_MOVW_PREL_G3;
458 if (RefKind == AArch64::S_PREL_G2)
459 return ELF::R_AARCH64_MOVW_PREL_G2;
460 if (RefKind == AArch64::S_PREL_G2_NC)
461 return ELF::R_AARCH64_MOVW_PREL_G2_NC;
462 if (RefKind == AArch64::S_PREL_G1)
463 return R_CLS(MOVW_PREL_G1);
464 if (RefKind == AArch64::S_PREL_G1_NC)
465 return ELF::R_AARCH64_MOVW_PREL_G1_NC;
466 if (RefKind == AArch64::S_PREL_G0)
467 return R_CLS(MOVW_PREL_G0);
468 if (RefKind == AArch64::S_PREL_G0_NC)
469 return R_CLS(MOVW_PREL_G0_NC);
470 if (RefKind == AArch64::S_DTPREL)
471 return ELF::R_AARCH64_TLS_DTPREL64;
472 if (RefKind == AArch64::S_DTPREL_G2)
473 return ELF::R_AARCH64_TLSLD_MOVW_DTPREL_G2;
474 if (RefKind == AArch64::S_DTPREL_G1)
475 return R_CLS(TLSLD_MOVW_DTPREL_G1);
476 if (RefKind == AArch64::S_DTPREL_G1_NC)
477 return ELF::R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC;
478 if (RefKind == AArch64::S_DTPREL_G0)
479 return R_CLS(TLSLD_MOVW_DTPREL_G0);
480 if (RefKind == AArch64::S_DTPREL_G0_NC)
481 return R_CLS(TLSLD_MOVW_DTPREL_G0_NC);
482 if (RefKind == AArch64::S_TPREL_G2)
483 return ELF::R_AARCH64_TLSLE_MOVW_TPREL_G2;
484 if (RefKind == AArch64::S_TPREL_G1)
485 return R_CLS(TLSLE_MOVW_TPREL_G1);
486 if (RefKind == AArch64::S_TPREL_G1_NC)
487 return ELF::R_AARCH64_TLSLE_MOVW_TPREL_G1_NC;
488 if (RefKind == AArch64::S_TPREL_G0)
489 return R_CLS(TLSLE_MOVW_TPREL_G0);
490 if (RefKind == AArch64::S_TPREL_G0_NC)
491 return R_CLS(TLSLE_MOVW_TPREL_G0_NC);
492 if (RefKind == AArch64::S_GOTTPREL_G1)
493 return ELF::R_AARCH64_TLSIE_MOVW_GOTTPREL_G1;
494 if (RefKind == AArch64::S_GOTTPREL_G0_NC)
495 return ELF::R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC;
496 reportError(Fixup.getLoc(), "invalid fixup for movz/movk instruction");
497 return ELF::R_AARCH64_NONE;
498 default:
499 reportError(Fixup.getLoc(), "Unknown ELF relocation type");
500 return ELF::R_AARCH64_NONE;
501 }
502 }
503
504 llvm_unreachable("Unimplemented fixup -> relocation");
505}
506
507bool AArch64ELFObjectWriter::needsRelocateWithSymbol(const MCValue &Val,
508 unsigned) const {
509 // For memory-tagged symbols, ensure that the relocation uses the symbol. For
510 // tagged symbols, we emit an empty relocation (R_AARCH64_NONE) in a special
511 // section (SHT_AARCH64_MEMTAG_GLOBALS_STATIC) to indicate to the linker that
512 // this global needs to be tagged. In addition, the linker needs to know
513 // whether to emit a special addend when relocating `end` symbols, and this
514 // can only be determined by the attributes of the symbol itself.
515 if (Val.getAddSym() &&
516 static_cast<const MCSymbolELF *>(Val.getAddSym())->isMemtag())
517 return true;
518
520 return true;
522 Val.getSpecifier());
523}
524
525void AArch64ELFObjectWriter::sortRelocs(
526 std::vector<ELFRelocationEntry> &Relocs) {
527 // PATCHINST relocations should be applied last because they may overwrite the
528 // whole instruction and so should take precedence over other relocations that
529 // modify operands of the original instruction.
530 std::stable_partition(Relocs.begin(), Relocs.end(),
531 [](const ELFRelocationEntry &R) {
532 return R.Type != ELF::R_AARCH64_PATCHINST;
533 });
534}
535
536std::unique_ptr<MCObjectTargetWriter>
538 return std::make_unique<AArch64ELFObjectWriter>(OSABI, IsILP32);
539}
#define R_CLS(rtype)
static Error reportError(StringRef Message)
PowerPC TLS Dynamic Call Fixup
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition MCFixup.h:61
const MCSymbol * getAddSym() const
Definition MCValue.h:49
uint32_t getSpecifier() const
Definition MCValue.h:46
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Specifier getSymbolLoc(Specifier S)
StringRef getSpecifierName(Specifier S)
Return the string representation of the ELF relocation specifier (e.g.
bool isNotChecked(Specifier S)
Specifier getAddressFrag(Specifier S)
@ EM_AARCH64
Definition ELF.h:285
@ STT_TLS
Definition ELF.h:1421
bool isRelocation(MCFixupKind FixupKind)
Definition MCFixup.h:130
This is an optimization pass for GlobalISel generic memory operations.
Definition Types.h:26
@ FK_Data_8
A eight-byte fixup.
Definition MCFixup.h:37
@ FK_Data_1
A one-byte fixup.
Definition MCFixup.h:34
@ FK_Data_4
A four-byte fixup.
Definition MCFixup.h:36
@ FK_Data_2
A two-byte fixup.
Definition MCFixup.h:35
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
Definition STLExtras.h:1947
std::unique_ptr< MCObjectTargetWriter > createAArch64ELFObjectWriter(uint8_t OSABI, bool IsILP32)