34 AArch64ELFObjectWriter(uint8_t OSABI,
bool IsILP32);
36 ~AArch64ELFObjectWriter()
override =
default;
40 const MCFixup &Fixup,
bool IsPCRel)
const override;
46 AArch64ELFObjectWriter::AArch64ELFObjectWriter(uint8_t OSABI,
bool IsILP32)
51 #define R_CLS(rtype) \ 52 IsILP32 ? ELF::R_AARCH64_P32_##rtype : ELF::R_AARCH64_##rtype 53 #define BAD_ILP32_MOV(lp64rtype) \ 54 "ILP32 absolute MOV relocation not " \ 55 "supported (LP64 eqv: " #lp64rtype ")" 109 bool IsPCRel)
const {
117 "Should only be expression-level modifiers here");
121 "Should only be expression-level modifiers here");
124 switch ((
unsigned)Fixup.
getKind()) {
127 return ELF::R_AARCH64_NONE;
129 return R_CLS(PREL16);
131 return R_CLS(PREL32);
135 "ILP32 8 byte PC relative data " 136 "relocation not supported (LP64 eqv: PREL64)");
137 return ELF::R_AARCH64_NONE;
139 return ELF::R_AARCH64_PREL64;
143 "invalid symbol kind for ADR relocation");
144 return R_CLS(ADR_PREL_LO21);
147 return R_CLS(ADR_PREL_PG_HI21);
151 "invalid fixup for 32-bit pcrel ADRP instruction " 153 return ELF::R_AARCH64_NONE;
155 return ELF::R_AARCH64_ADR_PREL_PG_HI21_NC;
159 return R_CLS(ADR_GOT_PAGE);
161 return R_CLS(TLSIE_ADR_GOTTPREL_PAGE21);
163 return R_CLS(TLSDESC_ADR_PAGE21);
165 "invalid symbol kind for ADRP relocation");
166 return ELF::R_AARCH64_NONE;
168 return R_CLS(JUMP26);
170 return R_CLS(CALL26);
173 return R_CLS(TLSIE_LD_GOTTPREL_PREL19);
175 return R_CLS(GOT_LD_PREL19);
176 return R_CLS(LD_PREL_LO19);
178 return R_CLS(TSTBR14);
180 return R_CLS(CONDBR19);
183 return ELF::R_AARCH64_NONE;
187 return ELF::R_AARCH64_NONE;
188 switch ((
unsigned)Fixup.
getKind()) {
191 return ELF::R_AARCH64_NONE;
199 "ILP32 8 byte absolute data " 200 "relocation not supported (LP64 eqv: ABS64)");
201 return ELF::R_AARCH64_NONE;
203 return ELF::R_AARCH64_ABS64;
206 return R_CLS(TLSLD_ADD_DTPREL_HI12);
208 return R_CLS(TLSLE_ADD_TPREL_HI12);
210 return R_CLS(TLSLD_ADD_DTPREL_LO12_NC);
212 return R_CLS(TLSLD_ADD_DTPREL_LO12);
214 return R_CLS(TLSLE_ADD_TPREL_LO12_NC);
216 return R_CLS(TLSLE_ADD_TPREL_LO12);
218 return R_CLS(TLSDESC_ADD_LO12);
220 return R_CLS(ADD_ABS_LO12_NC);
223 "invalid fixup for add (uimm12) instruction");
224 return ELF::R_AARCH64_NONE;
227 return R_CLS(LDST8_ABS_LO12_NC);
229 return R_CLS(TLSLD_LDST8_DTPREL_LO12);
231 return R_CLS(TLSLD_LDST8_DTPREL_LO12_NC);
233 return R_CLS(TLSLE_LDST8_TPREL_LO12);
235 return R_CLS(TLSLE_LDST8_TPREL_LO12_NC);
238 "invalid fixup for 8-bit load/store instruction");
239 return ELF::R_AARCH64_NONE;
242 return R_CLS(LDST16_ABS_LO12_NC);
244 return R_CLS(TLSLD_LDST16_DTPREL_LO12);
246 return R_CLS(TLSLD_LDST16_DTPREL_LO12_NC);
248 return R_CLS(TLSLE_LDST16_TPREL_LO12);
250 return R_CLS(TLSLE_LDST16_TPREL_LO12_NC);
253 "invalid fixup for 16-bit load/store instruction");
254 return ELF::R_AARCH64_NONE;
257 return R_CLS(LDST32_ABS_LO12_NC);
259 return R_CLS(TLSLD_LDST32_DTPREL_LO12);
261 return R_CLS(TLSLD_LDST32_DTPREL_LO12_NC);
263 return R_CLS(TLSLE_LDST32_TPREL_LO12);
265 return R_CLS(TLSLE_LDST32_TPREL_LO12_NC);
268 return ELF::R_AARCH64_P32_LD32_GOT_LO12_NC;
271 "LP64 4 byte unchecked GOT load/store relocation " 272 "not supported (ILP32 eqv: LD32_GOT_LO12_NC");
273 return ELF::R_AARCH64_NONE;
279 "ILP32 4 byte checked GOT load/store relocation " 280 "not supported (unchecked eqv: LD32_GOT_LO12_NC)");
283 "LP64 4 byte checked GOT load/store relocation " 284 "not supported (unchecked/ILP32 eqv: " 285 "LD32_GOT_LO12_NC)");
287 return ELF::R_AARCH64_NONE;
291 return ELF::R_AARCH64_P32_TLSIE_LD32_GOTTPREL_LO12_NC;
294 "LP64 32-bit load/store " 295 "relocation not supported (ILP32 eqv: " 296 "TLSIE_LD32_GOTTPREL_LO12_NC)");
297 return ELF::R_AARCH64_NONE;
302 return ELF::R_AARCH64_P32_TLSDESC_LD32_LO12;
305 "LP64 4 byte TLSDESC load/store relocation " 306 "not supported (ILP32 eqv: TLSDESC_LD64_LO12)");
307 return ELF::R_AARCH64_NONE;
312 "invalid fixup for 32-bit load/store instruction " 313 "fixup_aarch64_ldst_imm12_scale4");
314 return ELF::R_AARCH64_NONE;
317 return R_CLS(LDST64_ABS_LO12_NC);
320 return ELF::R_AARCH64_LD64_GOT_LO12_NC;
323 "relocation not supported (LP64 eqv: " 324 "LD64_GOT_LO12_NC)");
325 return ELF::R_AARCH64_NONE;
329 return R_CLS(TLSLD_LDST64_DTPREL_LO12);
331 return R_CLS(TLSLD_LDST64_DTPREL_LO12_NC);
333 return R_CLS(TLSLE_LDST64_TPREL_LO12);
335 return R_CLS(TLSLE_LDST64_TPREL_LO12_NC);
338 return ELF::R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC;
341 "relocation not supported (LP64 eqv: " 342 "TLSIE_LD64_GOTTPREL_LO12_NC)");
343 return ELF::R_AARCH64_NONE;
348 return ELF::R_AARCH64_TLSDESC_LD64_LO12;
351 "relocation not supported (LP64 eqv: " 352 "TLSDESC_LD64_LO12)");
353 return ELF::R_AARCH64_NONE;
357 "invalid fixup for 64-bit load/store instruction");
358 return ELF::R_AARCH64_NONE;
361 return R_CLS(LDST128_ABS_LO12_NC);
363 return R_CLS(TLSLD_LDST128_DTPREL_LO12);
365 return R_CLS(TLSLD_LDST128_DTPREL_LO12_NC);
367 return R_CLS(TLSLE_LDST128_TPREL_LO12);
369 return R_CLS(TLSLE_LDST128_TPREL_LO12_NC);
372 "invalid fixup for 128-bit load/store instruction");
373 return ELF::R_AARCH64_NONE;
377 return ELF::R_AARCH64_MOVW_UABS_G3;
379 return ELF::R_AARCH64_MOVW_UABS_G2;
381 return ELF::R_AARCH64_MOVW_SABS_G2;
383 return ELF::R_AARCH64_MOVW_UABS_G2_NC;
385 return R_CLS(MOVW_UABS_G1);
387 return ELF::R_AARCH64_MOVW_SABS_G1;
389 return ELF::R_AARCH64_MOVW_UABS_G1_NC;
391 return R_CLS(MOVW_UABS_G0);
393 return R_CLS(MOVW_SABS_G0);
395 return R_CLS(MOVW_UABS_G0_NC);
397 return ELF::R_AARCH64_TLSLD_MOVW_DTPREL_G2;
399 return R_CLS(TLSLD_MOVW_DTPREL_G1);
401 return ELF::R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC;
403 return R_CLS(TLSLD_MOVW_DTPREL_G0);
405 return R_CLS(TLSLD_MOVW_DTPREL_G0_NC);
407 return ELF::R_AARCH64_TLSLE_MOVW_TPREL_G2;
409 return R_CLS(TLSLE_MOVW_TPREL_G1);
411 return ELF::R_AARCH64_TLSLE_MOVW_TPREL_G1_NC;
413 return R_CLS(TLSLE_MOVW_TPREL_G0);
415 return R_CLS(TLSLE_MOVW_TPREL_G0_NC);
417 return ELF::R_AARCH64_TLSIE_MOVW_GOTTPREL_G1;
419 return ELF::R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC;
421 "invalid fixup for movz/movk instruction");
422 return ELF::R_AARCH64_NONE;
424 return R_CLS(TLSDESC_CALL);
427 return ELF::R_AARCH64_NONE;
434 std::unique_ptr<MCObjectTargetWriter>
436 return llvm::make_unique<AArch64ELFObjectWriter>(OSABI, IsILP32);
This class represents lattice values for constants.
This represents an "assembler immediate".
VariantKind getKind() const
#define BAD_ILP32_MOV(lp64rtype)
block Block Frequency true
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
const MCSymbolRefExpr * getSymB() const
static unsigned getRelocType(const MCValue &Target, const MCFixupKind FixupKind, const bool IsPCRel)
Translates generic PPC fixup kind to Mach-O/PPC relocation type enum.
Context object for machine code objects.
const MCSymbolRefExpr * getSymA() const
void reportError(SMLoc L, const Twine &Msg)
std::unique_ptr< MCObjectTargetWriter > createAArch64ELFObjectWriter(uint8_t OSABI, bool IsILP32)
static bool isNonILP32reloc(const MCFixup &Fixup, AArch64MCExpr::VariantKind RefKind, MCContext &Ctx)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
PowerPC TLS Dynamic Call Fixup
Target - Wrapper for Target specific information.
static bool isNotChecked(VariantKind Kind)
uint32_t getRefKind() const
static VariantKind getSymbolLoc(VariantKind Kind)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
MCFixupKind getKind() const