24 PPCELFObjectWriter(
bool Is64Bit,
uint8_t OSABI);
31 unsigned Type)
const override;
35PPCELFObjectWriter::PPCELFObjectWriter(
bool Is64Bit,
uint8_t OSABI)
45 return Target.getAccessVariant();
47 switch (cast<PPCMCExpr>(Expr)->getKind()) {
83 switch (
Fixup.getTargetKind()) {
92 Type = ELF::R_PPC_REL24;
95 Type = ELF::R_PPC_PLTREL24;
98 Type = ELF::R_PPC_LOCAL24PC;
101 Type = ELF::R_PPC64_REL24_NOTOC;
107 Type = ELF::R_PPC_REL14;
113 Type = ELF::R_PPC_REL16;
116 Type = ELF::R_PPC_REL16_LO;
119 Type = ELF::R_PPC_REL16_HI;
122 Type = ELF::R_PPC_REL16_HA;
136 Type = ELF::R_PPC64_PCREL34;
139 Type = ELF::R_PPC64_GOT_PCREL34;
142 Type = ELF::R_PPC64_GOT_TLSGD_PCREL34;
145 Type = ELF::R_PPC64_GOT_TLSLD_PCREL34;
148 Type = ELF::R_PPC64_GOT_TPREL_PCREL34;
154 Type = ELF::R_PPC_REL32;
158 Type = ELF::R_PPC64_REL64;
162 switch (
Fixup.getTargetKind()) {
165 Type = ELF::R_PPC_ADDR24;
168 Type = ELF::R_PPC_ADDR14;
174 Type = ELF::R_PPC_ADDR16;
177 Type = ELF::R_PPC_ADDR16_LO;
180 Type = ELF::R_PPC_ADDR16_HI;
183 Type = ELF::R_PPC_ADDR16_HA;
186 Type = ELF::R_PPC64_ADDR16_HIGH;
189 Type = ELF::R_PPC64_ADDR16_HIGHA;
192 Type = ELF::R_PPC64_ADDR16_HIGHER;
195 Type = ELF::R_PPC64_ADDR16_HIGHERA;
198 Type = ELF::R_PPC64_ADDR16_HIGHEST;
201 Type = ELF::R_PPC64_ADDR16_HIGHESTA;
204 Type = ELF::R_PPC_GOT16;
207 Type = ELF::R_PPC_GOT16_LO;
210 Type = ELF::R_PPC_GOT16_HI;
213 Type = ELF::R_PPC_GOT16_HA;
216 Type = ELF::R_PPC64_TOC16;
219 Type = ELF::R_PPC64_TOC16_LO;
222 Type = ELF::R_PPC64_TOC16_HI;
225 Type = ELF::R_PPC64_TOC16_HA;
228 Type = ELF::R_PPC_TPREL16;
231 Type = ELF::R_PPC_TPREL16_LO;
234 Type = ELF::R_PPC_TPREL16_HI;
237 Type = ELF::R_PPC_TPREL16_HA;
240 Type = ELF::R_PPC64_TPREL16_HIGH;
243 Type = ELF::R_PPC64_TPREL16_HIGHA;
246 Type = ELF::R_PPC64_TPREL16_HIGHER;
249 Type = ELF::R_PPC64_TPREL16_HIGHERA;
252 Type = ELF::R_PPC64_TPREL16_HIGHEST;
255 Type = ELF::R_PPC64_TPREL16_HIGHESTA;
258 Type = ELF::R_PPC64_DTPREL16;
261 Type = ELF::R_PPC64_DTPREL16_LO;
264 Type = ELF::R_PPC64_DTPREL16_HI;
267 Type = ELF::R_PPC64_DTPREL16_HA;
270 Type = ELF::R_PPC64_DTPREL16_HIGH;
273 Type = ELF::R_PPC64_DTPREL16_HIGHA;
276 Type = ELF::R_PPC64_DTPREL16_HIGHER;
279 Type = ELF::R_PPC64_DTPREL16_HIGHERA;
282 Type = ELF::R_PPC64_DTPREL16_HIGHEST;
285 Type = ELF::R_PPC64_DTPREL16_HIGHESTA;
289 Type = ELF::R_PPC64_GOT_TLSGD16;
291 Type = ELF::R_PPC_GOT_TLSGD16;
294 Type = ELF::R_PPC64_GOT_TLSGD16_LO;
297 Type = ELF::R_PPC64_GOT_TLSGD16_HI;
300 Type = ELF::R_PPC64_GOT_TLSGD16_HA;
304 Type = ELF::R_PPC64_GOT_TLSLD16;
306 Type = ELF::R_PPC_GOT_TLSLD16;
309 Type = ELF::R_PPC64_GOT_TLSLD16_LO;
312 Type = ELF::R_PPC64_GOT_TLSLD16_HI;
315 Type = ELF::R_PPC64_GOT_TLSLD16_HA;
320 Type = ELF::R_PPC64_GOT_TPREL16_DS;
325 Type = ELF::R_PPC64_GOT_TPREL16_LO_DS;
328 Type = ELF::R_PPC64_GOT_TPREL16_HI;
333 Type = ELF::R_PPC64_GOT_DTPREL16_DS;
338 Type = ELF::R_PPC64_GOT_DTPREL16_LO_DS;
341 Type = ELF::R_PPC64_GOT_TPREL16_HA;
344 Type = ELF::R_PPC64_GOT_DTPREL16_HI;
347 Type = ELF::R_PPC64_GOT_DTPREL16_HA;
356 Type = ELF::R_PPC64_ADDR16_DS;
359 Type = ELF::R_PPC64_ADDR16_LO_DS;
362 Type = ELF::R_PPC64_GOT16_DS;
365 Type = ELF::R_PPC64_GOT16_LO_DS;
368 Type = ELF::R_PPC64_TOC16_DS;
371 Type = ELF::R_PPC64_TOC16_LO_DS;
374 Type = ELF::R_PPC64_TPREL16_DS;
377 Type = ELF::R_PPC64_TPREL16_LO_DS;
380 Type = ELF::R_PPC64_DTPREL16_DS;
383 Type = ELF::R_PPC64_DTPREL16_LO_DS;
386 Type = ELF::R_PPC64_GOT_TPREL16_DS;
389 Type = ELF::R_PPC64_GOT_TPREL16_LO_DS;
392 Type = ELF::R_PPC64_GOT_DTPREL16_DS;
395 Type = ELF::R_PPC64_GOT_DTPREL16_LO_DS;
404 Type = ELF::R_PPC64_TLSGD;
406 Type = ELF::R_PPC_TLSGD;
410 Type = ELF::R_PPC64_TLSLD;
412 Type = ELF::R_PPC_TLSLD;
416 Type = ELF::R_PPC64_TLS;
418 Type = ELF::R_PPC_TLS;
421 Type = ELF::R_PPC64_TLS;
430 Type = ELF::R_PPC64_DTPREL34;
433 Type = ELF::R_PPC64_TPREL34;
441 Type = ELF::R_PPC64_TOC;
444 Type = ELF::R_PPC64_ADDR64;
447 Type = ELF::R_PPC64_DTPMOD64;
450 Type = ELF::R_PPC64_TPREL64;
453 Type = ELF::R_PPC64_DTPREL64;
460 Type = ELF::R_PPC_DTPREL32;
463 Type = ELF::R_PPC_ADDR32;
467 Type = ELF::R_PPC_ADDR16;
474bool PPCELFObjectWriter::needsRelocateWithSymbol(
const MCValue &,
476 unsigned Type)
const {
481 case ELF::R_PPC_REL24:
482 case ELF::R_PPC64_REL24_NOTOC:
488 unsigned Other = cast<MCSymbolELF>(
Sym).getOther() << 2;
493std::unique_ptr<MCObjectTargetWriter>
495 return std::make_unique<PPCELFObjectWriter>(Is64Bit, OSABI);
std::optional< std::vector< StOtherPiece > > Other
static MCSymbolRefExpr::VariantKind getAccessVariant(const MCValue &Target, const MCFixup &Fixup)
PowerPC TLS Dynamic Call Fixup
static bool is64Bit(const char *name)
Context object for machine code objects.
virtual bool needsRelocateWithSymbol(const MCValue &Val, const MCSymbol &Sym, unsigned Type) const
virtual unsigned getRelocType(MCContext &Ctx, const MCValue &Target, const MCFixup &Fixup, bool IsPCRel) const =0
Base class for the full range of assembler expressions which are needed for parsing.
@ Target
Target specific expression.
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
This represents an "assembler immediate".
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.
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
MCFixupKind
Extensible enumeration to represent the type of a fixup.
@ FK_PCRel_4
A four-byte pc relative fixup.
@ FirstLiteralRelocationKind
The range [FirstLiteralRelocationKind, MaxTargetFixupKind) is used for relocations coming from ....
@ FK_Data_8
A eight-byte fixup.
@ FK_Data_4
A four-byte fixup.
@ FK_PCRel_8
A eight-byte pc relative fixup.
@ FK_Data_2
A two-byte fixup.
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
std::unique_ptr< MCObjectTargetWriter > createPPCELFObjectWriter(bool Is64Bit, uint8_t OSABI)
Construct an PPC ELF object writer.