25 PPCELFObjectWriter(
bool Is64Bit,
uint8_t OSABI);
29 bool IsPCRel)
const override;
35PPCELFObjectWriter::PPCELFObjectWriter(
bool Is64Bit,
uint8_t OSABI)
40unsigned PPCELFObjectWriter::getRelocType(
const MCFixup &
Fixup,
99 switch (
Fixup.getKind()) {
110 Type = ELF::R_PPC_REL24;
113 Type = ELF::R_PPC_PLTREL24;
116 Type = ELF::R_PPC_LOCAL24PC;
119 Type = ELF::R_PPC64_REL24_NOTOC;
125 Type = ELF::R_PPC_REL14;
131 return ELF::R_PPC_NONE;
133 return ELF::R_PPC_REL16;
135 return ELF::R_PPC_REL16_LO;
137 return ELF::R_PPC_REL16_HI;
139 return ELF::R_PPC_REL16_HA;
152 Type = ELF::R_PPC64_PCREL34;
155 Type = ELF::R_PPC64_GOT_PCREL34;
158 Type = ELF::R_PPC64_GOT_TLSGD_PCREL34;
161 Type = ELF::R_PPC64_GOT_TLSLD_PCREL34;
164 Type = ELF::R_PPC64_GOT_TPREL_PCREL34;
169 Type = ELF::R_PPC_REL32;
172 Type = ELF::R_PPC64_REL64;
176 switch (
Fixup.getKind()) {
180 Type = ELF::R_PPC_ADDR24;
183 Type = ELF::R_PPC_ADDR14;
191 return ELF::R_PPC_ADDR16_LO;
193 return ELF::R_PPC_ADDR16_HI;
195 return ELF::R_PPC_ADDR16_HA;
197 return ELF::R_PPC64_ADDR16_HIGH;
199 return ELF::R_PPC64_ADDR16_HIGHA;
201 return ELF::R_PPC64_ADDR16_HIGHER;
203 return ELF::R_PPC64_ADDR16_HIGHERA;
205 return ELF::R_PPC64_ADDR16_HIGHEST;
207 return ELF::R_PPC64_ADDR16_HIGHESTA;
210 Type = ELF::R_PPC_ADDR16;
213 Type = ELF::R_PPC_GOT16;
216 Type = ELF::R_PPC_GOT16_LO;
219 Type = ELF::R_PPC_GOT16_HI;
222 Type = ELF::R_PPC_GOT16_HA;
225 Type = ELF::R_PPC64_TOC16;
228 Type = ELF::R_PPC64_TOC16_LO;
231 Type = ELF::R_PPC64_TOC16_HI;
234 Type = ELF::R_PPC64_TOC16_HA;
237 Type = ELF::R_PPC_TPREL16;
240 Type = ELF::R_PPC_TPREL16_LO;
243 Type = ELF::R_PPC_TPREL16_HI;
246 Type = ELF::R_PPC_TPREL16_HA;
249 Type = ELF::R_PPC64_TPREL16_HIGH;
252 Type = ELF::R_PPC64_TPREL16_HIGHA;
255 Type = ELF::R_PPC64_TPREL16_HIGHER;
258 Type = ELF::R_PPC64_TPREL16_HIGHERA;
261 Type = ELF::R_PPC64_TPREL16_HIGHEST;
264 Type = ELF::R_PPC64_TPREL16_HIGHESTA;
267 Type = ELF::R_PPC64_DTPREL16;
270 Type = ELF::R_PPC64_DTPREL16_LO;
273 Type = ELF::R_PPC64_DTPREL16_HI;
276 Type = ELF::R_PPC64_DTPREL16_HA;
279 Type = ELF::R_PPC64_DTPREL16_HIGH;
282 Type = ELF::R_PPC64_DTPREL16_HIGHA;
285 Type = ELF::R_PPC64_DTPREL16_HIGHER;
288 Type = ELF::R_PPC64_DTPREL16_HIGHERA;
291 Type = ELF::R_PPC64_DTPREL16_HIGHEST;
294 Type = ELF::R_PPC64_DTPREL16_HIGHESTA;
298 Type = ELF::R_PPC64_GOT_TLSGD16;
300 Type = ELF::R_PPC_GOT_TLSGD16;
303 Type = ELF::R_PPC64_GOT_TLSGD16_LO;
306 Type = ELF::R_PPC64_GOT_TLSGD16_HI;
309 Type = ELF::R_PPC64_GOT_TLSGD16_HA;
313 Type = ELF::R_PPC64_GOT_TLSLD16;
315 Type = ELF::R_PPC_GOT_TLSLD16;
318 Type = ELF::R_PPC64_GOT_TLSLD16_LO;
321 Type = ELF::R_PPC64_GOT_TLSLD16_HI;
324 Type = ELF::R_PPC64_GOT_TLSLD16_HA;
329 Type = ELF::R_PPC64_GOT_TPREL16_DS;
334 Type = ELF::R_PPC64_GOT_TPREL16_LO_DS;
337 Type = ELF::R_PPC64_GOT_TPREL16_HI;
342 Type = ELF::R_PPC64_GOT_DTPREL16_DS;
347 Type = ELF::R_PPC64_GOT_DTPREL16_LO_DS;
350 Type = ELF::R_PPC64_GOT_TPREL16_HA;
353 Type = ELF::R_PPC64_GOT_DTPREL16_HI;
356 Type = ELF::R_PPC64_GOT_DTPREL16_HA;
367 return ELF::R_PPC64_ADDR16_LO_DS;
369 Type = ELF::R_PPC64_ADDR16_DS;
372 Type = ELF::R_PPC64_GOT16_DS;
375 Type = ELF::R_PPC64_GOT16_LO_DS;
378 Type = ELF::R_PPC64_TOC16_DS;
381 Type = ELF::R_PPC64_TOC16_LO_DS;
384 Type = ELF::R_PPC64_TPREL16_DS;
387 Type = ELF::R_PPC64_TPREL16_LO_DS;
390 Type = ELF::R_PPC64_DTPREL16_DS;
393 Type = ELF::R_PPC64_DTPREL16_LO_DS;
396 Type = ELF::R_PPC64_GOT_TPREL16_DS;
399 Type = ELF::R_PPC64_GOT_TPREL16_LO_DS;
402 Type = ELF::R_PPC64_GOT_DTPREL16_DS;
405 Type = ELF::R_PPC64_GOT_DTPREL16_LO_DS;
416 Type = ELF::R_PPC64_TLSGD;
418 Type = ELF::R_PPC_TLSGD;
422 Type = ELF::R_PPC64_TLSLD;
424 Type = ELF::R_PPC_TLSLD;
428 Type = ELF::R_PPC64_TLS;
430 Type = ELF::R_PPC_TLS;
433 Type = ELF::R_PPC64_TLS;
443 Type = ELF::R_PPC64_DTPREL34;
446 Type = ELF::R_PPC64_TPREL34;
456 Type = ELF::R_PPC64_TOC;
459 Type = ELF::R_PPC64_ADDR64;
462 Type = ELF::R_PPC64_DTPMOD64;
465 Type = ELF::R_PPC64_TPREL64;
468 Type = ELF::R_PPC64_DTPREL64;
475 Type = ELF::R_PPC_DTPREL32;
478 Type = ELF::R_PPC_ADDR32;
482 Type = ELF::R_PPC_ADDR16;
489bool PPCELFObjectWriter::needsRelocateWithSymbol(
const MCValue &V,
490 unsigned Type)
const {
495 case ELF::R_PPC_REL24:
496 case ELF::R_PPC64_REL24_NOTOC: {
503 static_cast<const MCSymbolELF *
>(
V.getAddSym())->getOther() << 2;
507 case ELF::R_PPC64_GOT16:
508 case ELF::R_PPC64_GOT16_DS:
509 case ELF::R_PPC64_GOT16_LO:
510 case ELF::R_PPC64_GOT16_LO_DS:
511 case ELF::R_PPC64_GOT16_HI:
512 case ELF::R_PPC64_GOT16_HA:
517std::unique_ptr<MCObjectTargetWriter>
519 return std::make_unique<PPCELFObjectWriter>(Is64Bit, OSABI);
static Error reportError(StringRef Message)
std::optional< std::vector< StOtherPiece > > Other
PowerPC TLS Dynamic Call Fixup
static bool is64Bit(const char *name)
virtual unsigned getRelocType(const MCFixup &Fixup, const MCValue &Target, bool IsPCRel) const =0
virtual bool needsRelocateWithSymbol(const MCValue &, unsigned Type) const
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
void setType(unsigned Type) const
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Represents a location in source code.
Target - Wrapper for Target specific information.
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_ppc_brcond14abs
14-bit absolute relocation for conditional branches.
@ fixup_ppc_half16
A 16-bit fixup corresponding to lo16(_foo) or ha16(_foo) for instrs like 'li' or 'addis'.
@ fixup_ppc_brcond14
14-bit PC relative relocation for conditional branches.
@ fixup_ppc_half16dq
A 16-bit fixup corresponding to lo16(_foo) with implied 3 zero bits for instrs like 'lxv'.
@ fixup_ppc_half16ds
A 14-bit fixup corresponding to lo16(_foo) with implied 2 zero bits for instrs like 'std'.
@ fixup_ppc_nofixup
Not a true fixup, but ties a symbol to a call to __tls_get_addr for the TLS general and local dynamic...
@ fixup_ppc_br24abs
24-bit absolute relocation for direct branches like 'ba' and 'bla'.
This is an optimization pass for GlobalISel generic memory operations.
@ FK_Data_8
A eight-byte fixup.
@ FK_Data_4
A four-byte fixup.
@ FK_Data_2
A two-byte fixup.
std::unique_ptr< MCObjectTargetWriter > createPPCELFObjectWriter(bool Is64Bit, uint8_t OSABI)
Construct an PPC ELF object writer.