34 uint64_t &FixedValue);
41 uint64_t &FixedValue);
49 uint64_t &FixedValue);
56 uint64_t &FixedValue);
58 X86MachObjectWriter(
bool Is64Bit, uint32_t
CPUType,
68 RecordX86_64Relocation(Writer, Asm, Layout, Fragment, Fixup, Target,
71 RecordX86Relocation(Writer, Asm, Layout, Fragment, Fixup, Target,
106 uint64_t &FixedValue) {
112 uint32_t FixupOffset =
114 uint32_t FixupAddress =
118 unsigned IsExtern = 0;
129 Value += 1LL << Log2Size;
179 if (A_Base == B_Base && A_Base)
254 Value -= FixupAddress + (1 << Log2Size);
258 bool isAbs = Value->EvaluateAsAbsolute(Res, Layout,
265 Symbol->
getName() +
"'",
false);
269 Symbol->
getName() +
"'",
false);
305 switch (-(Target.
getConstant() + (1LL << Log2Size))) {
314 "relocation",
false);
338 "64-bit mode",
false);
357 bool X86MachObjectWriter::RecordScatteredRelocation(
MachObjectWriter *Writer,
364 uint64_t &FixedValue) {
375 "' can not be undefined in a subtraction expression",
380 FixedValue += SecAddr;
388 "' can not be undefined in a subtraction expression",
407 if (FixupOffset > 0xffffff) {
409 format(
"0x%x", FixupOffset).print(Buffer,
sizeof(Buffer));
411 Twine(
"Section too large, can't encode "
412 "r_address (") + Buffer +
413 ") into 24 bits of scattered "
414 "relocation entry.");
434 if (FixupOffset > 0xffffff)
439 MRE.
r_word0 = ((FixupOffset << 0) |
455 uint64_t &FixedValue) {
458 "Should only be called with a 32-bit TLVP relocation!");
462 unsigned IsPCRel = 0;
474 uint32_t FixupAddress =
480 FixedValue += 1ULL << Log2Size;
502 uint64_t &FixedValue) {
509 RecordTLVPRelocation(Writer, Asm, Layout, Fragment, Fixup, Target,
518 RecordScatteredRelocation(Writer, Asm, Layout, Fragment, Fixup,
519 Target, Log2Size, FixedValue);
532 Offset += 1 << Log2Size;
537 RecordScatteredRelocation(Writer, Asm, Layout, Fragment, Fixup,
538 Target, Log2Size, FixedValue))
544 unsigned IsExtern = 0;
600 uint32_t CPUSubtype) {
const MCSymbol & getSymbol() const
static bool isFixupKindRIPRel(unsigned Kind)
MCContext & getContext() const
const MCSymbol & getSymbol() const
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(const char *reason, bool gen_crash_diag=true)
A one-byte pc relative fixup.
uint64_t getIndex() const
getIndex - Get the (implementation defined) index.
const MCSection & getSection() const
MCObjectWriter * createX86MachObjectWriter(raw_ostream &OS, bool Is64Bit, uint32_t CPUType, uint32_t CPUSubtype)
createX86MachObjectWriter - Construct an X86 Mach-O object writer.
uint64_t getSymbolAddress(const MCSymbolData *SD, const MCAsmLayout &Layout) const
const MCSymbolData * getAtom(const MCSymbolData *Symbol) const
#define llvm_unreachable(msg)
const MCExpr * getVariableValue() const
getVariableValue() - Get the value for variable symbols.
MCSectionData & getSectionData(const MCSection &Section) const
format_object1< T > format(const char *Fmt, const T &Val)
bool isFixupKindPCRel(const MCAssembler &Asm, unsigned Kind)
uint64_t getSectionAddress(const MCSectionData *SD) const
bool isAbsolute() const
isAbsolute - Is this an absolute (as opposed to relocatable) value.
MCFragment * getFragment() const
const MCSection & getSection() const
uint32_t getOffset() const
SectionAddrMap & getSectionAddressMap()
unsigned getOrdinal() const
MCSectionData * getParent() const
bool hasAttribute(unsigned Value) const
MCFixupKind getKind() const
const MCSymbolRefExpr * getSymB() const
LLVM_ATTRIBUTE_NORETURN void FatalError(SMLoc L, const Twine &Msg)
MCSymbolData & getSymbolData(const MCSymbol &Symbol) const
static unsigned getFixupKindLog2Size(unsigned Kind)
A two-byte pc relative fixup.
const MCSymbolRefExpr * getSymA() const
A four-byte pc relative fixup.
uint64_t getFragmentAddress(const MCFragment *Fragment, const MCAsmLayout &Layout) const
uint64_t getSymbolOffset(const MCSymbolData *SD) const
Get the offset of the given symbol, as computed in the current layout.
bool isTemporary() const
isTemporary - Check if this is an assembler temporary symbol.
bool doesSymbolRequireExternRelocation(const MCSymbolData *SD)
StringRef getName() const
getName - Get the symbol name.
const MCSymbol & AliasedSymbol() const
uint64_t getFragmentOffset(const MCFragment *F) const
Get the offset of the given fragment inside its containing section.
bool isVariable() const
isVariable - Check if this is a variable symbol.
VariantKind getKind() const
int64_t getConstant() const
LLVM Value Representation.
void addRelocation(const MCSectionData *SD, MachO::any_relocation_info &MRE)
bool isUndefined() const
isUndefined - Check if this symbol undefined (i.e., implicitly defined).
MCObjectWriter * createMachObjectWriter(MCMachObjectTargetWriter *MOTW, raw_ostream &OS, bool IsLittleEndian)
Construct a new Mach-O writer instance.