LLVM  14.0.0git
RuntimeDyldMachO.cpp
Go to the documentation of this file.
1 //===-- RuntimeDyldMachO.cpp - Run-time dynamic linker for MC-JIT -*- C++ -*-=//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Implementation of the MC-JIT runtime dynamic linker.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "RuntimeDyldMachO.h"
18 #include "llvm/ADT/STLExtras.h"
19 #include "llvm/ADT/StringRef.h"
20 
21 using namespace llvm;
22 using namespace llvm::object;
23 
24 #define DEBUG_TYPE "dyld"
25 
26 namespace {
27 
28 class LoadedMachOObjectInfo final
29  : public LoadedObjectInfoHelper<LoadedMachOObjectInfo,
30  RuntimeDyld::LoadedObjectInfo> {
31 public:
32  LoadedMachOObjectInfo(RuntimeDyldImpl &RTDyld,
33  ObjSectionToIDMap ObjSecToIDMap)
34  : LoadedObjectInfoHelper(RTDyld, std::move(ObjSecToIDMap)) {}
35 
37  getObjectForDebug(const ObjectFile &Obj) const override {
38  return OwningBinary<ObjectFile>();
39  }
40 };
41 
42 }
43 
44 namespace llvm {
45 
47  unsigned NumBytes = 1 << RE.Size;
48  uint8_t *Src = Sections[RE.SectionID].getAddress() + RE.Offset;
49 
50  return static_cast<int64_t>(readBytesUnaligned(Src, NumBytes));
51 }
52 
55  unsigned SectionID, relocation_iterator RelI,
56  const ObjectFile &BaseObjT,
58  bool TargetIsLocalThumbFunc) {
59  const MachOObjectFile &Obj =
60  static_cast<const MachOObjectFile&>(BaseObjT);
62  Obj.getRelocation(RelI->getRawDataRefImpl());
63 
64  SectionEntry &Section = Sections[SectionID];
65  uint32_t RelocType = Obj.getAnyRelocationType(RE);
66  bool IsPCRel = Obj.getAnyRelocationPCRel(RE);
67  unsigned Size = Obj.getAnyRelocationLength(RE);
68  uint64_t Offset = RelI->getOffset();
69  uint8_t *LocalAddress = Section.getAddressWithOffset(Offset);
70  unsigned NumBytes = 1 << Size;
71  int64_t Addend = readBytesUnaligned(LocalAddress, NumBytes);
72 
73  unsigned SymbolBaseAddr = Obj.getScatteredRelocationValue(RE);
74  section_iterator TargetSI = getSectionByAddress(Obj, SymbolBaseAddr);
75  assert(TargetSI != Obj.section_end() && "Can't find section for symbol");
76  uint64_t SectionBaseAddr = TargetSI->getAddress();
77  SectionRef TargetSection = *TargetSI;
78  bool IsCode = TargetSection.isText();
79  uint32_t TargetSectionID = ~0U;
80  if (auto TargetSectionIDOrErr =
81  findOrEmitSection(Obj, TargetSection, IsCode, ObjSectionToID))
82  TargetSectionID = *TargetSectionIDOrErr;
83  else
84  return TargetSectionIDOrErr.takeError();
85 
86  Addend -= SectionBaseAddr;
87  RelocationEntry R(SectionID, Offset, RelocType, Addend, IsPCRel, Size);
88  R.IsTargetThumbFunc = TargetIsLocalThumbFunc;
89 
90  addRelocationForSection(R, TargetSectionID);
91 
92  return ++RelI;
93 }
94 
95 
98  const ObjectFile &BaseTObj, const relocation_iterator &RI,
99  const RelocationEntry &RE, ObjSectionToIDMap &ObjSectionToID) {
100 
101  const MachOObjectFile &Obj =
102  static_cast<const MachOObjectFile &>(BaseTObj);
104  Obj.getRelocation(RI->getRawDataRefImpl());
106 
107  bool IsExternal = Obj.getPlainRelocationExternal(RelInfo);
108  if (IsExternal) {
109  symbol_iterator Symbol = RI->getSymbol();
110  StringRef TargetName;
111  if (auto TargetNameOrErr = Symbol->getName())
112  TargetName = *TargetNameOrErr;
113  else
114  return TargetNameOrErr.takeError();
116  GlobalSymbolTable.find(TargetName.data());
117  if (SI != GlobalSymbolTable.end()) {
118  const auto &SymInfo = SI->second;
119  Value.SectionID = SymInfo.getSectionID();
120  Value.Offset = SymInfo.getOffset() + RE.Addend;
121  } else {
122  Value.SymbolName = TargetName.data();
123  Value.Offset = RE.Addend;
124  }
125  } else {
126  SectionRef Sec = Obj.getAnyRelocationSection(RelInfo);
127  bool IsCode = Sec.isText();
128  if (auto SectionIDOrErr = findOrEmitSection(Obj, Sec, IsCode,
129  ObjSectionToID))
130  Value.SectionID = *SectionIDOrErr;
131  else
132  return SectionIDOrErr.takeError();
133  uint64_t Addr = Sec.getAddress();
134  Value.Offset = RE.Addend - Addr;
135  }
136 
137  return Value;
138 }
139 
141  const relocation_iterator &RI,
142  unsigned OffsetToNextPC) {
143  auto &O = *cast<MachOObjectFile>(RI->getObject());
144  section_iterator SecI = O.getRelocationRelocatedSection(RI);
145  Value.Offset += RI->getOffset() + OffsetToNextPC + SecI->getAddress();
146 }
147 
149  uint64_t Value) const {
150  const SectionEntry &Section = Sections[RE.SectionID];
151  uint8_t *LocalAddress = Section.getAddress() + RE.Offset;
152  uint64_t FinalAddress = Section.getLoadAddress() + RE.Offset;
153 
154  dbgs() << "resolveRelocation Section: " << RE.SectionID
155  << " LocalAddress: " << format("%p", LocalAddress)
156  << " FinalAddress: " << format("0x%016" PRIx64, FinalAddress)
157  << " Value: " << format("0x%016" PRIx64, Value) << " Addend: " << RE.Addend
158  << " isPCRel: " << RE.IsPCRel << " MachoType: " << RE.RelType
159  << " Size: " << (1 << RE.Size) << "\n";
160 }
161 
164  uint64_t Addr) {
166  section_iterator SE = Obj.section_end();
167 
168  for (; SI != SE; ++SI) {
169  uint64_t SAddr = SI->getAddress();
170  uint64_t SSize = SI->getSize();
171  if ((Addr >= SAddr) && (Addr < SAddr + SSize))
172  return SI;
173  }
174 
175  return SE;
176 }
177 
178 
179 // Populate __pointers section.
181  const MachOObjectFile &Obj,
182  const SectionRef &PTSection,
183  unsigned PTSectionID) {
184  assert(!Obj.is64Bit() &&
185  "Pointer table section not supported in 64-bit MachO.");
186 
188  MachO::section Sec32 = Obj.getSection(PTSection.getRawDataRefImpl());
189  uint32_t PTSectionSize = Sec32.size;
190  unsigned FirstIndirectSymbol = Sec32.reserved1;
191  const unsigned PTEntrySize = 4;
192  unsigned NumPTEntries = PTSectionSize / PTEntrySize;
193  unsigned PTEntryOffset = 0;
194 
195  assert((PTSectionSize % PTEntrySize) == 0 &&
196  "Pointers section does not contain a whole number of stubs?");
197 
198  LLVM_DEBUG(dbgs() << "Populating pointer table section "
199  << Sections[PTSectionID].getName() << ", Section ID "
200  << PTSectionID << ", " << NumPTEntries << " entries, "
201  << PTEntrySize << " bytes each:\n");
202 
203  for (unsigned i = 0; i < NumPTEntries; ++i) {
204  unsigned SymbolIndex =
205  Obj.getIndirectSymbolTableEntry(DySymTabCmd, FirstIndirectSymbol + i);
206  symbol_iterator SI = Obj.getSymbolByIndex(SymbolIndex);
207  StringRef IndirectSymbolName;
208  if (auto IndirectSymbolNameOrErr = SI->getName())
209  IndirectSymbolName = *IndirectSymbolNameOrErr;
210  else
211  return IndirectSymbolNameOrErr.takeError();
212  LLVM_DEBUG(dbgs() << " " << IndirectSymbolName << ": index " << SymbolIndex
213  << ", PT offset: " << PTEntryOffset << "\n");
214  RelocationEntry RE(PTSectionID, PTEntryOffset,
215  MachO::GENERIC_RELOC_VANILLA, 0, false, 2);
216  addRelocationForSymbol(RE, IndirectSymbolName);
217  PTEntryOffset += PTEntrySize;
218  }
219  return Error::success();
220 }
221 
223  return Obj.isMachO();
224 }
225 
226 template <typename Impl>
227 Error
229  ObjSectionToIDMap &SectionMap) {
230  unsigned EHFrameSID = RTDYLD_INVALID_SECTION_ID;
231  unsigned TextSID = RTDYLD_INVALID_SECTION_ID;
232  unsigned ExceptTabSID = RTDYLD_INVALID_SECTION_ID;
233 
234  for (const auto &Section : Obj.sections()) {
235  StringRef Name;
236  if (Expected<StringRef> NameOrErr = Section.getName())
237  Name = *NameOrErr;
238  else
239  consumeError(NameOrErr.takeError());
240 
241  // Force emission of the __text, __eh_frame, and __gcc_except_tab sections
242  // if they're present. Otherwise call down to the impl to handle other
243  // sections that have already been emitted.
244  if (Name == "__text") {
245  if (auto TextSIDOrErr = findOrEmitSection(Obj, Section, true, SectionMap))
246  TextSID = *TextSIDOrErr;
247  else
248  return TextSIDOrErr.takeError();
249  } else if (Name == "__eh_frame") {
250  if (auto EHFrameSIDOrErr = findOrEmitSection(Obj, Section, false,
251  SectionMap))
252  EHFrameSID = *EHFrameSIDOrErr;
253  else
254  return EHFrameSIDOrErr.takeError();
255  } else if (Name == "__gcc_except_tab") {
256  if (auto ExceptTabSIDOrErr = findOrEmitSection(Obj, Section, true,
257  SectionMap))
258  ExceptTabSID = *ExceptTabSIDOrErr;
259  else
260  return ExceptTabSIDOrErr.takeError();
261  } else {
262  auto I = SectionMap.find(Section);
263  if (I != SectionMap.end())
264  if (auto Err = impl().finalizeSection(Obj, I->second, Section))
265  return Err;
266  }
267  }
268  UnregisteredEHFrameSections.push_back(
269  EHFrameRelatedSections(EHFrameSID, TextSID, ExceptTabSID));
270 
271  return Error::success();
272 }
273 
274 template <typename Impl>
275 unsigned char *RuntimeDyldMachOCRTPBase<Impl>::processFDE(uint8_t *P,
276  int64_t DeltaForText,
277  int64_t DeltaForEH) {
278  typedef typename Impl::TargetPtrT TargetPtrT;
279 
280  LLVM_DEBUG(dbgs() << "Processing FDE: Delta for text: " << DeltaForText
281  << ", Delta for EH: " << DeltaForEH << "\n");
282  uint32_t Length = readBytesUnaligned(P, 4);
283  P += 4;
284  uint8_t *Ret = P + Length;
285  uint32_t Offset = readBytesUnaligned(P, 4);
286  if (Offset == 0) // is a CIE
287  return Ret;
288 
289  P += 4;
290  TargetPtrT FDELocation = readBytesUnaligned(P, sizeof(TargetPtrT));
291  TargetPtrT NewLocation = FDELocation - DeltaForText;
292  writeBytesUnaligned(NewLocation, P, sizeof(TargetPtrT));
293 
294  P += sizeof(TargetPtrT);
295 
296  // Skip the FDE address range
297  P += sizeof(TargetPtrT);
298 
299  uint8_t Augmentationsize = *P;
300  P += 1;
301  if (Augmentationsize != 0) {
302  TargetPtrT LSDA = readBytesUnaligned(P, sizeof(TargetPtrT));
303  TargetPtrT NewLSDA = LSDA - DeltaForEH;
304  writeBytesUnaligned(NewLSDA, P, sizeof(TargetPtrT));
305  }
306 
307  return Ret;
308 }
309 
310 static int64_t computeDelta(SectionEntry *A, SectionEntry *B) {
311  int64_t ObjDistance = static_cast<int64_t>(A->getObjAddress()) -
312  static_cast<int64_t>(B->getObjAddress());
313  int64_t MemDistance = A->getLoadAddress() - B->getLoadAddress();
314  return ObjDistance - MemDistance;
315 }
316 
317 template <typename Impl>
319 
320  for (int i = 0, e = UnregisteredEHFrameSections.size(); i != e; ++i) {
321  EHFrameRelatedSections &SectionInfo = UnregisteredEHFrameSections[i];
322  if (SectionInfo.EHFrameSID == RTDYLD_INVALID_SECTION_ID ||
323  SectionInfo.TextSID == RTDYLD_INVALID_SECTION_ID)
324  continue;
325  SectionEntry *Text = &Sections[SectionInfo.TextSID];
326  SectionEntry *EHFrame = &Sections[SectionInfo.EHFrameSID];
327  SectionEntry *ExceptTab = nullptr;
328  if (SectionInfo.ExceptTabSID != RTDYLD_INVALID_SECTION_ID)
329  ExceptTab = &Sections[SectionInfo.ExceptTabSID];
330 
331  int64_t DeltaForText = computeDelta(Text, EHFrame);
332  int64_t DeltaForEH = 0;
333  if (ExceptTab)
334  DeltaForEH = computeDelta(ExceptTab, EHFrame);
335 
336  uint8_t *P = EHFrame->getAddress();
337  uint8_t *End = P + EHFrame->getSize();
338  while (P != End) {
339  P = processFDE(P, DeltaForText, DeltaForEH);
340  }
341 
342  MemMgr.registerEHFrames(EHFrame->getAddress(), EHFrame->getLoadAddress(),
343  EHFrame->getSize());
344  }
345  UnregisteredEHFrameSections.clear();
346 }
347 
348 std::unique_ptr<RuntimeDyldMachO>
352  switch (Arch) {
353  default:
354  llvm_unreachable("Unsupported target for RuntimeDyldMachO.");
355  break;
356  case Triple::arm:
357  return std::make_unique<RuntimeDyldMachOARM>(MemMgr, Resolver);
358  case Triple::aarch64:
359  return std::make_unique<RuntimeDyldMachOAArch64>(MemMgr, Resolver);
360  case Triple::aarch64_32:
361  return std::make_unique<RuntimeDyldMachOAArch64>(MemMgr, Resolver);
362  case Triple::x86:
363  return std::make_unique<RuntimeDyldMachOI386>(MemMgr, Resolver);
364  case Triple::x86_64:
365  return std::make_unique<RuntimeDyldMachOX86_64>(MemMgr, Resolver);
366  }
367 }
368 
369 std::unique_ptr<RuntimeDyld::LoadedObjectInfo>
371  if (auto ObjSectionToIDOrErr = loadObjectImpl(O))
372  return std::make_unique<LoadedMachOObjectInfo>(*this,
373  *ObjSectionToIDOrErr);
374  else {
375  HasError = true;
376  raw_string_ostream ErrStream(ErrorStr);
377  logAllUnhandledErrors(ObjSectionToIDOrErr.takeError(), ErrStream);
378  return nullptr;
379  }
380 }
381 
382 } // end namespace llvm
llvm::Check::Size
@ Size
Definition: FileCheck.h:73
i
i
Definition: README.txt:29
llvm::object::MachOObjectFile::getPlainRelocationExternal
bool getPlainRelocationExternal(const MachO::any_relocation_info &RE) const
Definition: MachOObjectFile.cpp:4205
llvm::MachO::section
Definition: MachO.h:563
llvm::RuntimeDyldMachO::dumpRelocationToResolve
void dumpRelocationToResolve(const RelocationEntry &RE, uint64_t Value) const
Dump information about the relocation entry (RE) and resolved value.
Definition: RuntimeDyldMachO.cpp:148
getName
static StringRef getName(Value *V)
Definition: ProvenanceAnalysisEvaluator.cpp:42
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::SectionEntry::getAddress
uint8_t * getAddress() const
Definition: RuntimeDyldImpl.h:86
llvm::MachO::any_relocation_info
Definition: MachO.h:975
llvm::computeDelta
static int64_t computeDelta(SectionEntry *A, SectionEntry *B)
Definition: RuntimeDyldMachO.cpp:310
StringRef.h
P
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
Definition: README-SSE.txt:411
llvm::Triple::x86
@ x86
Definition: Triple.h:83
llvm::raw_string_ostream
A raw_ostream that writes to an std::string.
Definition: raw_ostream.h:625
llvm::RuntimeDyldMachO::EHFrameRelatedSections::EHFrameSID
SID EHFrameSID
Definition: RuntimeDyldMachO.h:41
llvm::RelocationEntry::IsPCRel
bool IsPCRel
True if this is a PCRel relocation (MachO specific).
Definition: RuntimeDyldImpl.h:145
llvm::LoadedObjectInfoHelper
Definition: DIContext.h:296
RuntimeDyldMachO.h
llvm::object::SectionRef::getRawDataRefImpl
DataRefImpl getRawDataRefImpl() const
Definition: ObjectFile.h:526
llvm::Error::success
static ErrorSuccess success()
Create a success value.
Definition: Error.h:331
llvm::RuntimeDyldMachO::create
static std::unique_ptr< RuntimeDyldMachO > create(Triple::ArchType Arch, RuntimeDyld::MemoryManager &MemMgr, JITSymbolResolver &Resolver)
Create a RuntimeDyldMachO instance for the given target architecture.
Definition: RuntimeDyldMachO.cpp:349
llvm::Triple::x86_64
@ x86_64
Definition: Triple.h:84
llvm::object::MachOObjectFile::getAnyRelocationPCRel
unsigned getAnyRelocationPCRel(const MachO::any_relocation_info &RE) const
Definition: MachOObjectFile.cpp:4234
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:81
impl
place backedge safepoints impl
Definition: PlaceSafepoints.cpp:612
llvm::MachO::section::size
uint32_t size
Definition: MachO.h:567
llvm::MipsISD::Ret
@ Ret
Definition: MipsISelLowering.h:116
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:42
llvm::RuntimeDyldImpl
Definition: RuntimeDyldImpl.h:238
STLExtras.h
llvm::RuntimeDyldMachO::EHFrameRelatedSections::TextSID
SID TextSID
Definition: RuntimeDyldMachO.h:42
llvm::Triple::aarch64_32
@ aarch64_32
Definition: Triple.h:54
llvm::object::MachOObjectFile::getSymbolByIndex
symbol_iterator getSymbolByIndex(unsigned Index) const
Definition: MachOObjectFile.cpp:2522
llvm::consumeError
void consumeError(Error Err)
Consume a Error without doing anything.
Definition: Error.h:1035
LLVM_DEBUG
#define LLVM_DEBUG(X)
Definition: Debug.h:101
llvm::object::MachOObjectFile::getSection
Expected< SectionRef > getSection(unsigned SectionIndex) const
Definition: MachOObjectFile.cpp:1992
llvm::RelocationEntry::SectionID
unsigned SectionID
SectionID - the section this relocation points to.
Definition: RuntimeDyldImpl.h:120
llvm::dbgs
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:163
llvm::object::MachOObjectFile::getIndirectSymbolTableEntry
uint32_t getIndirectSymbolTableEntry(const MachO::dysymtab_command &DLC, unsigned Index) const
Definition: MachOObjectFile.cpp:4465
llvm::ARMBuildAttrs::Section
@ Section
Legacy Tags.
Definition: ARMBuildAttributes.h:78
llvm::Resolver
Interface for looking up the initializer for a variable name, used by Init::resolveReferences.
Definition: Record.h:2000
llvm::RuntimeDyldMachO::makeValueAddendPCRel
void makeValueAddendPCRel(RelocationValueRef &Value, const relocation_iterator &RI, unsigned OffsetToNextPC)
Make the RelocationValueRef addend PC-relative.
Definition: RuntimeDyldMachO.cpp:140
llvm::RelocationEntry::Offset
uint64_t Offset
Offset - offset into the section.
Definition: RuntimeDyldImpl.h:123
llvm::object
Definition: ObjectFileTransformer.h:18
llvm::object::MachOObjectFile::getDysymtabLoadCommand
MachO::dysymtab_command getDysymtabLoadCommand() const
Definition: MachOObjectFile.cpp:4494
llvm::Triple::ArchType
ArchType
Definition: Triple.h:47
llvm::RuntimeDyldMachOCRTPBase
RuntimeDyldMachOTarget - Templated base class for generic MachO linker algorithms and data structures...
Definition: RuntimeDyldMachO.h:145
llvm::StringMapConstIterator
Definition: StringMap.h:24
llvm::RuntimeDyldMachOCRTPBase::finalizeLoad
Error finalizeLoad(const ObjectFile &Obj, ObjSectionToIDMap &SectionMap) override
Definition: RuntimeDyldMachO.cpp:228
llvm::object::MachOObjectFile::getRelocation
MachO::any_relocation_info getRelocation(DataRefImpl Rel) const
Definition: MachOObjectFile.cpp:4424
llvm::RuntimeDyldMachOCRTPBase::registerEHFrames
void registerEHFrames() override
Definition: RuntimeDyldMachO.cpp:318
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
llvm::MachO::GENERIC_RELOC_VANILLA
@ GENERIC_RELOC_VANILLA
Definition: MachO.h:403
llvm::RuntimeDyldMachO::populateIndirectSymbolPointersSection
Error populateIndirectSymbolPointersSection(const MachOObjectFile &Obj, const SectionRef &PTSection, unsigned PTSectionID)
Definition: RuntimeDyldMachO.cpp:180
RuntimeDyldMachOI386.h
llvm::RelocationEntry::Addend
int64_t Addend
Addend - the relocation addend encoded in the instruction itself.
Definition: RuntimeDyldImpl.h:130
llvm::object::SectionRef
This is a value type class that represents a single section in the list of sections in the object fil...
Definition: ObjectFile.h:80
llvm::RelocationEntry
RelocationEntry - used to represent relocations internally in the dynamic linker.
Definition: RuntimeDyldImpl.h:117
llvm::object::MachOObjectFile
Definition: MachO.h:262
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:197
llvm::object::MachOObjectFile::is64Bit
bool is64Bit() const
Definition: MachOObjectFile.cpp:4635
uint64_t
llvm::object::symbol_iterator
Definition: ObjectFile.h:207
llvm::RelocationEntry::Size
unsigned Size
The size of this relocation (MachO specific).
Definition: RuntimeDyldImpl.h:148
Addr
uint64_t Addr
Definition: ELFObjHandler.cpp:80
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::numbers::e
constexpr double e
Definition: MathExtras.h:57
llvm::RuntimeDyldMachO::EHFrameRelatedSections
Definition: RuntimeDyldMachO.h:33
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::MachO::section::reserved1
uint32_t reserved1
Definition: MachO.h:573
llvm::SectionEntry
SectionEntry - represents a section emitted into memory by the dynamic linker.
Definition: RuntimeDyldImpl.h:45
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::object::MachOObjectFile::section_end
section_iterator section_end() const override
Definition: MachOObjectFile.cpp:2551
SI
StandardInstrumentations SI(Debug, VerifyEach)
llvm::object::content_iterator
Definition: SymbolicFile.h:67
llvm::RuntimeDyldMachO::getRelocationValueRef
Expected< RelocationValueRef > getRelocationValueRef(const ObjectFile &BaseTObj, const relocation_iterator &RI, const RelocationEntry &RE, ObjSectionToIDMap &ObjSectionToID)
Construct a RelocationValueRef representing the relocation target.
Definition: RuntimeDyldMachO.cpp:97
llvm::Triple::arm
@ arm
Definition: Triple.h:50
llvm::object::MachOObjectFile::getAnyRelocationSection
SectionRef getAnyRelocationSection(const MachO::any_relocation_info &RE) const
Definition: MachOObjectFile.cpp:4257
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::object::ObjectFile
This class is the base class for all object file types.
Definition: ObjectFile.h:228
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:136
uint32_t
RuntimeDyldMachOAArch64.h
llvm::RuntimeDyldMachO::processScatteredVANILLA
Expected< relocation_iterator > processScatteredVANILLA(unsigned SectionID, relocation_iterator RelI, const ObjectFile &BaseObjT, RuntimeDyldMachO::ObjSectionToIDMap &ObjSectionToID, bool TargetIsLocalThumbFunc=false)
Process a scattered vanilla relocation.
Definition: RuntimeDyldMachO.cpp:54
llvm::format
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
Definition: Format.h:124
llvm::SectionEntry::getSize
size_t getSize() const
Definition: RuntimeDyldImpl.h:94
llvm::RuntimeDyldMachO::EHFrameRelatedSections::ExceptTabSID
SID ExceptTabSID
Definition: RuntimeDyldMachO.h:43
llvm::object::SectionRef::getAddress
uint64_t getAddress() const
Definition: ObjectFile.h:450
RuntimeDyldMachOX86_64.h
llvm::object::MachOObjectFile::section_begin
section_iterator section_begin() const override
Definition: MachOObjectFile.cpp:2546
llvm::logAllUnhandledErrors
void logAllUnhandledErrors(Error E, raw_ostream &OS, Twine ErrorBanner={})
Log all errors (if any) in E to OS.
Definition: Error.cpp:61
llvm::MachO::dysymtab_command
Definition: MachO.h:702
llvm::object::MachOObjectFile::getAnyRelocationType
unsigned getAnyRelocationType(const MachO::any_relocation_info &RE) const
Definition: MachOObjectFile.cpp:4249
llvm::object::SectionRef::isText
bool isText() const
Whether this section contains instructions.
Definition: ObjectFile.h:478
llvm::JITSymbolResolver
Symbol resolution interface.
Definition: JITSymbol.h:371
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
llvm::RuntimeDyldMachO::loadObject
std::unique_ptr< RuntimeDyld::LoadedObjectInfo > loadObject(const object::ObjectFile &O) override
Definition: RuntimeDyldMachO.cpp:370
llvm::object::OwningBinary
Definition: RuntimeDyld.h:36
RTDYLD_INVALID_SECTION_ID
#define RTDYLD_INVALID_SECTION_ID
Definition: RuntimeDyldImpl.h:257
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
llvm::TargetStackID::Value
Value
Definition: TargetFrameLowering.h:27
llvm::SectionEntry::getLoadAddress
uint64_t getLoadAddress() const
Definition: RuntimeDyldImpl.h:96
llvm::object::Binary::isMachO
bool isMachO() const
Definition: Binary.h:124
llvm::ARMBuildAttrs::Symbol
@ Symbol
Definition: ARMBuildAttributes.h:79
llvm::object::MachOObjectFile::getScatteredRelocationValue
uint32_t getScatteredRelocationValue(const MachO::any_relocation_info &RE) const
Definition: MachOObjectFile.cpp:4217
RuntimeDyldMachOARM.h
llvm::RuntimeDyldMachO::isCompatibleFile
bool isCompatibleFile(const object::ObjectFile &Obj) const override
Definition: RuntimeDyldMachO.cpp:222
llvm::object::ObjectFile::sections
section_iterator_range sections() const
Definition: ObjectFile.h:322
SymInfo
SymInfo contains information about symbol: it's address and section index which is -1LL for absolute ...
Definition: DWARFContext.cpp:1428
llvm::StringRef::data
const LLVM_NODISCARD char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
Definition: StringRef.h:149
llvm::object::MachOObjectFile::getAnyRelocationLength
unsigned getAnyRelocationLength(const MachO::any_relocation_info &RE) const
Definition: MachOObjectFile.cpp:4241
llvm::RuntimeDyldMachO::getSectionByAddress
static section_iterator getSectionByAddress(const MachOObjectFile &Obj, uint64_t Addr)
Definition: RuntimeDyldMachO.cpp:163
llvm::RelocationValueRef
Definition: RuntimeDyldImpl.h:190
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
llvm::RelocationEntry::RelType
uint32_t RelType
RelType - relocation type.
Definition: RuntimeDyldImpl.h:126
llvm::Triple::aarch64
@ aarch64
Definition: Triple.h:52
llvm::RuntimeDyldImpl::ObjSectionToIDMap
std::map< SectionRef, unsigned > ObjSectionToIDMap
Definition: RuntimeDyldImpl.h:261
llvm::RuntimeDyld::MemoryManager
Memory Management.
Definition: RuntimeDyld.h:92
llvm::RuntimeDyldMachO::memcpyAddend
int64_t memcpyAddend(const RelocationEntry &RE) const
This convenience method uses memcpy to extract a contiguous addend (the addend size and offset are ta...
Definition: RuntimeDyldMachO.cpp:46