33 AArch64ELFObjectWriter(uint8_t OSABI,
bool IsILP32);
35 ~AArch64ELFObjectWriter()
override =
default;
43 unsigned Type)
const override;
49AArch64ELFObjectWriter::AArch64ELFObjectWriter(uint8_t OSABI,
bool IsILP32)
55 IsILP32 ? ELF::R_AARCH64_P32_##rtype : ELF::R_AARCH64_##rtype
56#define BAD_ILP32_MOV(lp64rtype) \
57 "ILP32 absolute MOV relocation not " \
58 "supported (LP64 eqv: " #lp64rtype ")"
109unsigned AArch64ELFObjectWriter::getRelocType(
MCContext &Ctx,
112 bool IsPCRel)
const {
125 "Should only be expression-level modifiers here");
129 "Should only be expression-level modifiers here");
135 return ELF::R_AARCH64_NONE;
137 return R_CLS(PREL16);
146 "ILP32 8 byte PC relative data "
147 "relocation not supported (LP64 eqv: PREL64)");
148 return ELF::R_AARCH64_NONE;
150 return ELF::R_AARCH64_PREL64;
154 "invalid symbol kind for ADR relocation");
155 return R_CLS(ADR_PREL_LO21);
158 return R_CLS(ADR_PREL_PG_HI21);
162 "invalid fixup for 32-bit pcrel ADRP instruction "
164 return ELF::R_AARCH64_NONE;
166 return ELF::R_AARCH64_ADR_PREL_PG_HI21_NC;
169 return R_CLS(ADR_GOT_PAGE);
171 return R_CLS(TLSIE_ADR_GOTTPREL_PAGE21);
173 return R_CLS(TLSDESC_ADR_PAGE21);
175 "invalid symbol kind for ADRP relocation");
176 return ELF::R_AARCH64_NONE;
178 return R_CLS(JUMP26);
180 return R_CLS(CALL26);
183 return R_CLS(TLSIE_LD_GOTTPREL_PREL19);
185 return R_CLS(GOT_LD_PREL19);
186 return R_CLS(LD_PREL_LO19);
188 return R_CLS(TSTBR14);
191 "relocation of PAC/AUT instructions is not supported");
192 return ELF::R_AARCH64_NONE;
194 return R_CLS(CONDBR19);
197 return ELF::R_AARCH64_NONE;
201 return ELF::R_AARCH64_NONE;
202 switch (
Fixup.getTargetKind()) {
205 return ELF::R_AARCH64_NONE;
211 ? ELF::R_AARCH64_GOTPCREL32
218 Twine(
"ILP32 8 byte absolute data "
219 "relocation not supported (LP64 eqv: ") +
220 (IsAuth ?
"AUTH_ABS64" :
"ABS64") +
Twine(
')'));
221 return ELF::R_AARCH64_NONE;
223 return (IsAuth ? ELF::R_AARCH64_AUTH_ABS64 : ELF::R_AARCH64_ABS64);
227 return R_CLS(TLSLD_ADD_DTPREL_HI12);
229 return R_CLS(TLSLE_ADD_TPREL_HI12);
231 return R_CLS(TLSLD_ADD_DTPREL_LO12_NC);
233 return R_CLS(TLSLD_ADD_DTPREL_LO12);
235 return R_CLS(TLSLE_ADD_TPREL_LO12_NC);
237 return R_CLS(TLSLE_ADD_TPREL_LO12);
239 return R_CLS(TLSDESC_ADD_LO12);
241 return R_CLS(ADD_ABS_LO12_NC);
244 "invalid fixup for add (uimm12) instruction");
245 return ELF::R_AARCH64_NONE;
248 return R_CLS(LDST8_ABS_LO12_NC);
250 return R_CLS(TLSLD_LDST8_DTPREL_LO12);
252 return R_CLS(TLSLD_LDST8_DTPREL_LO12_NC);
254 return R_CLS(TLSLE_LDST8_TPREL_LO12);
256 return R_CLS(TLSLE_LDST8_TPREL_LO12_NC);
259 "invalid fixup for 8-bit load/store instruction");
260 return ELF::R_AARCH64_NONE;
263 return R_CLS(LDST16_ABS_LO12_NC);
265 return R_CLS(TLSLD_LDST16_DTPREL_LO12);
267 return R_CLS(TLSLD_LDST16_DTPREL_LO12_NC);
269 return R_CLS(TLSLE_LDST16_TPREL_LO12);
271 return R_CLS(TLSLE_LDST16_TPREL_LO12_NC);
274 "invalid fixup for 16-bit load/store instruction");
275 return ELF::R_AARCH64_NONE;
278 return R_CLS(LDST32_ABS_LO12_NC);
280 return R_CLS(TLSLD_LDST32_DTPREL_LO12);
282 return R_CLS(TLSLD_LDST32_DTPREL_LO12_NC);
284 return R_CLS(TLSLE_LDST32_TPREL_LO12);
286 return R_CLS(TLSLE_LDST32_TPREL_LO12_NC);
289 return ELF::R_AARCH64_P32_LD32_GOT_LO12_NC;
291 "LP64 4 byte unchecked GOT load/store relocation "
292 "not supported (ILP32 eqv: LD32_GOT_LO12_NC");
293 return ELF::R_AARCH64_NONE;
298 "ILP32 4 byte checked GOT load/store relocation "
299 "not supported (unchecked eqv: LD32_GOT_LO12_NC)");
302 "LP64 4 byte checked GOT load/store relocation "
303 "not supported (unchecked/ILP32 eqv: "
304 "LD32_GOT_LO12_NC)");
306 return ELF::R_AARCH64_NONE;
310 return ELF::R_AARCH64_P32_TLSIE_LD32_GOTTPREL_LO12_NC;
312 "relocation not supported (ILP32 eqv: "
313 "TLSIE_LD32_GOTTPREL_LO12_NC)");
314 return ELF::R_AARCH64_NONE;
318 return ELF::R_AARCH64_P32_TLSDESC_LD32_LO12;
320 "LP64 4 byte TLSDESC load/store relocation "
321 "not supported (ILP32 eqv: TLSDESC_LD64_LO12)");
322 return ELF::R_AARCH64_NONE;
326 "invalid fixup for 32-bit load/store instruction "
327 "fixup_aarch64_ldst_imm12_scale4");
328 return ELF::R_AARCH64_NONE;
331 return R_CLS(LDST64_ABS_LO12_NC);
337 return ELF::R_AARCH64_LD64_GOTPAGE_LO15;
338 return ELF::R_AARCH64_LD64_GOT_LO12_NC;
341 "relocation not supported (LP64 eqv: "
342 "LD64_GOT_LO12_NC)");
343 return ELF::R_AARCH64_NONE;
346 return R_CLS(TLSLD_LDST64_DTPREL_LO12);
348 return R_CLS(TLSLD_LDST64_DTPREL_LO12_NC);
350 return R_CLS(TLSLE_LDST64_TPREL_LO12);
352 return R_CLS(TLSLE_LDST64_TPREL_LO12_NC);
355 return ELF::R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC;
357 "relocation not supported (LP64 eqv: "
358 "TLSIE_LD64_GOTTPREL_LO12_NC)");
359 return ELF::R_AARCH64_NONE;
363 return ELF::R_AARCH64_TLSDESC_LD64_LO12;
365 "relocation not supported (LP64 eqv: "
366 "TLSDESC_LD64_LO12)");
367 return ELF::R_AARCH64_NONE;
370 "invalid fixup for 64-bit load/store instruction");
371 return ELF::R_AARCH64_NONE;
374 return R_CLS(LDST128_ABS_LO12_NC);
376 return R_CLS(TLSLD_LDST128_DTPREL_LO12);
378 return R_CLS(TLSLD_LDST128_DTPREL_LO12_NC);
380 return R_CLS(TLSLE_LDST128_TPREL_LO12);
382 return R_CLS(TLSLE_LDST128_TPREL_LO12_NC);
385 "invalid fixup for 128-bit load/store instruction");
386 return ELF::R_AARCH64_NONE;
390 return ELF::R_AARCH64_MOVW_UABS_G3;
392 return ELF::R_AARCH64_MOVW_UABS_G2;
394 return ELF::R_AARCH64_MOVW_SABS_G2;
396 return ELF::R_AARCH64_MOVW_UABS_G2_NC;
398 return R_CLS(MOVW_UABS_G1);
400 return ELF::R_AARCH64_MOVW_SABS_G1;
402 return ELF::R_AARCH64_MOVW_UABS_G1_NC;
404 return R_CLS(MOVW_UABS_G0);
406 return R_CLS(MOVW_SABS_G0);
408 return R_CLS(MOVW_UABS_G0_NC);
410 return ELF::R_AARCH64_MOVW_PREL_G3;
412 return ELF::R_AARCH64_MOVW_PREL_G2;
414 return ELF::R_AARCH64_MOVW_PREL_G2_NC;
416 return R_CLS(MOVW_PREL_G1);
418 return ELF::R_AARCH64_MOVW_PREL_G1_NC;
420 return R_CLS(MOVW_PREL_G0);
422 return R_CLS(MOVW_PREL_G0_NC);
424 return ELF::R_AARCH64_TLSLD_MOVW_DTPREL_G2;
426 return R_CLS(TLSLD_MOVW_DTPREL_G1);
428 return ELF::R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC;
430 return R_CLS(TLSLD_MOVW_DTPREL_G0);
432 return R_CLS(TLSLD_MOVW_DTPREL_G0_NC);
434 return ELF::R_AARCH64_TLSLE_MOVW_TPREL_G2;
436 return R_CLS(TLSLE_MOVW_TPREL_G1);
438 return ELF::R_AARCH64_TLSLE_MOVW_TPREL_G1_NC;
440 return R_CLS(TLSLE_MOVW_TPREL_G0);
442 return R_CLS(TLSLE_MOVW_TPREL_G0_NC);
444 return ELF::R_AARCH64_TLSIE_MOVW_GOTTPREL_G1;
446 return ELF::R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC;
448 "invalid fixup for movz/movk instruction");
449 return ELF::R_AARCH64_NONE;
452 return ELF::R_AARCH64_NONE;
459bool AArch64ELFObjectWriter::needsRelocateWithSymbol(
const MCValue &Val,
466AArch64ELFObjectWriter::getMemtagRelocsSection(
MCContext &Ctx)
const {
471std::unique_ptr<MCObjectTargetWriter>
473 return std::make_unique<AArch64ELFObjectWriter>(OSABI, IsILP32);
#define BAD_ILP32_MOV(lp64rtype)
static bool isNonILP32reloc(const MCFixup &Fixup, AArch64MCExpr::VariantKind RefKind, MCContext &Ctx)
PowerPC TLS Dynamic Call Fixup
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static VariantKind getSymbolLoc(VariantKind Kind)
static bool isNotChecked(VariantKind Kind)
static VariantKind getAddressFrag(VariantKind Kind)
Context object for machine code objects.
MCSectionELF * getELFSection(const Twine &Section, unsigned Type, unsigned Flags)
void reportError(SMLoc L, const Twine &Msg)
virtual bool needsRelocateWithSymbol(const MCValue &Val, const MCSymbol &Sym, unsigned Type) const
virtual MCSectionELF * getMemtagRelocsSection(MCContext &Ctx) const
virtual unsigned getRelocType(MCContext &Ctx, const MCValue &Target, const MCFixup &Fixup, bool IsPCRel) const =0
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
This represents a section on linux, lots of unix variants and some bare metal systems.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
This represents an "assembler immediate".
uint32_t getRefKind() const
Target - Wrapper for Target specific information.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
The instances of the Type class are immutable: once they are created, they are never changed.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ fixup_aarch64_pcrel_branch16
@ fixup_aarch64_ldst_imm12_scale4
@ fixup_aarch64_pcrel_call26
@ fixup_aarch64_pcrel_branch26
@ fixup_aarch64_pcrel_branch19
@ fixup_aarch64_ldr_pcrel_imm19
@ fixup_aarch64_pcrel_adr_imm21
@ fixup_aarch64_pcrel_branch14
@ fixup_aarch64_ldst_imm12_scale2
@ fixup_aarch64_ldst_imm12_scale16
@ fixup_aarch64_pcrel_adrp_imm21
@ fixup_aarch64_add_imm12
@ fixup_aarch64_ldst_imm12_scale8
@ fixup_aarch64_ldst_imm12_scale1
@ SHT_AARCH64_MEMTAG_GLOBALS_STATIC
This is an optimization pass for GlobalISel generic memory operations.
@ FirstLiteralRelocationKind
The range [FirstLiteralRelocationKind, MaxTargetFixupKind) is used for relocations coming from ....
@ FK_Data_8
A eight-byte fixup.
@ FK_Data_1
A one-byte fixup.
@ FK_Data_4
A four-byte fixup.
@ FK_Data_2
A two-byte fixup.
std::unique_ptr< MCObjectTargetWriter > createAArch64ELFObjectWriter(uint8_t OSABI, bool IsILP32)