LLVM  14.0.0git
ELFNixPlatform.cpp
Go to the documentation of this file.
1 //===------ ELFNixPlatform.cpp - Utilities for executing MachO in Orc -----===//
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 
10 
11 #include "llvm/BinaryFormat/ELF.h"
17 #include "llvm/Support/Debug.h"
18 
19 #define DEBUG_TYPE "orc"
20 
21 using namespace llvm;
22 using namespace llvm::orc;
23 using namespace llvm::orc::shared;
24 
25 namespace {
26 
27 class DSOHandleMaterializationUnit : public MaterializationUnit {
28 public:
29  DSOHandleMaterializationUnit(ELFNixPlatform &ENP,
30  const SymbolStringPtr &DSOHandleSymbol)
31  : MaterializationUnit(createDSOHandleSectionSymbols(ENP, DSOHandleSymbol),
32  DSOHandleSymbol),
33  ENP(ENP) {}
34 
35  StringRef getName() const override { return "DSOHandleMU"; }
36 
37  void materialize(std::unique_ptr<MaterializationResponsibility> R) override {
38  unsigned PointerSize;
40  jitlink::Edge::Kind EdgeKind;
41  const auto &TT =
43 
44  switch (TT.getArch()) {
45  case Triple::x86_64:
46  PointerSize = 8;
48  EdgeKind = jitlink::x86_64::Pointer64;
49  break;
50  default:
51  llvm_unreachable("Unrecognized architecture");
52  }
53 
54  // void *__dso_handle = &__dso_handle;
55  auto G = std::make_unique<jitlink::LinkGraph>(
56  "<DSOHandleMU>", TT, PointerSize, Endianness,
58  auto &DSOHandleSection =
59  G->createSection(".data.__dso_handle", jitlink::MemProt::Read);
60  auto &DSOHandleBlock = G->createContentBlock(
61  DSOHandleSection, getDSOHandleContent(PointerSize), 0, 8, 0);
62  auto &DSOHandleSymbol = G->addDefinedSymbol(
63  DSOHandleBlock, 0, *R->getInitializerSymbol(), DSOHandleBlock.getSize(),
65  DSOHandleBlock.addEdge(EdgeKind, 0, DSOHandleSymbol, 0);
66 
68  }
69 
70  void discard(const JITDylib &JD, const SymbolStringPtr &Sym) override {}
71 
72 private:
73  static SymbolFlagsMap
74  createDSOHandleSectionSymbols(ELFNixPlatform &ENP,
75  const SymbolStringPtr &DSOHandleSymbol) {
77  SymbolFlags[DSOHandleSymbol] = JITSymbolFlags::Exported;
78  return SymbolFlags;
79  }
80 
81  ArrayRef<char> getDSOHandleContent(size_t PointerSize) {
82  static const char Content[8] = {0};
83  assert(PointerSize <= sizeof Content);
84  return {Content, PointerSize};
85  }
86 
87  ELFNixPlatform &ENP;
88 };
89 
90 StringRef EHFrameSectionName = ".eh_frame";
91 StringRef InitArrayFuncSectionName = ".init_array";
92 
93 StringRef ThreadBSSSectionName = ".tbss";
94 StringRef ThreadDataSectionName = ".tdata";
95 
96 StringRef InitSectionNames[] = {InitArrayFuncSectionName};
97 
98 } // end anonymous namespace
99 
100 namespace llvm {
101 namespace orc {
102 
105  ObjectLinkingLayer &ObjLinkingLayer,
106  JITDylib &PlatformJD, const char *OrcRuntimePath,
107  Optional<SymbolAliasMap> RuntimeAliases) {
108 
109  auto &EPC = ES.getExecutorProcessControl();
110 
111  // If the target is not supported then bail out immediately.
112  if (!supportedTarget(EPC.getTargetTriple()))
113  return make_error<StringError>("Unsupported ELFNixPlatform triple: " +
114  EPC.getTargetTriple().str(),
116 
117  // Create default aliases if the caller didn't supply any.
118  if (!RuntimeAliases)
119  RuntimeAliases = standardPlatformAliases(ES);
120 
121  // Define the aliases.
122  if (auto Err = PlatformJD.define(symbolAliases(std::move(*RuntimeAliases))))
123  return std::move(Err);
124 
125  // Add JIT-dispatch function support symbols.
126  if (auto Err = PlatformJD.define(absoluteSymbols(
127  {{ES.intern("__orc_rt_jit_dispatch"),
128  {EPC.getJITDispatchInfo().JITDispatchFunction.getValue(),
130  {ES.intern("__orc_rt_jit_dispatch_ctx"),
131  {EPC.getJITDispatchInfo().JITDispatchContext.getValue(),
133  return std::move(Err);
134 
135  // Create a generator for the ORC runtime archive.
136  auto OrcRuntimeArchiveGenerator = StaticLibraryDefinitionGenerator::Load(
137  ObjLinkingLayer, OrcRuntimePath, EPC.getTargetTriple());
138  if (!OrcRuntimeArchiveGenerator)
139  return OrcRuntimeArchiveGenerator.takeError();
140 
141  // Create the instance.
142  Error Err = Error::success();
143  auto P = std::unique_ptr<ELFNixPlatform>(
144  new ELFNixPlatform(ES, ObjLinkingLayer, PlatformJD,
145  std::move(*OrcRuntimeArchiveGenerator), Err));
146  if (Err)
147  return std::move(Err);
148  return std::move(P);
149 }
150 
152  return JD.define(
153  std::make_unique<DSOHandleMaterializationUnit>(*this, DSOHandleSymbol));
154 }
155 
157  const MaterializationUnit &MU) {
158  auto &JD = RT.getJITDylib();
159  const auto &InitSym = MU.getInitializerSymbol();
160  if (!InitSym)
161  return Error::success();
162 
163  RegisteredInitSymbols[&JD].add(InitSym,
165  LLVM_DEBUG({
166  dbgs() << "ELFNixPlatform: Registered init symbol " << *InitSym
167  << " for MU " << MU.getName() << "\n";
168  });
169  return Error::success();
170 }
171 
173  llvm_unreachable("Not supported yet");
174 }
175 
176 static void addAliases(ExecutionSession &ES, SymbolAliasMap &Aliases,
177  ArrayRef<std::pair<const char *, const char *>> AL) {
178  for (auto &KV : AL) {
179  auto AliasName = ES.intern(KV.first);
180  assert(!Aliases.count(AliasName) && "Duplicate symbol name in alias map");
181  Aliases[std::move(AliasName)] = {ES.intern(KV.second),
183  }
184 }
185 
187  SymbolAliasMap Aliases;
188  addAliases(ES, Aliases, requiredCXXAliases());
189  addAliases(ES, Aliases, standardRuntimeUtilityAliases());
190  return Aliases;
191 }
192 
195  static const std::pair<const char *, const char *> RequiredCXXAliases[] = {
196  {"__cxa_atexit", "__orc_rt_elfnix_cxa_atexit"},
197  {"atexit", "__orc_rt_elfnix_atexit"}};
198 
199  return ArrayRef<std::pair<const char *, const char *>>(RequiredCXXAliases);
200 }
201 
204  static const std::pair<const char *, const char *>
205  StandardRuntimeUtilityAliases[] = {
206  {"__orc_rt_run_program", "__orc_rt_elfnix_run_program"},
207  {"__orc_rt_log_error", "__orc_rt_log_error_to_stderr"}};
208 
210  StandardRuntimeUtilityAliases);
211 }
212 
214  for (auto &Name : InitSectionNames) {
215  if (Name.equals(SecName))
216  return true;
217  }
218  return false;
219 }
220 
221 bool ELFNixPlatform::supportedTarget(const Triple &TT) {
222  switch (TT.getArch()) {
223  case Triple::x86_64:
224  return true;
225  default:
226  return false;
227  }
228 }
229 
230 ELFNixPlatform::ELFNixPlatform(
231  ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer,
232  JITDylib &PlatformJD,
233  std::unique_ptr<DefinitionGenerator> OrcRuntimeGenerator, Error &Err)
234  : ES(ES), ObjLinkingLayer(ObjLinkingLayer),
235  DSOHandleSymbol(ES.intern("__dso_handle")) {
236  ErrorAsOutParameter _(&Err);
237 
238  ObjLinkingLayer.addPlugin(std::make_unique<ELFNixPlatformPlugin>(*this));
239 
240  PlatformJD.addGenerator(std::move(OrcRuntimeGenerator));
241 
242  // PlatformJD hasn't been 'set-up' by the platform yet (since we're creating
243  // the platform now), so set it up.
244  if (auto E2 = setupJITDylib(PlatformJD)) {
245  Err = std::move(E2);
246  return;
247  }
248 
249  RegisteredInitSymbols[&PlatformJD].add(
251 
252  // Associate wrapper function tags with JIT-side function implementations.
253  if (auto E2 = associateRuntimeSupportFunctions(PlatformJD)) {
254  Err = std::move(E2);
255  return;
256  }
257 
258  // Lookup addresses of runtime functions callable by the platform,
259  // call the platform bootstrap function to initialize the platform-state
260  // object in the executor.
261  if (auto E2 = bootstrapELFNixRuntime(PlatformJD)) {
262  Err = std::move(E2);
263  return;
264  }
265 }
266 
267 Error ELFNixPlatform::associateRuntimeSupportFunctions(JITDylib &PlatformJD) {
269 
270  using GetInitializersSPSSig =
272  WFs[ES.intern("__orc_rt_elfnix_get_initializers_tag")] =
273  ES.wrapAsyncWithSPS<GetInitializersSPSSig>(
274  this, &ELFNixPlatform::rt_getInitializers);
275 
276  using GetDeinitializersSPSSig =
278  WFs[ES.intern("__orc_rt_elfnix_get_deinitializers_tag")] =
279  ES.wrapAsyncWithSPS<GetDeinitializersSPSSig>(
280  this, &ELFNixPlatform::rt_getDeinitializers);
281 
282  using LookupSymbolSPSSig =
284  WFs[ES.intern("__orc_rt_elfnix_symbol_lookup_tag")] =
285  ES.wrapAsyncWithSPS<LookupSymbolSPSSig>(this,
286  &ELFNixPlatform::rt_lookupSymbol);
287 
288  return ES.registerJITDispatchHandlers(PlatformJD, std::move(WFs));
289 }
290 
291 void ELFNixPlatform::getInitializersBuildSequencePhase(
292  SendInitializerSequenceFn SendResult, JITDylib &JD,
293  std::vector<JITDylibSP> DFSLinkOrder) {
295  {
296  std::lock_guard<std::mutex> Lock(PlatformMutex);
297  for (auto &InitJD : reverse(DFSLinkOrder)) {
298  LLVM_DEBUG({
299  dbgs() << "ELFNixPlatform: Appending inits for \"" << InitJD->getName()
300  << "\" to sequence\n";
301  });
302  auto ISItr = InitSeqs.find(InitJD.get());
303  if (ISItr != InitSeqs.end()) {
304  FullInitSeq.emplace_back(std::move(ISItr->second));
305  InitSeqs.erase(ISItr);
306  }
307  }
308  }
309 
310  SendResult(std::move(FullInitSeq));
311 }
312 
313 void ELFNixPlatform::getInitializersLookupPhase(
314  SendInitializerSequenceFn SendResult, JITDylib &JD) {
315 
316  auto DFSLinkOrder = JD.getDFSLinkOrder();
318  ES.runSessionLocked([&]() {
319  for (auto &InitJD : DFSLinkOrder) {
320  auto RISItr = RegisteredInitSymbols.find(InitJD.get());
321  if (RISItr != RegisteredInitSymbols.end()) {
322  NewInitSymbols[InitJD.get()] = std::move(RISItr->second);
323  RegisteredInitSymbols.erase(RISItr);
324  }
325  }
326  });
327 
328  // If there are no further init symbols to look up then move on to the next
329  // phase.
330  if (NewInitSymbols.empty()) {
331  getInitializersBuildSequencePhase(std::move(SendResult), JD,
332  std::move(DFSLinkOrder));
333  return;
334  }
335 
336  // Otherwise issue a lookup and re-run this phase when it completes.
338  [this, SendResult = std::move(SendResult), &JD](Error Err) mutable {
339  if (Err)
340  SendResult(std::move(Err));
341  else
342  getInitializersLookupPhase(std::move(SendResult), JD);
343  },
344  ES, std::move(NewInitSymbols));
345 }
346 
347 void ELFNixPlatform::rt_getInitializers(SendInitializerSequenceFn SendResult,
348  StringRef JDName) {
349  LLVM_DEBUG({
350  dbgs() << "ELFNixPlatform::rt_getInitializers(\"" << JDName << "\")\n";
351  });
352 
353  JITDylib *JD = ES.getJITDylibByName(JDName);
354  if (!JD) {
355  LLVM_DEBUG({
356  dbgs() << " No such JITDylib \"" << JDName << "\". Sending error.\n";
357  });
358  SendResult(make_error<StringError>("No JITDylib named " + JDName,
360  return;
361  }
362 
363  getInitializersLookupPhase(std::move(SendResult), *JD);
364 }
365 
366 void ELFNixPlatform::rt_getDeinitializers(
367  SendDeinitializerSequenceFn SendResult, ExecutorAddr Handle) {
368  LLVM_DEBUG({
369  dbgs() << "ELFNixPlatform::rt_getDeinitializers(\""
370  << formatv("{0:x}", Handle.getValue()) << "\")\n";
371  });
372 
373  JITDylib *JD = nullptr;
374 
375  {
376  std::lock_guard<std::mutex> Lock(PlatformMutex);
377  auto I = HandleAddrToJITDylib.find(Handle.getValue());
378  if (I != HandleAddrToJITDylib.end())
379  JD = I->second;
380  }
381 
382  if (!JD) {
383  LLVM_DEBUG({
384  dbgs() << " No JITDylib for handle "
385  << formatv("{0:x}", Handle.getValue()) << "\n";
386  });
387  SendResult(make_error<StringError>("No JITDylib associated with handle " +
388  formatv("{0:x}", Handle.getValue()),
390  return;
391  }
392 
394 }
395 
396 void ELFNixPlatform::rt_lookupSymbol(SendSymbolAddressFn SendResult,
397  ExecutorAddr Handle,
399  LLVM_DEBUG({
400  dbgs() << "ELFNixPlatform::rt_lookupSymbol(\""
401  << formatv("{0:x}", Handle.getValue()) << "\")\n";
402  });
403 
404  JITDylib *JD = nullptr;
405 
406  {
407  std::lock_guard<std::mutex> Lock(PlatformMutex);
408  auto I = HandleAddrToJITDylib.find(Handle.getValue());
409  if (I != HandleAddrToJITDylib.end())
410  JD = I->second;
411  }
412 
413  if (!JD) {
414  LLVM_DEBUG({
415  dbgs() << " No JITDylib for handle "
416  << formatv("{0:x}", Handle.getValue()) << "\n";
417  });
418  SendResult(make_error<StringError>("No JITDylib associated with handle " +
419  formatv("{0:x}", Handle.getValue()),
421  return;
422  }
423 
424  // Use functor class to work around XL build compiler issue on AIX.
425  class RtLookupNotifyComplete {
426  public:
427  RtLookupNotifyComplete(SendSymbolAddressFn &&SendResult)
428  : SendResult(std::move(SendResult)) {}
429  void operator()(Expected<SymbolMap> Result) {
430  if (Result) {
431  assert(Result->size() == 1 && "Unexpected result map count");
432  SendResult(ExecutorAddr(Result->begin()->second.getAddress()));
433  } else {
434  SendResult(Result.takeError());
435  }
436  }
437 
438  private:
439  SendSymbolAddressFn SendResult;
440  };
441 
442  ES.lookup(
445  RtLookupNotifyComplete(std::move(SendResult)), NoDependenciesToRegister);
446 }
447 
448 Error ELFNixPlatform::bootstrapELFNixRuntime(JITDylib &PlatformJD) {
449 
450  std::pair<const char *, ExecutorAddr *> Symbols[] = {
451  {"__orc_rt_elfnix_platform_bootstrap", &orc_rt_elfnix_platform_bootstrap},
452  {"__orc_rt_elfnix_platform_shutdown", &orc_rt_elfnix_platform_shutdown},
453  {"__orc_rt_elfnix_register_object_sections",
454  &orc_rt_elfnix_register_object_sections},
455  {"__orc_rt_elfnix_create_pthread_key",
456  &orc_rt_elfnix_create_pthread_key}};
457 
458  SymbolLookupSet RuntimeSymbols;
459  std::vector<std::pair<SymbolStringPtr, ExecutorAddr *>> AddrsToRecord;
460  for (const auto &KV : Symbols) {
461  auto Name = ES.intern(KV.first);
462  RuntimeSymbols.add(Name);
463  AddrsToRecord.push_back({std::move(Name), KV.second});
464  }
465 
466  auto RuntimeSymbolAddrs = ES.lookup(
467  {{&PlatformJD, JITDylibLookupFlags::MatchAllSymbols}}, RuntimeSymbols);
468  if (!RuntimeSymbolAddrs)
469  return RuntimeSymbolAddrs.takeError();
470 
471  for (const auto &KV : AddrsToRecord) {
472  auto &Name = KV.first;
473  assert(RuntimeSymbolAddrs->count(Name) && "Missing runtime symbol?");
474  KV.second->setValue((*RuntimeSymbolAddrs)[Name].getAddress());
475  }
476 
477  auto PJDDSOHandle = ES.lookup(
478  {{&PlatformJD, JITDylibLookupFlags::MatchAllSymbols}}, DSOHandleSymbol);
479  if (!PJDDSOHandle)
480  return PJDDSOHandle.takeError();
481 
482  if (auto Err = ES.callSPSWrapper<void(uint64_t)>(
483  orc_rt_elfnix_platform_bootstrap, PJDDSOHandle->getAddress()))
484  return Err;
485 
486  // FIXME: Ordering is fuzzy here. We're probably best off saying
487  // "behavior is undefined if code that uses the runtime is added before
488  // the platform constructor returns", then move all this to the constructor.
489  RuntimeBootstrapped = true;
490  std::vector<ELFPerObjectSectionsToRegister> DeferredPOSRs;
491  {
492  std::lock_guard<std::mutex> Lock(PlatformMutex);
493  DeferredPOSRs = std::move(BootstrapPOSRs);
494  }
495 
496  for (auto &D : DeferredPOSRs)
497  if (auto Err = registerPerObjectSections(D))
498  return Err;
499 
500  return Error::success();
501 }
502 
503 Error ELFNixPlatform::registerInitInfo(
504  JITDylib &JD, ArrayRef<jitlink::Section *> InitSections) {
505 
506  std::unique_lock<std::mutex> Lock(PlatformMutex);
507 
508  ELFNixJITDylibInitializers *InitSeq = nullptr;
509  {
510  auto I = InitSeqs.find(&JD);
511  if (I == InitSeqs.end()) {
512  // If there's no init sequence entry yet then we need to look up the
513  // header symbol to force creation of one.
514  Lock.unlock();
515 
516  auto SearchOrder =
517  JD.withLinkOrderDo([](const JITDylibSearchOrder &SO) { return SO; });
518  if (auto Err = ES.lookup(SearchOrder, DSOHandleSymbol).takeError())
519  return Err;
520 
521  Lock.lock();
522  I = InitSeqs.find(&JD);
523  assert(I != InitSeqs.end() &&
524  "Entry missing after header symbol lookup?");
525  }
526  InitSeq = &I->second;
527  }
528 
529  for (auto *Sec : InitSections) {
530  // FIXME: Avoid copy here.
531  jitlink::SectionRange R(*Sec);
532  InitSeq->InitSections[Sec->getName()].push_back(
533  {ExecutorAddr(R.getStart()), ExecutorAddr(R.getEnd())});
534  }
535 
536  return Error::success();
537 }
538 
539 Error ELFNixPlatform::registerPerObjectSections(
540  const ELFPerObjectSectionsToRegister &POSR) {
541 
542  if (!orc_rt_elfnix_register_object_sections)
543  return make_error<StringError>("Attempting to register per-object "
544  "sections, but runtime support has not "
545  "been loaded yet",
547 
548  Error ErrResult = Error::success();
549  if (auto Err = ES.callSPSWrapper<shared::SPSError(
551  orc_rt_elfnix_register_object_sections, ErrResult, POSR))
552  return Err;
553  return ErrResult;
554 }
555 
556 Expected<uint64_t> ELFNixPlatform::createPThreadKey() {
557  if (!orc_rt_elfnix_create_pthread_key)
558  return make_error<StringError>(
559  "Attempting to create pthread key in target, but runtime support has "
560  "not been loaded yet",
562 
564  if (auto Err = ES.callSPSWrapper<SPSExpected<uint64_t>(void)>(
565  orc_rt_elfnix_create_pthread_key, Result))
566  return std::move(Err);
567  return Result;
568 }
569 
570 void ELFNixPlatform::ELFNixPlatformPlugin::modifyPassConfig(
572  jitlink::PassConfiguration &Config) {
573 
574  // If the initializer symbol is the __dso_handle symbol then just add
575  // the DSO handle support passes.
576  if (MR.getInitializerSymbol() == MP.DSOHandleSymbol) {
577  addDSOHandleSupportPasses(MR, Config);
578  // The DSOHandle materialization unit doesn't require any other
579  // support, so we can bail out early.
580  return;
581  }
582 
583  // If the object contains initializers then add passes to record them.
584  if (MR.getInitializerSymbol())
585  addInitializerSupportPasses(MR, Config);
586 
587  // Add passes for eh-frame and TLV support.
588  addEHAndTLVSupportPasses(MR, Config);
589 }
590 
592 ELFNixPlatform::ELFNixPlatformPlugin::getSyntheticSymbolDependencies(
594  std::lock_guard<std::mutex> Lock(PluginMutex);
595  auto I = InitSymbolDeps.find(&MR);
596  if (I != InitSymbolDeps.end()) {
597  SyntheticSymbolDependenciesMap Result;
598  Result[MR.getInitializerSymbol()] = std::move(I->second);
599  InitSymbolDeps.erase(&MR);
600  return Result;
601  }
602  return SyntheticSymbolDependenciesMap();
603 }
604 
605 void ELFNixPlatform::ELFNixPlatformPlugin::addInitializerSupportPasses(
607 
608  /// Preserve init sections.
609  Config.PrePrunePasses.push_back([this, &MR](jitlink::LinkGraph &G) -> Error {
610  if (auto Err = preserveInitSections(G, MR))
611  return Err;
612  return Error::success();
613  });
614 
615  Config.PostFixupPasses.push_back(
616  [this, &JD = MR.getTargetJITDylib()](jitlink::LinkGraph &G) {
617  return registerInitSections(G, JD);
618  });
619 }
620 
621 void ELFNixPlatform::ELFNixPlatformPlugin::addDSOHandleSupportPasses(
623 
624  Config.PostAllocationPasses.push_back([this, &JD = MR.getTargetJITDylib()](
625  jitlink::LinkGraph &G) -> Error {
626  auto I = llvm::find_if(G.defined_symbols(), [this](jitlink::Symbol *Sym) {
627  return Sym->getName() == *MP.DSOHandleSymbol;
628  });
629  assert(I != G.defined_symbols().end() && "Missing DSO handle symbol");
630  {
631  std::lock_guard<std::mutex> Lock(MP.PlatformMutex);
632  JITTargetAddress HandleAddr = (*I)->getAddress();
633  MP.HandleAddrToJITDylib[HandleAddr] = &JD;
634  assert(!MP.InitSeqs.count(&JD) && "InitSeq entry for JD already exists");
635  MP.InitSeqs.insert(std::make_pair(
636  &JD,
637  ELFNixJITDylibInitializers(JD.getName(), ExecutorAddr(HandleAddr))));
638  }
639  return Error::success();
640  });
641 }
642 
643 void ELFNixPlatform::ELFNixPlatformPlugin::addEHAndTLVSupportPasses(
645 
646  // Insert TLV lowering at the start of the PostPrunePasses, since we want
647  // it to run before GOT/PLT lowering.
648 
649  // TODO: Check that before the fixTLVSectionsAndEdges pass, the GOT/PLT build
650  // pass has done. Because the TLS descriptor need to be allocate in GOT.
651  Config.PostPrunePasses.push_back(
652  [this, &JD = MR.getTargetJITDylib()](jitlink::LinkGraph &G) {
653  return fixTLVSectionsAndEdges(G, JD);
654  });
655 
656  // Add a pass to register the final addresses of the eh-frame and TLV sections
657  // with the runtime.
658  Config.PostFixupPasses.push_back([this](jitlink::LinkGraph &G) -> Error {
660 
661  if (auto *EHFrameSection = G.findSectionByName(EHFrameSectionName)) {
662  jitlink::SectionRange R(*EHFrameSection);
663  if (!R.empty())
664  POSR.EHFrameSection = {ExecutorAddr(R.getStart()),
665  ExecutorAddr(R.getEnd())};
666  }
667 
668  // Get a pointer to the thread data section if there is one. It will be used
669  // below.
670  jitlink::Section *ThreadDataSection =
671  G.findSectionByName(ThreadDataSectionName);
672 
673  // Handle thread BSS section if there is one.
674  if (auto *ThreadBSSSection = G.findSectionByName(ThreadBSSSectionName)) {
675  // If there's already a thread data section in this graph then merge the
676  // thread BSS section content into it, otherwise just treat the thread
677  // BSS section as the thread data section.
678  if (ThreadDataSection)
679  G.mergeSections(*ThreadDataSection, *ThreadBSSSection);
680  else
681  ThreadDataSection = ThreadBSSSection;
682  }
683 
684  // Having merged thread BSS (if present) and thread data (if present),
685  // record the resulting section range.
686  if (ThreadDataSection) {
687  jitlink::SectionRange R(*ThreadDataSection);
688  if (!R.empty())
689  POSR.ThreadDataSection = {ExecutorAddr(R.getStart()),
690  ExecutorAddr(R.getEnd())};
691  }
692 
693  if (POSR.EHFrameSection.Start || POSR.ThreadDataSection.Start) {
694 
695  // If we're still bootstrapping the runtime then just record this
696  // frame for now.
697  if (!MP.RuntimeBootstrapped) {
698  std::lock_guard<std::mutex> Lock(MP.PlatformMutex);
699  MP.BootstrapPOSRs.push_back(POSR);
700  return Error::success();
701  }
702 
703  // Otherwise register it immediately.
704  if (auto Err = MP.registerPerObjectSections(POSR))
705  return Err;
706  }
707 
708  return Error::success();
709  });
710 }
711 
712 Error ELFNixPlatform::ELFNixPlatformPlugin::preserveInitSections(
714 
715  JITLinkSymbolSet InitSectionSymbols;
716  for (auto &InitSectionName : InitSectionNames) {
717  // Skip non-init sections.
718  auto *InitSection = G.findSectionByName(InitSectionName);
719  if (!InitSection)
720  continue;
721 
722  // Make a pass over live symbols in the section: those blocks are already
723  // preserved.
724  DenseSet<jitlink::Block *> AlreadyLiveBlocks;
725  for (auto &Sym : InitSection->symbols()) {
726  auto &B = Sym->getBlock();
727  if (Sym->isLive() && Sym->getOffset() == 0 &&
728  Sym->getSize() == B.getSize() && !AlreadyLiveBlocks.count(&B)) {
729  InitSectionSymbols.insert(Sym);
730  AlreadyLiveBlocks.insert(&B);
731  }
732  }
733 
734  // Add anonymous symbols to preserve any not-already-preserved blocks.
735  for (auto *B : InitSection->blocks())
736  if (!AlreadyLiveBlocks.count(B))
737  InitSectionSymbols.insert(
738  &G.addAnonymousSymbol(*B, 0, B->getSize(), false, true));
739  }
740 
741  if (!InitSectionSymbols.empty()) {
742  std::lock_guard<std::mutex> Lock(PluginMutex);
743  InitSymbolDeps[&MR] = std::move(InitSectionSymbols);
744  }
745 
746  return Error::success();
747 }
748 
749 Error ELFNixPlatform::ELFNixPlatformPlugin::registerInitSections(
750  jitlink::LinkGraph &G, JITDylib &JD) {
751 
752  SmallVector<jitlink::Section *> InitSections;
753 
754  LLVM_DEBUG({ dbgs() << "ELFNixPlatform::registerInitSections\n"; });
755 
756  for (auto InitSectionName : InitSectionNames) {
757  if (auto *Sec = G.findSectionByName(InitSectionName)) {
758  InitSections.push_back(Sec);
759  }
760  }
761 
762  // Dump the scraped inits.
763  LLVM_DEBUG({
764  dbgs() << "ELFNixPlatform: Scraped " << G.getName() << " init sections:\n";
765  for (auto *Sec : InitSections) {
766  jitlink::SectionRange R(*Sec);
767  dbgs() << " " << Sec->getName() << ": "
768  << formatv("[ {0:x} -- {1:x} ]", R.getStart(), R.getEnd()) << "\n";
769  }
770  });
771 
772  return MP.registerInitInfo(JD, InitSections);
773 }
774 
775 Error ELFNixPlatform::ELFNixPlatformPlugin::fixTLVSectionsAndEdges(
776  jitlink::LinkGraph &G, JITDylib &JD) {
777 
778  // TODO implement TLV support
779  for (auto *Sym : G.external_symbols())
780  if (Sym->getName() == "__tls_get_addr") {
781  Sym->setName("___orc_rt_elfnix_tls_get_addr");
782  }
783 
784  auto *TLSInfoEntrySection = G.findSectionByName("$__TLSINFO");
785 
786  if (TLSInfoEntrySection) {
788  {
789  std::lock_guard<std::mutex> Lock(MP.PlatformMutex);
790  auto I = MP.JITDylibToPThreadKey.find(&JD);
791  if (I != MP.JITDylibToPThreadKey.end())
792  Key = I->second;
793  }
794  if (!Key) {
795  if (auto KeyOrErr = MP.createPThreadKey())
796  Key = *KeyOrErr;
797  else
798  return KeyOrErr.takeError();
799  }
800 
801  uint64_t PlatformKeyBits =
802  support::endian::byte_swap(*Key, G.getEndianness());
803 
804  for (auto *B : TLSInfoEntrySection->blocks()) {
805  // FIXME: The TLS descriptor byte length may different with different
806  // ISA
807  assert(B->getSize() == (G.getPointerSize() * 2) &&
808  "TLS descriptor must be 2 words length");
809  auto TLSInfoEntryContent = B->getMutableContent(G);
810  memcpy(TLSInfoEntryContent.data(), &PlatformKeyBits, G.getPointerSize());
811  }
812  }
813 
814  return Error::success();
815 }
816 
817 } // End namespace orc.
818 } // End namespace llvm.
llvm::orc::ExecutorAddr
Represents an address in the executor process.
Definition: ExecutorAddress.h:37
llvm::orc::ObjectLinkingLayer::emit
void emit(std::unique_ptr< MaterializationResponsibility > R, std::unique_ptr< MemoryBuffer > O) override
Emit an object file.
Definition: ObjectLinkingLayer.cpp:646
llvm::orc::MaterializationResponsibility
Tracks responsibility for materialization, and mediates interactions between MaterializationUnits and...
Definition: Core.h:520
getName
static StringRef getName(Value *V)
Definition: ProvenanceAnalysisEvaluator.cpp:42
llvm::orc::ELFNixPlatform::Create
static Expected< std::unique_ptr< ELFNixPlatform > > Create(ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer, JITDylib &PlatformJD, const char *OrcRuntimePath, Optional< SymbolAliasMap > RuntimeAliases=None)
Try to create a ELFNixPlatform instance, adding the ORC runtime to the given JITDylib.
Definition: ELFNixPlatform.cpp:104
llvm::orc::JITDylib::withLinkOrderDo
auto withLinkOrderDo(Func &&F) -> decltype(F(std::declval< const JITDylibSearchOrder & >()))
Do something with the link order (run under the session lock).
Definition: Core.h:1692
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::orc::JITDylib
A symbol table that supports asynchoronous symbol queries.
Definition: Core.h:922
llvm::msgpack::Endianness
constexpr support::endianness Endianness
The endianness of all multi-byte encoded values in MessagePack.
Definition: MsgPack.h:24
llvm::AArch64CC::AL
@ AL
Definition: AArch64BaseInfo.h:269
llvm::orc::shared::SPSSequence
SPS tag type for sequences.
Definition: SimplePackedSerialization.h:193
llvm::orc::ELFNixPlatform::notifyRemoving
Error notifyRemoving(ResourceTracker &RT) override
This method will be called under the ExecutionSession lock when a ResourceTracker is removed.
Definition: ELFNixPlatform.cpp:172
ELFNixPlatform.h
llvm::orc::ExecutionSession::getJITDylibByName
JITDylib * getJITDylibByName(StringRef Name)
Return a pointer to the "name" JITDylib.
Definition: Core.cpp:1850
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
BinaryByteStream.h
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1168
llvm::orc::SymbolLookupSet
A set of symbols to look up, each associated with a SymbolLookupFlags value.
Definition: Core.h:175
llvm::orc::SymbolStringPtr
Pointer to a pooled string representing a symbol name.
Definition: SymbolStringPool.h:50
llvm::Error::success
static ErrorSuccess success()
Create a success value.
Definition: Error.h:331
llvm::orc::ELFNixPlatform::requiredCXXAliases
static ArrayRef< std::pair< const char *, const char * > > requiredCXXAliases()
Returns the array of required CXX aliases.
Definition: ELFNixPlatform.cpp:194
Content
T Content
Definition: ELFObjHandler.cpp:90
llvm::orc::StaticLibraryDefinitionGenerator::Load
static Expected< std::unique_ptr< StaticLibraryDefinitionGenerator > > Load(ObjectLayer &L, const char *FileName)
Try to create a StaticLibraryDefinitionGenerator from the given path.
Definition: ExecutionUtils.cpp:272
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:45
llvm::orc::ELFNixPlatform::notifyAdding
Error notifyAdding(ResourceTracker &RT, const MaterializationUnit &MU) override
This method will be called under the ExecutionSession lock each time a MaterializationUnit is added t...
Definition: ELFNixPlatform.cpp:156
llvm::orc::ExecutorAddr::getValue
uint64_t getValue() const
Definition: ExecutorAddress.h:60
llvm::orc::shared
Definition: ELFNixPlatform.h:243
llvm::Triple::x86_64
@ x86_64
Definition: Triple.h:84
llvm::reverse
auto reverse(ContainerTy &&C, std::enable_if_t< has_rbegin< ContainerTy >::value > *=nullptr)
Definition: STLExtras.h:333
llvm::orc::ResourceTracker
API to remove / transfer ownership of JIT resources.
Definition: Core.h:53
llvm::Optional
Definition: APInt.h:33
llvm::DenseMapBase::count
size_type count(const_arg_type_t< KeyT > Val) const
Return 1 if the specified key is in the map, 0 otherwise.
Definition: DenseMap.h:145
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:42
llvm::orc::Platform::lookupInitSymbolsAsync
static void lookupInitSymbolsAsync(unique_function< void(Error)> OnComplete, ExecutionSession &ES, const DenseMap< JITDylib *, SymbolLookupSet > &InitSyms)
Performs an async lookup for the the given symbols in each of the given JITDylibs,...
Definition: Core.cpp:1758
llvm::orc::shared::SPSTuple
SPS tag type for tuples.
Definition: SimplePackedSerialization.h:183
llvm::detail::DenseSetImpl< ValueT, DenseMap< ValueT, detail::DenseSetEmpty, DenseMapInfo< ValueT >, detail::DenseSetPair< ValueT > >, DenseMapInfo< ValueT > >::insert
std::pair< iterator, bool > insert(const ValueT &V)
Definition: DenseSet.h:206
llvm::detail::DenseSetImpl< ValueT, DenseMap< ValueT, detail::DenseSetEmpty, DenseMapInfo< ValueT >, detail::DenseSetPair< ValueT > >, DenseMapInfo< ValueT > >::count
size_type count(const_arg_type_t< ValueT > V) const
Return 1 if the specified key is in the set, 0 otherwise.
Definition: DenseSet.h:97
llvm::MachO::SymbolFlags
SymbolFlags
Symbol flags.
Definition: Symbol.h:25
llvm::orc::MaterializationUnit
A MaterializationUnit represents a set of symbol definitions that can be materialized as a group,...
Definition: Core.h:664
LLVM_DEBUG
#define LLVM_DEBUG(X)
Definition: Debug.h:101
ExecutionUtils.h
llvm::RISCVFenceField::R
@ R
Definition: RISCVBaseInfo.h:198
DebugUtils.h
llvm::orc::MaterializationUnit::getName
virtual StringRef getName() const =0
Return the name of this materialization unit.
llvm::dbgs
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:163
llvm::Lock
static sys::Mutex Lock
Definition: NVPTXUtilities.cpp:39
llvm::orc::ResourceTracker::getJITDylib
JITDylib & getJITDylib() const
Return the JITDylib targeted by this tracker.
Definition: Core.h:68
llvm::formatv
auto formatv(const char *Fmt, Ts &&... Vals) -> formatv_object< decltype(std::make_tuple(detail::build_format_adapter(std::forward< Ts >(Vals))...))>
Definition: FormatVariadic.h:250
llvm::orc::ExecutionSession::registerJITDispatchHandlers
Error registerJITDispatchHandlers(JITDylib &JD, JITDispatchHandlerAssociationMap WFs)
For each tag symbol name, associate the corresponding AsyncHandlerWrapperFunction with the address of...
Definition: Core.cpp:2060
ELF.h
llvm::support::little
@ little
Definition: Endian.h:27
llvm::orc
Definition: CompileOnDemandLayer.h:57
llvm::orc::NoDependenciesToRegister
RegisterDependenciesFunction NoDependenciesToRegister
This can be used as the value for a RegisterDependenciesFunction if there are no dependants to regist...
Definition: Core.cpp:34
llvm::ms_demangle::QualifierMangleMode::Result
@ Result
llvm::AMDGPU::PALMD::Key
Key
PAL metadata keys.
Definition: AMDGPUMetadata.h:481
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
llvm::orc::ExecutionSession::intern
SymbolStringPtr intern(StringRef SymName)
Add a symbol name to the SymbolStringPool and return a pointer to it.
Definition: Core.h:1322
llvm::orc::JITDylib::addGenerator
GeneratorT & addGenerator(std::unique_ptr< GeneratorT > DefGenerator)
Adds a definition generator to this JITDylib and returns a referenece to it.
Definition: Core.h:1684
llvm::orc::shared::SPSExecutorAddr
SPS tag type for executor addresseses.
Definition: SimplePackedSerialization.h:199
llvm::orc::ExecutionSession::runSessionLocked
decltype(auto) runSessionLocked(Func &&F)
Run the given lambda with the session mutex locked.
Definition: Core.h:1332
llvm::ErrorAsOutParameter
Helper for Errors used as out-parameters.
Definition: Error.h:1099
llvm::orc::LookupKind::DLSym
@ DLSym
llvm::orc::SymbolLookupSet::add
SymbolLookupSet & add(SymbolStringPtr Name, SymbolLookupFlags Flags=SymbolLookupFlags::RequiredSymbol)
Add an element to the set.
Definition: Core.h:236
llvm::orc::ELFPerObjectSectionsToRegister::ThreadDataSection
ExecutorAddrRange ThreadDataSection
Definition: ELFNixPlatform.h:31
llvm::orc::SymbolLookupFlags::WeaklyReferencedSymbol
@ WeaklyReferencedSymbol
llvm::orc::MaterializationResponsibility::getInitializerSymbol
const SymbolStringPtr & getInitializerSymbol() const
Returns the initialization pseudo-symbol, if any.
Definition: Core.h:552
G
const DataFlowGraph & G
Definition: RDFGraph.cpp:202
llvm::DenseSet
Implements a dense probed hash-table based set.
Definition: DenseSet.h:268
llvm::orc::ELFNixPlatform::isInitializerSection
static bool isInitializerSection(StringRef SecName)
Returns true if the given section name is an initializer section.
Definition: ELFNixPlatform.cpp:213
llvm::orc::MaterializationResponsibility::getTargetJITDylib
JITDylib & getTargetJITDylib() const
Returns the target JITDylib that these symbols are being materialized into.
Definition: Core.h:538
uint64_t
D
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
llvm::orc::MaterializationUnit::getInitializerSymbol
const SymbolStringPtr & getInitializerSymbol() const
Returns the initialization symbol for this MaterializationUnit (if any).
Definition: Core.h:689
llvm::orc::ELFNixJITDylibDeinitializerSequence
std::vector< ELFNixJITDylibDeinitializers > ELFNixJITDylibDeinitializerSequence
Definition: ELFNixPlatform.h:52
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::orc::shared::SPSExpected
SPS tag type for expecteds, which are either a T or a string representing an error.
Definition: SimplePackedSerialization.h:505
llvm::DenseMap< SymbolStringPtr, JITSymbolFlags >
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::orc::ELFPerObjectSectionsToRegister
Definition: ELFNixPlatform.h:29
llvm::orc::ELFNixJITDylibInitializerSequence
std::vector< ELFNixJITDylibInitializers > ELFNixJITDylibInitializerSequence
Definition: ELFNixPlatform.h:49
llvm::orc::ELFNixPlatform::setupJITDylib
Error setupJITDylib(JITDylib &JD) override
This method will be called outside the session lock each time a JITDylib is created (unless it is cre...
Definition: ELFNixPlatform.cpp:151
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::move
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1609
llvm::sys::SmartMutex::unlock
bool unlock()
Definition: Mutex.h:46
memcpy
<%struct.s * > cast struct s *S to sbyte *< sbyte * > sbyte uint cast struct s *agg result to sbyte *< sbyte * > sbyte uint cast struct s *memtmp to sbyte *< sbyte * > sbyte uint ret void llc ends up issuing two memcpy or custom lower memcpy(of small size) to be ldmia/stmia. I think option 2 is better but the current register allocator cannot allocate a chunk of registers at a time. A feasible temporary solution is to use specific physical registers at the lowering time for small(<
llvm::orc::ExecutionSession::callSPSWrapper
Error callSPSWrapper(ExecutorAddr WrapperFnAddr, WrapperCallArgTs &&...WrapperCallArgs)
Run a wrapper function using SPS to serialize the arguments and deserialize the results.
Definition: Core.h:1504
llvm::orc::JITDylibSearchOrder
std::vector< std::pair< JITDylib *, JITDylibLookupFlags > > JITDylibSearchOrder
A list of (JITDylib*, JITDylibLookupFlags) pairs to be used as a search order during symbol lookup.
Definition: Core.h:154
llvm::orc::ExecutorAddrRange::Start
ExecutorAddr Start
Definition: ExecutorAddress.h:157
llvm::orc::ExecutionSession::getExecutorProcessControl
ExecutorProcessControl & getExecutorProcessControl()
Get the ExecutorProcessControl object associated with this ExecutionSession.
Definition: Core.h:1314
_
#define _
Definition: HexagonMCCodeEmitter.cpp:47
llvm::orc::ELFNixJITDylibInitializers
Definition: ELFNixPlatform.h:34
ELF_x86_64.h
llvm::ArrayRef< char >
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::orc::ELFNixPlatform::standardRuntimeUtilityAliases
static ArrayRef< std::pair< const char *, const char * > > standardRuntimeUtilityAliases()
Returns the array of standard runtime utility aliases for ELF.
Definition: ELFNixPlatform.cpp:203
llvm::orc::SymbolState::Ready
@ Ready
Emitted to memory, but waiting on transitive dependencies.
llvm::orc::ELFNixPlatform
Mediates between ELFNix initialization and ExecutionSession state.
Definition: ELFNixPlatform.h:55
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:134
if
if(llvm_vc STREQUAL "") set(fake_version_inc "$
Definition: CMakeLists.txt:14
llvm::orc::ELFNixPlatform::getObjectLinkingLayer
ObjectLinkingLayer & getObjectLinkingLayer() const
Definition: ELFNixPlatform.h:101
llvm::orc::ELFNixPlatform::standardPlatformAliases
static SymbolAliasMap standardPlatformAliases(ExecutionSession &ES)
Returns an AliasMap containing the default aliases for the ELFNixPlatform.
Definition: ELFNixPlatform.cpp:186
llvm::orc::JITDylib::getDFSLinkOrder
static std::vector< JITDylibSP > getDFSLinkOrder(ArrayRef< JITDylibSP > JDs)
Returns the given JITDylibs and all of their transitive dependencies in DFS order (based on linkage r...
Definition: Core.cpp:1875
x86_64.h
llvm::orc::ObjectLinkingLayer
An ObjectLayer implementation built on JITLink.
Definition: ObjectLinkingLayer.h:54
llvm::DenseMapBase< DenseMap< KeyT, ValueT, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >, KeyT, ValueT, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >::empty
LLVM_NODISCARD bool empty() const
Definition: DenseMap.h:97
llvm::sys::SmartMutex::lock
bool lock()
Definition: Mutex.h:33
llvm::AMDGPU::HSAMD::Kernel::Key::SymbolName
constexpr char SymbolName[]
Key for Kernel::Metadata::mSymbolName.
Definition: AMDGPUMetadata.h:381
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
std
Definition: BitVector.h:838
llvm::inconvertibleErrorCode
std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
Definition: Error.cpp:77
llvm::orc::ObjectLinkingLayer::addPlugin
ObjectLinkingLayer & addPlugin(std::unique_ptr< Plugin > P)
Add a pass-config modifier.
Definition: ObjectLinkingLayer.h:130
llvm::orc::addAliases
static void addAliases(ExecutionSession &ES, SymbolAliasMap &Aliases, ArrayRef< std::pair< const char *, const char * >> AL)
Definition: ELFNixPlatform.cpp:176
llvm::orc::ExecutorProcessControl::getTargetTriple
const Triple & getTargetTriple() const
Return the Triple for the target process.
Definition: ExecutorProcessControl.h:201
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
llvm::orc::ExecutionSession
An ExecutionSession represents a running JIT program.
Definition: Core.h:1275
llvm::orc::JITDylibLookupFlags::MatchExportedSymbolsOnly
@ MatchExportedSymbolsOnly
llvm::support::endian::byte_swap
value_type byte_swap(value_type value, endianness endian)
Definition: Endian.h:49
llvm::orc::symbolAliases
std::unique_ptr< ReExportsMaterializationUnit > symbolAliases(SymbolAliasMap Aliases)
Create a ReExportsMaterializationUnit with the given aliases.
Definition: Core.h:792
llvm::orc::absoluteSymbols
std::unique_ptr< AbsoluteSymbolsMaterializationUnit > absoluteSymbols(SymbolMap Symbols)
Create an AbsoluteSymbolsMaterializationUnit with the given symbols.
Definition: Core.h:747
llvm::orc::JITDylib::getName
const std::string & getName() const
Get the name for this JITDylib.
Definition: Core.h:939
llvm::orc::JITDylib::define
Error define(std::unique_ptr< MaterializationUnitType > &&MU, ResourceTrackerSP RT=nullptr)
Define all symbols provided by the materialization unit to be part of this JITDylib.
Definition: Core.h:1698
llvm::orc::ExecutionSession::lookup
void lookup(LookupKind K, const JITDylibSearchOrder &SearchOrder, SymbolLookupSet Symbols, SymbolState RequiredState, SymbolsResolvedCallback NotifyComplete, RegisterDependenciesFunction RegisterDependencies)
Search the given JITDylibs for the given symbols.
Definition: Core.cpp:1951
llvm::support::endianness
endianness
Definition: Endian.h:27
llvm::orc::ELFNixPlatform::getExecutionSession
ExecutionSession & getExecutionSession() const
Definition: ELFNixPlatform.h:100
llvm::orc::ExecutionSession::wrapAsyncWithSPS
static JITDispatchHandlerFunction wrapAsyncWithSPS(HandlerT &&H)
Wrap a handler that takes concrete argument types (and a sender for a concrete return type) to produc...
Definition: Core.h:1518
llvm::orc::ELFPerObjectSectionsToRegister::EHFrameSection
ExecutorAddrRange EHFrameSection
Definition: ELFNixPlatform.h:30
llvm::orc::ELFNixJITDylibInitializers::InitSections
StringMap< SectionList > InitSections
Definition: ELFNixPlatform.h:43
llvm::orc::JITDylibLookupFlags::MatchAllSymbols
@ MatchAllSymbols
Debug.h
llvm::JITSymbolFlags::Exported
@ Exported
Definition: JITSymbol.h:85