25 PPCELFObjectWriter(
bool Is64Bit, uint8_t OSABI);
29 const MCFixup &Fixup,
bool IsPCRel)
const override;
31 bool needsRelocateWithSymbol(
const MCSymbol &Sym,
32 unsigned Type)
const override;
36 PPCELFObjectWriter::PPCELFObjectWriter(
bool Is64Bit, uint8_t OSABI)
48 switch (cast<PPCMCExpr>(Expr)->getKind()) {
89 Type = ELF::R_PPC_REL24;
92 Type = ELF::R_PPC_PLTREL24;
95 Type = ELF::R_PPC_LOCAL24PC;
101 Type = ELF::R_PPC_REL14;
107 Type = ELF::R_PPC_REL16;
110 Type = ELF::R_PPC_REL16_LO;
113 Type = ELF::R_PPC_REL16_HI;
116 Type = ELF::R_PPC_REL16_HA;
126 Type = ELF::R_PPC_REL32;
130 Type = ELF::R_PPC64_REL64;
137 Type = ELF::R_PPC_NONE;
140 Type = ELF::R_PPC_ADDR24;
143 Type = ELF::R_PPC_ADDR14;
149 Type = ELF::R_PPC_ADDR16;
152 Type = ELF::R_PPC_ADDR16_LO;
155 Type = ELF::R_PPC_ADDR16_HI;
158 Type = ELF::R_PPC_ADDR16_HA;
161 Type = ELF::R_PPC64_ADDR16_HIGH;
164 Type = ELF::R_PPC64_ADDR16_HIGHA;
167 Type = ELF::R_PPC64_ADDR16_HIGHER;
170 Type = ELF::R_PPC64_ADDR16_HIGHERA;
173 Type = ELF::R_PPC64_ADDR16_HIGHEST;
176 Type = ELF::R_PPC64_ADDR16_HIGHESTA;
179 Type = ELF::R_PPC_GOT16;
182 Type = ELF::R_PPC_GOT16_LO;
185 Type = ELF::R_PPC_GOT16_HI;
188 Type = ELF::R_PPC_GOT16_HA;
191 Type = ELF::R_PPC64_TOC16;
194 Type = ELF::R_PPC64_TOC16_LO;
197 Type = ELF::R_PPC64_TOC16_HI;
200 Type = ELF::R_PPC64_TOC16_HA;
203 Type = ELF::R_PPC_TPREL16;
206 Type = ELF::R_PPC_TPREL16_LO;
209 Type = ELF::R_PPC_TPREL16_HI;
212 Type = ELF::R_PPC_TPREL16_HA;
215 Type = ELF::R_PPC64_TPREL16_HIGH;
218 Type = ELF::R_PPC64_TPREL16_HIGHA;
221 Type = ELF::R_PPC64_TPREL16_HIGHER;
224 Type = ELF::R_PPC64_TPREL16_HIGHERA;
227 Type = ELF::R_PPC64_TPREL16_HIGHEST;
230 Type = ELF::R_PPC64_TPREL16_HIGHESTA;
233 Type = ELF::R_PPC64_DTPREL16;
236 Type = ELF::R_PPC64_DTPREL16_LO;
239 Type = ELF::R_PPC64_DTPREL16_HI;
242 Type = ELF::R_PPC64_DTPREL16_HA;
245 Type = ELF::R_PPC64_DTPREL16_HIGH;
248 Type = ELF::R_PPC64_DTPREL16_HIGHA;
251 Type = ELF::R_PPC64_DTPREL16_HIGHER;
254 Type = ELF::R_PPC64_DTPREL16_HIGHERA;
257 Type = ELF::R_PPC64_DTPREL16_HIGHEST;
260 Type = ELF::R_PPC64_DTPREL16_HIGHESTA;
264 Type = ELF::R_PPC64_GOT_TLSGD16;
266 Type = ELF::R_PPC_GOT_TLSGD16;
269 Type = ELF::R_PPC64_GOT_TLSGD16_LO;
272 Type = ELF::R_PPC64_GOT_TLSGD16_HI;
275 Type = ELF::R_PPC64_GOT_TLSGD16_HA;
279 Type = ELF::R_PPC64_GOT_TLSLD16;
281 Type = ELF::R_PPC_GOT_TLSLD16;
284 Type = ELF::R_PPC64_GOT_TLSLD16_LO;
287 Type = ELF::R_PPC64_GOT_TLSLD16_HI;
290 Type = ELF::R_PPC64_GOT_TLSLD16_HA;
295 Type = ELF::R_PPC64_GOT_TPREL16_DS;
300 Type = ELF::R_PPC64_GOT_TPREL16_LO_DS;
303 Type = ELF::R_PPC64_GOT_TPREL16_HI;
308 Type = ELF::R_PPC64_GOT_DTPREL16_DS;
313 Type = ELF::R_PPC64_GOT_DTPREL16_LO_DS;
316 Type = ELF::R_PPC64_GOT_TPREL16_HA;
319 Type = ELF::R_PPC64_GOT_DTPREL16_HI;
322 Type = ELF::R_PPC64_GOT_DTPREL16_HA;
330 Type = ELF::R_PPC64_ADDR16_DS;
333 Type = ELF::R_PPC64_ADDR16_LO_DS;
336 Type = ELF::R_PPC64_GOT16_DS;
339 Type = ELF::R_PPC64_GOT16_LO_DS;
342 Type = ELF::R_PPC64_TOC16_DS;
345 Type = ELF::R_PPC64_TOC16_LO_DS;
348 Type = ELF::R_PPC64_TPREL16_DS;
351 Type = ELF::R_PPC64_TPREL16_LO_DS;
354 Type = ELF::R_PPC64_DTPREL16_DS;
357 Type = ELF::R_PPC64_DTPREL16_LO_DS;
360 Type = ELF::R_PPC64_GOT_TPREL16_DS;
363 Type = ELF::R_PPC64_GOT_TPREL16_LO_DS;
366 Type = ELF::R_PPC64_GOT_DTPREL16_DS;
369 Type = ELF::R_PPC64_GOT_DTPREL16_LO_DS;
378 Type = ELF::R_PPC64_TLSGD;
380 Type = ELF::R_PPC_TLSGD;
384 Type = ELF::R_PPC64_TLSLD;
386 Type = ELF::R_PPC_TLSLD;
390 Type = ELF::R_PPC64_TLS;
392 Type = ELF::R_PPC_TLS;
400 Type = ELF::R_PPC64_TOC;
403 Type = ELF::R_PPC64_ADDR64;
406 Type = ELF::R_PPC64_DTPMOD64;
409 Type = ELF::R_PPC64_TPREL64;
412 Type = ELF::R_PPC64_DTPREL64;
417 Type = ELF::R_PPC_ADDR32;
420 Type = ELF::R_PPC_ADDR16;
427 bool PPCELFObjectWriter::needsRelocateWithSymbol(
const MCSymbol &Sym,
428 unsigned Type)
const {
433 case ELF::R_PPC_REL24:
439 unsigned Other = cast<MCSymbolELF>(Sym).getOther() << 2;
444 std::unique_ptr<MCObjectTargetWriter>
446 return std::make_unique<PPCELFObjectWriter>(Is64Bit, OSABI);
A eight-byte pc relative fixup.
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
This class represents lattice values for constants.
This represents an "assembler immediate".
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Optional< std::vector< StOtherPiece > > Other
14-bit absolute relocation for conditional branches.
block Block Frequency true
MCSymbolRefExpr::VariantKind getAccessVariant() const
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
A 16-bit fixup corresponding to lo16(_foo) or ha16(_foo) for instrs like 'li' or 'addis'.
24-bit absolute relocation for direct branches like 'ba' and 'bla'.
std::unique_ptr< MCObjectTargetWriter > createPPCELFObjectWriter(bool Is64Bit, uint8_t OSABI)
Construct an PPC ELF object writer.
Base class for the full range of assembler expressions which are needed for parsing.
Not a true fixup, but ties a symbol to a call to __tls_get_addr for the TLS general and local dynamic...
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.
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.
PowerPC TLS Dynamic Call Fixup
void print(raw_ostream &OS) const
Print the value to the stream OS.
A four-byte pc relative fixup.
Target - Wrapper for Target specific information.
A 14-bit fixup corresponding to lo16(_foo) with implied 2 zero bits for instrs like 'std'...
static MCSymbolRefExpr::VariantKind getAccessVariant(const MCValue &Target, const MCFixup &Fixup)
unsigned getTargetKind() const
const MCExpr * getValue() const
Target specific expression.
14-bit PC relative relocation for conditional branches.
static bool is64Bit(const char *name)