26 PPCELFObjectWriter(
bool Is64Bit, uint8_t OSABI);
30 const MCFixup &Fixup,
bool IsPCRel)
const override;
32 bool needsRelocateWithSymbol(
const MCSymbol &Sym,
33 unsigned Type)
const override;
37 PPCELFObjectWriter::PPCELFObjectWriter(
bool Is64Bit, uint8_t OSABI)
49 switch (cast<PPCMCExpr>(Expr)->getKind()) {
82 switch ((
unsigned)Fixup.
getKind()) {
90 Type = ELF::R_PPC_REL24;
93 Type = ELF::R_PPC_PLTREL24;
96 Type = ELF::R_PPC_LOCAL24PC;
102 Type = ELF::R_PPC_REL14;
108 Type = ELF::R_PPC_REL16;
111 Type = ELF::R_PPC_REL16_LO;
114 Type = ELF::R_PPC_REL16_HI;
117 Type = ELF::R_PPC_REL16_HA;
127 Type = ELF::R_PPC_REL32;
131 Type = ELF::R_PPC64_REL64;
135 switch ((
unsigned)Fixup.
getKind()) {
138 Type = ELF::R_PPC_ADDR24;
141 Type = ELF::R_PPC_ADDR14;
147 Type = ELF::R_PPC_ADDR16;
150 Type = ELF::R_PPC_ADDR16_LO;
153 Type = ELF::R_PPC_ADDR16_HI;
156 Type = ELF::R_PPC_ADDR16_HA;
159 Type = ELF::R_PPC64_ADDR16_HIGH;
162 Type = ELF::R_PPC64_ADDR16_HIGHA;
165 Type = ELF::R_PPC64_ADDR16_HIGHER;
168 Type = ELF::R_PPC64_ADDR16_HIGHERA;
171 Type = ELF::R_PPC64_ADDR16_HIGHEST;
174 Type = ELF::R_PPC64_ADDR16_HIGHESTA;
177 Type = ELF::R_PPC_GOT16;
180 Type = ELF::R_PPC_GOT16_LO;
183 Type = ELF::R_PPC_GOT16_HI;
186 Type = ELF::R_PPC_GOT16_HA;
189 Type = ELF::R_PPC64_TOC16;
192 Type = ELF::R_PPC64_TOC16_LO;
195 Type = ELF::R_PPC64_TOC16_HI;
198 Type = ELF::R_PPC64_TOC16_HA;
201 Type = ELF::R_PPC_TPREL16;
204 Type = ELF::R_PPC_TPREL16_LO;
207 Type = ELF::R_PPC_TPREL16_HI;
210 Type = ELF::R_PPC_TPREL16_HA;
213 Type = ELF::R_PPC64_TPREL16_HIGH;
216 Type = ELF::R_PPC64_TPREL16_HIGHA;
219 Type = ELF::R_PPC64_TPREL16_HIGHER;
222 Type = ELF::R_PPC64_TPREL16_HIGHERA;
225 Type = ELF::R_PPC64_TPREL16_HIGHEST;
228 Type = ELF::R_PPC64_TPREL16_HIGHESTA;
231 Type = ELF::R_PPC64_DTPREL16;
234 Type = ELF::R_PPC64_DTPREL16_LO;
237 Type = ELF::R_PPC64_DTPREL16_HI;
240 Type = ELF::R_PPC64_DTPREL16_HA;
243 Type = ELF::R_PPC64_DTPREL16_HIGH;
246 Type = ELF::R_PPC64_DTPREL16_HIGHA;
249 Type = ELF::R_PPC64_DTPREL16_HIGHER;
252 Type = ELF::R_PPC64_DTPREL16_HIGHERA;
255 Type = ELF::R_PPC64_DTPREL16_HIGHEST;
258 Type = ELF::R_PPC64_DTPREL16_HIGHESTA;
262 Type = ELF::R_PPC64_GOT_TLSGD16;
264 Type = ELF::R_PPC_GOT_TLSGD16;
267 Type = ELF::R_PPC64_GOT_TLSGD16_LO;
270 Type = ELF::R_PPC64_GOT_TLSGD16_HI;
273 Type = ELF::R_PPC64_GOT_TLSGD16_HA;
277 Type = ELF::R_PPC64_GOT_TLSLD16;
279 Type = ELF::R_PPC_GOT_TLSLD16;
282 Type = ELF::R_PPC64_GOT_TLSLD16_LO;
285 Type = ELF::R_PPC64_GOT_TLSLD16_HI;
288 Type = ELF::R_PPC64_GOT_TLSLD16_HA;
293 Type = ELF::R_PPC64_GOT_TPREL16_DS;
298 Type = ELF::R_PPC64_GOT_TPREL16_LO_DS;
301 Type = ELF::R_PPC64_GOT_TPREL16_HI;
306 Type = ELF::R_PPC64_GOT_DTPREL16_DS;
311 Type = ELF::R_PPC64_GOT_DTPREL16_LO_DS;
314 Type = ELF::R_PPC64_GOT_TPREL16_HA;
317 Type = ELF::R_PPC64_GOT_DTPREL16_HI;
320 Type = ELF::R_PPC64_GOT_DTPREL16_HA;
328 Type = ELF::R_PPC64_ADDR16_DS;
331 Type = ELF::R_PPC64_ADDR16_LO_DS;
334 Type = ELF::R_PPC64_GOT16_DS;
337 Type = ELF::R_PPC64_GOT16_LO_DS;
340 Type = ELF::R_PPC64_TOC16_DS;
343 Type = ELF::R_PPC64_TOC16_LO_DS;
346 Type = ELF::R_PPC64_TPREL16_DS;
349 Type = ELF::R_PPC64_TPREL16_LO_DS;
352 Type = ELF::R_PPC64_DTPREL16_DS;
355 Type = ELF::R_PPC64_DTPREL16_LO_DS;
358 Type = ELF::R_PPC64_GOT_TPREL16_DS;
361 Type = ELF::R_PPC64_GOT_TPREL16_LO_DS;
364 Type = ELF::R_PPC64_GOT_DTPREL16_DS;
367 Type = ELF::R_PPC64_GOT_DTPREL16_LO_DS;
376 Type = ELF::R_PPC64_TLSGD;
378 Type = ELF::R_PPC_TLSGD;
382 Type = ELF::R_PPC64_TLSLD;
384 Type = ELF::R_PPC_TLSLD;
388 Type = ELF::R_PPC64_TLS;
390 Type = ELF::R_PPC_TLS;
398 Type = ELF::R_PPC64_TOC;
401 Type = ELF::R_PPC64_ADDR64;
404 Type = ELF::R_PPC64_DTPMOD64;
407 Type = ELF::R_PPC64_TPREL64;
410 Type = ELF::R_PPC64_DTPREL64;
415 Type = ELF::R_PPC_ADDR32;
418 Type = ELF::R_PPC_ADDR16;
425 bool PPCELFObjectWriter::needsRelocateWithSymbol(
const MCSymbol &Sym,
426 unsigned Type)
const {
431 case ELF::R_PPC_REL24:
437 unsigned Other = cast<MCSymbolELF>(Sym).getOther() << 2;
442 std::unique_ptr<MCObjectTargetWriter>
444 return llvm::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 ...
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...
static bool is64Bit(const char *name)
#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)
const MCExpr * getValue() const
Target specific expression.
14-bit PC relative relocation for conditional branches.
MCFixupKind getKind() const