32 unsigned Log2Size, uint64_t &FixedValue);
46 uint64_t &FixedValue)
override {
50 RecordPPCRelocation(Writer, Asm, Layout, Fragment, Fixup, Target,
93 switch ((
unsigned)FixupKind) {
119 switch ((
unsigned)FixupKind) {
148 const unsigned IsPCRel,
const unsigned Log2Size,
149 const unsigned IsExtern,
const unsigned Type) {
166 const unsigned Log2Size,
const unsigned IsPCRel,
170 MRE.
r_word0 = ((Addr << 0) | (Type << 24) | (Log2Size << 28) |
191 bool PPCMachObjectWriter::recordScatteredRelocation(
194 unsigned Log2Size, uint64_t &FixedValue) {
211 "' can not be undefined in a subtraction expression");
215 FixedValue += SecAddr;
223 "' can not be undefined in a subtraction expression");
241 if (FixupOffset > 0xffffff) {
243 format(
"0x%x", FixupOffset).print(Buffer,
sizeof(Buffer));
245 Twine(
"Section too large, can't encode " 247 Buffer +
") into 24 bits of scattered " 248 "relocation entry.");
257 other_half = (FixedValue >> 16) & 0xffff;
263 FixedValue &= 0xffff;
266 other_half = FixedValue & 0xffff;
268 ((FixedValue >> 16) + ((FixedValue & 0x8000) ? 1 : 0)) & 0xffff;
271 other_half = FixedValue & 0xffff;
272 FixedValue = (FixedValue >> 16) & 0xffff;
281 Log2Size, IsPCRel, Value2);
291 if (FixupOffset > 0xffffff)
301 void PPCMachObjectWriter::RecordPPCRelocation(
304 uint64_t &FixedValue) {
308 const unsigned RelocType =
getRelocType(Target, FK, IsPCRel);
317 recordScatteredRelocation(Writer, Asm, Layout, Fragment, Fixup, Target,
318 Log2Size, FixedValue);
331 unsigned Type = RelocType;
333 const MCSymbol *RelSymbol =
nullptr;
340 "not yet implemented");
377 std::unique_ptr<MCObjectTargetWriter>
380 return llvm::make_unique<PPCMachObjectWriter>(Is64Bit,
CPUType, CPUSubtype);
Instances of this class represent a uniqued identifier for a section in the current translation unit...
A eight-byte pc relative fixup.
uint64_t getSymbolAddress(const MCSymbol &S, const MCAsmLayout &Layout) const
bool doesSymbolRequireExternRelocation(const MCSymbol &S)
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.
bool isVariable() const
isVariable - Check if this is a variable symbol.
This represents an "assembler immediate".
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
VariantKind getKind() const
static void makeRelocationInfo(MachO::any_relocation_info &MRE, const uint32_t FixupOffset, const uint32_t Index, const unsigned IsPCRel, const unsigned Log2Size, const unsigned IsExtern, const unsigned Type)
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
bool isAbsolute() const
Is this an absolute (as opposed to relocatable) value.
unsigned getOrdinal() const
static Lanai::Fixups FixupKind(const MCExpr *Expr)
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
static uint32_t getFixupOffset(const MCAsmLayout &Layout, const MCFragment *Fragment, const MCFixup &Fixup)
Compute fixup offset (address).
A one-byte pc relative fixup.
MCContext & getContext() const
A 16-bit fixup corresponding to lo16(_foo) or ha16(_foo) for instrs like 'li' or 'addis'.
const MCSymbolRefExpr * getSymB() const
std::unique_ptr< MCObjectTargetWriter > createPPCMachObjectWriter(bool Is64Bit, uint32_t CPUType, uint32_t CPUSubtype)
Construct a PPC Mach-O object writer.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Encapsulates the layout of an assembly file at a particular point in time.
Represent a reference to a symbol from inside an expression.
static unsigned getRelocType(const MCValue &Target, const MCFixupKind FixupKind, const bool IsPCRel)
Translates generic PPC fixup kind to Mach-O/PPC relocation type enum.
bool isFixupKindPCRel(const MCAssembler &Asm, unsigned Kind)
void addRelocation(const MCSymbol *RelSymbol, const MCSection *Sec, MachO::any_relocation_info &MRE)
SectionAddrMap & getSectionAddressMap()
static unsigned getFixupKindLog2Size(unsigned Kind)
computes the log2 of the size of the relocation, used for relocation_info::r_length.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static void makeScatteredRelocationInfo(MachO::any_relocation_info &MRE, const uint32_t Addr, const unsigned Type, const unsigned Log2Size, const unsigned IsPCRel, const uint32_t Value2)
The instances of the Type class are immutable: once they are created, they are never changed...
MCFixupKind
Extensible enumeration to represent the type of a fixup.
bool getSymbolOffset(const MCSymbol &S, uint64_t &Val) const
Get the offset of the given symbol, as computed in the current layout.
const MCSymbolRefExpr * getSymA() const
void reportError(SMLoc L, const Twine &Msg)
uint32_t getOffset() const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
uint64_t getFragmentOffset(const MCFragment *F) const
Get the offset of the given fragment inside its containing section.
PowerPC TLS Dynamic Call Fixup
A two-byte pc relative fixup.
A four-byte pc relative fixup.
const MCSymbol & getSymbol() const
bool isUndefined(bool SetUsed=true) const
isUndefined - Check if this symbol undefined (i.e., implicitly defined).
MCFragment * getFragment(bool SetUsed=true) const
Target - Wrapper for Target specific information.
MCSection * getParent() const
MCSection & getSection() const
Get the section associated with a defined, non-absolute symbol.
uint64_t getSectionAddress(const MCSection *Sec) const
StringRef getName() const
getName - Get the symbol name.
const MCExpr * getVariableValue(bool SetUsed=true) const
getVariableValue - Get the value for variable symbols.
LLVM Value Representation.
14-bit PC relative relocation for conditional branches.
MCFixupKind getKind() const