15#ifndef LLVM_EXECUTIONENGINE_JITLINK_DEFINEEXTERNALSECTIONSTARTANDENDSYMBOLS_H 
   16#define LLVM_EXECUTIONENGINE_JITLINK_DEFINEEXTERNALSECTIONSTARTANDENDSYMBOLS_H 
   21#define DEBUG_TYPE "jitlink" 
   36template <
typename SymbolIdentifierFunction>
 
   46    std::vector<Symbol *> Externals(
G.external_symbols().begin(),
 
   47                                    G.external_symbols().end());
 
   49    for (
auto *Sym : Externals) {
 
   52        auto &SR = getSectionRange(*
D.Sec);
 
   63            G.makeDefined(*Sym, *SR.getLastBlock(),
 
 
   74    return SectionRanges.try_emplace(&Sec, Sec).first->second;
 
   78  SymbolIdentifierFunction 
F;
 
 
  100template <
typename SymbolIdentifierFunction>
 
  101DefineExternalSectionStartAndEndSymbols<SymbolIdentifierFunction>
 
  103    SymbolIdentifierFunction &&
F) {
 
  105      std::forward<SymbolIdentifierFunction>(
F));
 
 
  109inline SectionRangeSymbolDesc
 
  111  constexpr StringRef StartSymbolPrefix = 
"__start_";
 
  112  constexpr StringRef EndSymbolPrefix = 
"__stop_";
 
  115  if ((*SymName).starts_with(StartSymbolPrefix)) {
 
  116    if (
auto *Sec = 
G.findSectionByName(
 
  117            (*SymName).drop_front(StartSymbolPrefix.
size())))
 
  119  } 
else if ((*SymName).starts_with(EndSymbolPrefix)) {
 
  121            G.findSectionByName((*SymName).drop_front(EndSymbolPrefix.
size())))
 
  122      return {*Sec, 
false};
 
 
  128inline SectionRangeSymbolDesc
 
  130  constexpr StringRef StartSymbolPrefix = 
"section$start$";
 
  131  constexpr StringRef EndSymbolPrefix = 
"section$end$";
 
  134  if ((*SymName).starts_with(StartSymbolPrefix)) {
 
  135    auto [SegName, SecName] =
 
  136        (*SymName).drop_front(StartSymbolPrefix.
size()).split(
'$');
 
  137    std::string 
SectionName = (SegName + 
"," + SecName).str();
 
  140  } 
else if ((*SymName).starts_with(EndSymbolPrefix)) {
 
  141    auto [SegName, SecName] =
 
  142        (*SymName).drop_front(EndSymbolPrefix.
size()).split(
'$');
 
  143    std::string 
SectionName = (SegName + 
"," + SecName).str();
 
  145      return {*Sec, 
false};
 
 
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
 
Lightweight error class with error context and mandatory checking.
 
static ErrorSuccess success()
Create a success value.
 
StringRef - Represent a constant reference to a string, i.e.
 
constexpr size_t size() const
size - Get the string size.
 
Pass implementation for the createDefineExternalSectionStartAndEndSymbols function.
 
DefineExternalSectionStartAndEndSymbols(SymbolIdentifierFunction F)
 
Error operator()(LinkGraph &G)
 
Represents a section address range via a pair of Block pointers to the first and last Blocks in the s...
 
Represents an object file section.
 
const orc::SymbolStringPtr & getName() const
Returns the name of this symbol (empty if the symbol is anonymous).
 
Represents an address in the executor process.
 
SectionRangeSymbolDesc identifyELFSectionStartAndEndSymbols(LinkGraph &G, Symbol &Sym)
ELF section start/end symbol detection.
 
DefineExternalSectionStartAndEndSymbols< SymbolIdentifierFunction > createDefineExternalSectionStartAndEndSymbolsPass(SymbolIdentifierFunction &&F)
Returns a JITLink pass (as a function class) that uses the given symbol identification function to id...
 
SectionRangeSymbolDesc identifyMachOSectionStartAndEndSymbols(LinkGraph &G, Symbol &Sym)
MachO section start/end symbol detection.
 
This is an optimization pass for GlobalISel generic memory operations.
 
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
 
Implement std::hash so that hash_code can be used in STL containers.
 
SectionRangeSymbolDesc()=default
 
SectionRangeSymbolDesc(Section &Sec, bool IsStart)