32 unsigned Log2Size, uint64_t &FixedValue);
40 PPCMachObjectWriter(
bool Is64Bit, uint32_t
CPUType, uint32_t CPUSubtype)
47 uint64_t &FixedValue) {
51 RecordPPCRelocation(Writer, Asm, Layout, Fragment, Fixup, Target,
94 switch ((
unsigned)FixupKind) {
120 switch ((
unsigned)FixupKind) {
148 const uint32_t FixupOffset,
const uint32_t Index,
149 const unsigned IsPCRel,
const unsigned Log2Size,
150 const unsigned IsExtern,
const unsigned Type) {
166 const uint32_t Addr,
const unsigned Type,
167 const unsigned Log2Size,
const unsigned IsPCRel,
168 const uint32_t Value2) {
171 MRE.
r_word0 = ((Addr << 0) | (Type << 24) | (Log2Size << 28) |
172 (IsPCRel << 30) | MachO::R_SCATTERED);
184 FixupOffset &= ~uint32_t(3);
192 bool PPCMachObjectWriter::RecordScatteredRelocation(
195 unsigned Log2Size, uint64_t &FixedValue) {
197 const uint32_t FixupOffset =
getFixupOffset(Layout, Fragment, Fixup);
213 "' can not be undefined in a subtraction expression");
218 FixedValue += SecAddr;
226 "' can not be undefined in a subtraction expression");
244 if (FixupOffset > 0xffffff) {
246 format(
"0x%x", FixupOffset).print(Buffer,
sizeof(Buffer));
248 Twine(
"Section too large, can't encode "
250 Buffer +
") into 24 bits of scattered "
251 "relocation entry.");
257 uint32_t other_half = 0;
260 other_half = (FixedValue >> 16) & 0xffff;
266 FixedValue &= 0xffff;
269 other_half = FixedValue & 0xffff;
271 ((FixedValue >> 16) + ((FixedValue & 0x8000) ? 1 : 0)) & 0xffff;
274 other_half = FixedValue & 0xffff;
275 FixedValue = (FixedValue >> 16) & 0xffff;
284 Log2Size, IsPCRel, Value2);
294 if (FixupOffset > 0xffffff)
304 void PPCMachObjectWriter::RecordPPCRelocation(
307 uint64_t &FixedValue) {
311 const unsigned RelocType =
getRelocType(Target, FK, IsPCRel);
320 RecordScatteredRelocation(Writer, Asm, Layout, Fragment, Fixup, Target,
321 Log2Size, FixedValue);
332 const uint32_t FixupOffset =
getFixupOffset(Layout, Fragment, Fixup);
334 unsigned IsExtern = 0;
335 unsigned Type = RelocType;
343 "not yet implemented");
385 uint32_t CPUSubtype) {
387 new PPCMachObjectWriter(Is64Bit, CPUType, CPUSubtype), OS,
COFF::RelocationTypeX86 Type
A eight-byte pc relative fixup.
const MCSymbol & getSymbol() 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)
MCContext & getContext() const
const MCSymbol & getSymbol() const
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(const char *reason, bool gen_crash_diag=true)
static uint32_t getFixupOffset(const MCAsmLayout &Layout, const MCFragment *Fragment, const MCFixup &Fixup)
Compute fixup offset (address).
A one-byte pc relative fixup.
uint64_t getIndex() const
getIndex - Get the (implementation defined) index.
const MCSection & getSection() const
uint64_t getSymbolAddress(const MCSymbolData *SD, const MCAsmLayout &Layout) const
#define llvm_unreachable(msg)
const MCExpr * getVariableValue() const
getVariableValue() - Get the value for variable symbols.
static unsigned getRelocType(const MCValue &Target, const MCFixupKind FixupKind, const bool IsPCRel)
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
uint32_t getOffset() const
SectionAddrMap & getSectionAddressMap()
unsigned getOrdinal() const
static unsigned getFixupKindLog2Size(unsigned Kind)
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)
MCSectionData * getParent() const
MCFixupKind
MCFixupKind - Extensible enumeration to represent the type of a fixup.
MCFixupKind getKind() const
const MCSymbolRefExpr * getSymB() const
MCObjectWriter * createPPCMachObjectWriter(raw_ostream &OS, bool Is64Bit, uint32_t CPUType, uint32_t CPUSubtype)
createPPCELFObjectWriter - Construct a PPC Mach-O object writer.
LLVM_ATTRIBUTE_NORETURN void FatalError(SMLoc L, const Twine &Msg)
MCSymbolData & getSymbolData(const MCSymbol &Symbol) const
A two-byte pc relative fixup.
const MCSymbolRefExpr * getSymA() const
A four-byte pc relative fixup.
uint64_t getSymbolOffset(const MCSymbolData *SD) const
Get the offset of the given symbol, as computed in the current layout.
bool doesSymbolRequireExternRelocation(const MCSymbolData *SD)
StringRef getName() const
getName - Get the symbol name.
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
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.