25 PPCELFObjectWriter(
bool Is64Bit, uint8_t OSABI);
32 unsigned Type)
const override;
36PPCELFObjectWriter::PPCELFObjectWriter(
bool Is64Bit, uint8_t OSABI)
46 return Target.getAccessVariant();
48 switch (cast<PPCMCExpr>(Expr)->getKind()) {
84 switch (
Fixup.getTargetKind()) {
93 Type = ELF::R_PPC_REL24;
96 Type = ELF::R_PPC_PLTREL24;
99 Type = ELF::R_PPC_LOCAL24PC;
102 Type = ELF::R_PPC64_REL24_NOTOC;
108 Type = ELF::R_PPC_REL14;
114 Type = ELF::R_PPC_REL16;
117 Type = ELF::R_PPC_REL16_LO;
120 Type = ELF::R_PPC_REL16_HI;
123 Type = ELF::R_PPC_REL16_HA;
137 Type = ELF::R_PPC64_PCREL34;
140 Type = ELF::R_PPC64_GOT_PCREL34;
143 Type = ELF::R_PPC64_GOT_TLSGD_PCREL34;
146 Type = ELF::R_PPC64_GOT_TLSLD_PCREL34;
149 Type = ELF::R_PPC64_GOT_TPREL_PCREL34;
155 Type = ELF::R_PPC_REL32;
159 Type = ELF::R_PPC64_REL64;
163 switch (
Fixup.getTargetKind()) {
166 Type = ELF::R_PPC_ADDR24;
169 Type = ELF::R_PPC_ADDR14;
175 Type = ELF::R_PPC_ADDR16;
178 Type = ELF::R_PPC_ADDR16_LO;
181 Type = ELF::R_PPC_ADDR16_HI;
184 Type = ELF::R_PPC_ADDR16_HA;
187 Type = ELF::R_PPC64_ADDR16_HIGH;
190 Type = ELF::R_PPC64_ADDR16_HIGHA;
193 Type = ELF::R_PPC64_ADDR16_HIGHER;
196 Type = ELF::R_PPC64_ADDR16_HIGHERA;
199 Type = ELF::R_PPC64_ADDR16_HIGHEST;
202 Type = ELF::R_PPC64_ADDR16_HIGHESTA;
205 Type = ELF::R_PPC_GOT16;
208 Type = ELF::R_PPC_GOT16_LO;
211 Type = ELF::R_PPC_GOT16_HI;
214 Type = ELF::R_PPC_GOT16_HA;
217 Type = ELF::R_PPC64_TOC16;
220 Type = ELF::R_PPC64_TOC16_LO;
223 Type = ELF::R_PPC64_TOC16_HI;
226 Type = ELF::R_PPC64_TOC16_HA;
229 Type = ELF::R_PPC_TPREL16;
232 Type = ELF::R_PPC_TPREL16_LO;
235 Type = ELF::R_PPC_TPREL16_HI;
238 Type = ELF::R_PPC_TPREL16_HA;
241 Type = ELF::R_PPC64_TPREL16_HIGH;
244 Type = ELF::R_PPC64_TPREL16_HIGHA;
247 Type = ELF::R_PPC64_TPREL16_HIGHER;
250 Type = ELF::R_PPC64_TPREL16_HIGHERA;
253 Type = ELF::R_PPC64_TPREL16_HIGHEST;
256 Type = ELF::R_PPC64_TPREL16_HIGHESTA;
259 Type = ELF::R_PPC64_DTPREL16;
262 Type = ELF::R_PPC64_DTPREL16_LO;
265 Type = ELF::R_PPC64_DTPREL16_HI;
268 Type = ELF::R_PPC64_DTPREL16_HA;
271 Type = ELF::R_PPC64_DTPREL16_HIGH;
274 Type = ELF::R_PPC64_DTPREL16_HIGHA;
277 Type = ELF::R_PPC64_DTPREL16_HIGHER;
280 Type = ELF::R_PPC64_DTPREL16_HIGHERA;
283 Type = ELF::R_PPC64_DTPREL16_HIGHEST;
286 Type = ELF::R_PPC64_DTPREL16_HIGHESTA;
290 Type = ELF::R_PPC64_GOT_TLSGD16;
292 Type = ELF::R_PPC_GOT_TLSGD16;
295 Type = ELF::R_PPC64_GOT_TLSGD16_LO;
298 Type = ELF::R_PPC64_GOT_TLSGD16_HI;
301 Type = ELF::R_PPC64_GOT_TLSGD16_HA;
305 Type = ELF::R_PPC64_GOT_TLSLD16;
307 Type = ELF::R_PPC_GOT_TLSLD16;
310 Type = ELF::R_PPC64_GOT_TLSLD16_LO;
313 Type = ELF::R_PPC64_GOT_TLSLD16_HI;
316 Type = ELF::R_PPC64_GOT_TLSLD16_HA;
321 Type = ELF::R_PPC64_GOT_TPREL16_DS;
326 Type = ELF::R_PPC64_GOT_TPREL16_LO_DS;
329 Type = ELF::R_PPC64_GOT_TPREL16_HI;
334 Type = ELF::R_PPC64_GOT_DTPREL16_DS;
339 Type = ELF::R_PPC64_GOT_DTPREL16_LO_DS;
342 Type = ELF::R_PPC64_GOT_TPREL16_HA;
345 Type = ELF::R_PPC64_GOT_DTPREL16_HI;
348 Type = ELF::R_PPC64_GOT_DTPREL16_HA;
357 Type = ELF::R_PPC64_ADDR16_DS;
360 Type = ELF::R_PPC64_ADDR16_LO_DS;
363 Type = ELF::R_PPC64_GOT16_DS;
366 Type = ELF::R_PPC64_GOT16_LO_DS;
369 Type = ELF::R_PPC64_TOC16_DS;
372 Type = ELF::R_PPC64_TOC16_LO_DS;
375 Type = ELF::R_PPC64_TPREL16_DS;
378 Type = ELF::R_PPC64_TPREL16_LO_DS;
381 Type = ELF::R_PPC64_DTPREL16_DS;
384 Type = ELF::R_PPC64_DTPREL16_LO_DS;
387 Type = ELF::R_PPC64_GOT_TPREL16_DS;
390 Type = ELF::R_PPC64_GOT_TPREL16_LO_DS;
393 Type = ELF::R_PPC64_GOT_DTPREL16_DS;
396 Type = ELF::R_PPC64_GOT_DTPREL16_LO_DS;
405 Type = ELF::R_PPC64_TLSGD;
407 Type = ELF::R_PPC_TLSGD;
411 Type = ELF::R_PPC64_TLSLD;
413 Type = ELF::R_PPC_TLSLD;
417 Type = ELF::R_PPC64_TLS;
419 Type = ELF::R_PPC_TLS;
422 Type = ELF::R_PPC64_TLS;
431 Type = ELF::R_PPC64_DTPREL34;
434 Type = ELF::R_PPC64_TPREL34;
442 Type = ELF::R_PPC64_TOC;
445 Type = ELF::R_PPC64_ADDR64;
448 Type = ELF::R_PPC64_DTPMOD64;
451 Type = ELF::R_PPC64_TPREL64;
454 Type = ELF::R_PPC64_DTPREL64;
461 Type = ELF::R_PPC_DTPREL32;
464 Type = ELF::R_PPC_ADDR32;
468 Type = ELF::R_PPC_ADDR16;
475bool PPCELFObjectWriter::needsRelocateWithSymbol(
const MCValue &,
477 unsigned Type)
const {
482 case ELF::R_PPC_REL24:
483 case ELF::R_PPC64_REL24_NOTOC:
489 unsigned Other = cast<MCSymbolELF>(
Sym).getOther() << 2;
494std::unique_ptr<MCObjectTargetWriter>
496 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.