• Home
  • Raw
  • Download

Lines Matching +full:block +full:- +full:fixup

1 //===-- PPCMachObjectWriter.cpp - PPC Mach-O Writer -----------------------===//
8 //===----------------------------------------------------------------------===//
31 const MCFixup &Fixup, MCValue Target,
36 const MCFragment *Fragment, const MCFixup &Fixup,
45 const MCFixup &Fixup, MCValue Target, in recordRelocation() argument
47 if (Writer->is64Bit()) { in recordRelocation()
50 RecordPPCRelocation(Writer, Asm, Layout, Fragment, Fixup, Target, in recordRelocation()
61 report_fatal_error("log2size(FixupKind): Unhandled fixup kind!"); in getFixupKindLog2Size()
81 /// Translates generic PPC fixup kind to Mach-O/PPC relocation type enum.
85 // Fixup.getKind() in getRelocType()
89 : Target.getSymA()->getKind(); in getRelocType()
95 report_fatal_error("Unimplemented fixup kind (relative)"); in getRelocType()
105 llvm_unreachable("Unsupported modifier for half16 fixup"); in getRelocType()
121 report_fatal_error("Unimplemented fixup kind (absolute)!"); in getRelocType()
125 llvm_unreachable("Unsupported modifier for half16 fixup"); in getRelocType()
151 // The bitfield offsets that work (as determined by trial-and-error) in makeRelocationInfo()
152 // are different than what is documented in the mach-o manuals. in makeRelocationInfo()
169 …onceptual/MachORuntime/Reference/reference.html#//apple_ref/doc/uid/20001298-scattered_relocation_… in makeScatteredRelocationInfo()
175 /// Compute fixup offset (address).
178 const MCFixup &Fixup) { in getFixupOffset() argument
179 uint32_t FixupOffset = Layout.getFragmentOffset(Fragment) + Fixup.getOffset(); in getFixupOffset()
180 // On Mach-O, ppc_fixup_half16 relocations must refer to the in getFixupOffset()
182 if (unsigned(Fixup.getKind()) == PPC::fixup_ppc_half16) in getFixupOffset()
187 /// \return false if falling back to using non-scattered relocation,
193 const MCFragment *Fragment, const MCFixup &Fixup, MCValue Target, in recordScatteredRelocation() argument
196 const uint32_t FixupOffset = getFixupOffset(Layout, Fragment, Fixup); in recordScatteredRelocation()
197 const MCFixupKind FK = Fixup.getKind(); in recordScatteredRelocation()
198 const unsigned IsPCRel = Writer->isFixupKindPCRel(Asm, FK); in recordScatteredRelocation()
203 // and require two entries, the first for the add-symbol value, in recordScatteredRelocation()
204 // the second for the subtract-symbol value. in recordScatteredRelocation()
207 const MCSymbol *A = &Target.getSymA()->getSymbol(); in recordScatteredRelocation()
209 if (!A->getFragment()) in recordScatteredRelocation()
210 report_fatal_error("symbol '" + A->getName() + in recordScatteredRelocation()
213 uint32_t Value = Writer->getSymbolAddress(*A, Layout); in recordScatteredRelocation()
214 uint64_t SecAddr = Writer->getSectionAddress(A->getFragment()->getParent()); in recordScatteredRelocation()
219 const MCSymbol *SB = &B->getSymbol(); in recordScatteredRelocation()
221 if (!SB->getFragment()) in recordScatteredRelocation()
222 report_fatal_error("symbol '" + B->getSymbol().getName() + in recordScatteredRelocation()
226 Value2 = Writer->getSymbolAddress(B->getSymbol(), Layout); in recordScatteredRelocation()
227 FixedValue -= Writer->getSectionAddress(SB->getFragment()->getParent()); in recordScatteredRelocation()
244 Asm.getContext().reportError(Fixup.getLoc(), in recordScatteredRelocation()
260 // It looks like this is not true for the FixedValue needed with Mach-O in recordScatteredRelocation()
282 Writer->addRelocation(nullptr, Fragment->getParent(), MRE); in recordScatteredRelocation()
284 // If the offset is more than 24-bits, it won't fit in a scattered in recordScatteredRelocation()
285 // relocation offset field, so we fall back to using a non-scattered in recordScatteredRelocation()
287 // the block and the linker is doing scattered loading on this in recordScatteredRelocation()
296 Writer->addRelocation(nullptr, Fragment->getParent(), MRE); in recordScatteredRelocation()
303 const MCFragment *Fragment, const MCFixup &Fixup, MCValue Target, in RecordPPCRelocation() argument
305 const MCFixupKind FK = Fixup.getKind(); // unsigned in RecordPPCRelocation()
307 const bool IsPCRel = Writer->isFixupKindPCRel(Asm, FK); in RecordPPCRelocation()
317 recordScatteredRelocation(Writer, Asm, Layout, Fragment, Fixup, Target, in RecordPPCRelocation()
326 A = &Target.getSymA()->getSymbol(); in RecordPPCRelocation()
329 const uint32_t FixupOffset = getFixupOffset(Layout, Fragment, Fixup); in RecordPPCRelocation()
344 if (A->isVariable()) { in RecordPPCRelocation()
346 if (A->getVariableValue()->evaluateAsAbsolute( in RecordPPCRelocation()
347 Res, Layout, Writer->getSectionAddressMap())) { in RecordPPCRelocation()
354 if (Writer->doesSymbolRequireExternRelocation(*A)) { in RecordPPCRelocation()
356 // For external relocations, make sure to offset the fixup value to in RecordPPCRelocation()
359 if (!A->isUndefined()) in RecordPPCRelocation()
360 FixedValue -= Layout.getSymbolOffset(*A); in RecordPPCRelocation()
362 // The index is the section ordinal (1-based). in RecordPPCRelocation()
363 const MCSection &Sec = A->getSection(); in RecordPPCRelocation()
365 FixedValue += Writer->getSectionAddress(&Sec); in RecordPPCRelocation()
368 FixedValue -= Writer->getSectionAddress(Fragment->getParent()); in RecordPPCRelocation()
374 Writer->addRelocation(RelSymbol, Fragment->getParent(), MRE); in RecordPPCRelocation()