class ELFNixPlatform

Declaration

class ELFNixPlatform : public Platform { /* full declaration omitted */ };

Description

Mediates between ELFNix initialization and ExecutionSession state.

Declared at: llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h:55

Inherits from: Platform

Member Variables

private llvm::orc::ExecutionSession& ES
private llvm::orc::ObjectLinkingLayer& ObjLinkingLayer
private llvm::orc::SymbolStringPtr DSOHandleSymbol
private std::atomic<bool> RuntimeBootstrapped = {false}
private llvm::orc::ExecutorAddr orc_rt_elfnix_platform_bootstrap
private llvm::orc::ExecutorAddr orc_rt_elfnix_platform_shutdown
private llvm::orc::ExecutorAddr orc_rt_elfnix_register_object_sections
private llvm::orc::ExecutorAddr orc_rt_elfnix_create_pthread_key
private DenseMap<llvm::orc::JITDylib*, llvm::orc::SymbolLookupSet> RegisteredInitSymbols
private std::mutex PlatformMutex
private DenseMap<llvm::orc::JITDylib*, llvm::orc::ELFNixJITDylibInitializers> InitSeqs
private std::vector<ELFPerObjectSectionsToRegister> BootstrapPOSRs
private DenseMap<llvm::orc::ExecutorAddr, llvm::orc::JITDylib*> HandleAddrToJITDylib
private DenseMap<llvm::orc::JITDylib*, uint64_t> JITDylibToPThreadKey

Method Overview

  • public static Expected<std::unique_ptr<ELFNixPlatform>> Create(llvm::orc::ExecutionSession & ES, llvm::orc::ObjectLinkingLayer & ObjLinkingLayer, llvm::orc::JITDylib & PlatformJD, const char * OrcRuntimePath, Optional<llvm::orc::SymbolAliasMap> RuntimeAliases = None)
  • private ELFNixPlatform(llvm::orc::ExecutionSession & ES, llvm::orc::ObjectLinkingLayer & ObjLinkingLayer, llvm::orc::JITDylib & PlatformJD, std::unique_ptr<DefinitionGenerator> OrcRuntimeGenerator, llvm::Error & Err)
  • private llvm::Error associateRuntimeSupportFunctions(llvm::orc::JITDylib & PlatformJD)
  • private llvm::Error bootstrapELFNixRuntime(llvm::orc::JITDylib & PlatformJD)
  • private Expected<uint64_t> createPThreadKey()
  • public llvm::orc::ExecutionSession & getExecutionSession() const
  • private void getInitializersBuildSequencePhase(llvm::orc::ELFNixPlatform::SendInitializerSequenceFn SendResult, llvm::orc::JITDylib & JD, std::vector<JITDylibSP> DFSLinkOrder)
  • private void getInitializersLookupPhase(llvm::orc::ELFNixPlatform::SendInitializerSequenceFn SendResult, llvm::orc::JITDylib & JD)
  • public llvm::orc::ObjectLinkingLayer & getObjectLinkingLayer() const
  • public static bool isInitializerSection(llvm::StringRef SecName)
  • public llvm::Error notifyAdding(llvm::orc::ResourceTracker & RT, const llvm::orc::MaterializationUnit & MU)
  • public llvm::Error notifyRemoving(llvm::orc::ResourceTracker & RT)
  • private llvm::Error registerInitInfo(llvm::orc::JITDylib & JD, ArrayRef<jitlink::Section *> InitSections)
  • private llvm::Error registerPerObjectSections(const llvm::orc::ELFPerObjectSectionsToRegister & POSR)
  • public static ArrayRef<std::pair<const char *, const char *>> requiredCXXAliases()
  • private void rt_getDeinitializers(llvm::orc::ELFNixPlatform::SendDeinitializerSequenceFn SendResult, llvm::orc::ExecutorAddr Handle)
  • private void rt_getInitializers(llvm::orc::ELFNixPlatform::SendInitializerSequenceFn SendResult, llvm::StringRef JDName)
  • private void rt_lookupSymbol(llvm::orc::ELFNixPlatform::SendSymbolAddressFn SendResult, llvm::orc::ExecutorAddr Handle, llvm::StringRef SymbolName)
  • public llvm::Error setupJITDylib(llvm::orc::JITDylib & JD)
  • public static Expected<llvm::orc::SymbolAliasMap> standardPlatformAliases(llvm::orc::ExecutionSession & ES, llvm::orc::JITDylib & PlatformJD)
  • public static ArrayRef<std::pair<const char *, const char *>> standardRuntimeUtilityAliases()
  • private static bool supportedTarget(const llvm::Triple & TT)
  • public llvm::Error teardownJITDylib(llvm::orc::JITDylib & JD)

Inherited from Platform:

Methods

static Expected<std::unique_ptr<ELFNixPlatform>>
Create(llvm::orc::ExecutionSession& ES,
       llvm::orc::ObjectLinkingLayer&
           ObjLinkingLayer,
       llvm::orc::JITDylib& PlatformJD,
       const char* OrcRuntimePath,
       Optional<llvm::orc::SymbolAliasMap>
           RuntimeAliases = None)

Description

Try to create a ELFNixPlatform instance, adding the ORC runtime to the given JITDylib. The ORC runtime requires access to a number of symbols in libc++. It is up to the caller to ensure that the requried symbols can be referenced by code added to PlatformJD. The standard way to achieve this is to first attach dynamic library search generators for either the given process, or for the specific required libraries, to PlatformJD, then to create the platform instance: Alternatively, these symbols could be added to another JITDylib that PlatformJD links against. Clients are also responsible for ensuring that any JIT'd code that depends on runtime functions (including any code using TLV or static destructors) can reference the runtime symbols. This is usually achieved by linking any JITDylibs containing regular code against PlatformJD. By default, ELFNixPlatform will add the set of aliases returned by the standardPlatformAliases function. This includes both required aliases (e.g. __cxa_atexit -> __orc_rt_elf_cxa_atexit for static destructor support), and optional aliases that provide JIT versions of common functions (e.g. dlopen -> __orc_rt_elf_jit_dlopen). Clients can override these defaults by passing a non-None value for the RuntimeAliases function, in which case the client is responsible for setting up all aliases (including the required ones).

Declared at: llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h:96

Parameters

llvm::orc::ExecutionSession& ES
llvm::orc::ObjectLinkingLayer& ObjLinkingLayer
llvm::orc::JITDylib& PlatformJD
const char* OrcRuntimePath
Optional<llvm::orc::SymbolAliasMap> RuntimeAliases = None

ELFNixPlatform(
    llvm::orc::ExecutionSession& ES,
    llvm::orc::ObjectLinkingLayer&
        ObjLinkingLayer,
    llvm::orc::JITDylib& PlatformJD,
    std::unique_ptr<DefinitionGenerator>
        OrcRuntimeGenerator,
    llvm::Error& Err)

Declared at: llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h:188

Parameters

llvm::orc::ExecutionSession& ES
llvm::orc::ObjectLinkingLayer& ObjLinkingLayer
llvm::orc::JITDylib& PlatformJD
std::unique_ptr<DefinitionGenerator> OrcRuntimeGenerator
llvm::Error& Err

llvm::Error associateRuntimeSupportFunctions(
    llvm::orc::JITDylib& PlatformJD)

Declared at: llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h:194

Parameters

llvm::orc::JITDylib& PlatformJD

llvm::Error bootstrapELFNixRuntime(
    llvm::orc::JITDylib& PlatformJD)

Declared at: llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h:213

Parameters

llvm::orc::JITDylib& PlatformJD

Expected<uint64_t> createPThreadKey()

Declared at: llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h:220

llvm::orc::ExecutionSession& getExecutionSession()
    const

Declared at: llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h:100

void getInitializersBuildSequencePhase(
    llvm::orc::ELFNixPlatform::
        SendInitializerSequenceFn SendResult,
    llvm::orc::JITDylib& JD,
    std::vector<JITDylibSP> DFSLinkOrder)

Declared at: llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h:196

Parameters

llvm::orc::ELFNixPlatform:: SendInitializerSequenceFn SendResult
llvm::orc::JITDylib& JD
std::vector<JITDylibSP> DFSLinkOrder

void getInitializersLookupPhase(
    llvm::orc::ELFNixPlatform::
        SendInitializerSequenceFn SendResult,
    llvm::orc::JITDylib& JD)

Declared at: llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h:200

Parameters

llvm::orc::ELFNixPlatform:: SendInitializerSequenceFn SendResult
llvm::orc::JITDylib& JD

llvm::orc::ObjectLinkingLayer&
getObjectLinkingLayer() const

Declared at: llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h:101

static bool isInitializerSection(
    llvm::StringRef SecName)

Description

Returns true if the given section name is an initializer section.

Declared at: llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h:123

Parameters

llvm::StringRef SecName

llvm::Error notifyAdding(
    llvm::orc::ResourceTracker& RT,
    const llvm::orc::MaterializationUnit& MU)

Description

This method will be called under the ExecutionSession lock each time a MaterializationUnit is added to a JITDylib.

Declared at: llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h:105

Parameters

llvm::orc::ResourceTracker& RT
const llvm::orc::MaterializationUnit& MU

llvm::Error notifyRemoving(
    llvm::orc::ResourceTracker& RT)

Description

This method will be called under the ExecutionSession lock when a ResourceTracker is removed.

Declared at: llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h:107

Parameters

llvm::orc::ResourceTracker& RT

llvm::Error registerInitInfo(
    llvm::orc::JITDylib& JD,
    ArrayRef<jitlink::Section*> InitSections)

Declared at: llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h:215

Parameters

llvm::orc::JITDylib& JD
ArrayRef<jitlink::Section*> InitSections

llvm::Error registerPerObjectSections(
    const llvm::orc::
        ELFPerObjectSectionsToRegister& POSR)

Declared at: llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h:218

Parameters

const llvm::orc::ELFPerObjectSectionsToRegister& POSR

static ArrayRef<
    std::pair<const char*, const char*>>
requiredCXXAliases()

Description

Returns the array of required CXX aliases.

Declared at: llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h:116

void rt_getDeinitializers(
    llvm::orc::ELFNixPlatform::
        SendDeinitializerSequenceFn SendResult,
    llvm::orc::ExecutorAddr Handle)

Declared at: llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h:206

Parameters

llvm::orc::ELFNixPlatform:: SendDeinitializerSequenceFn SendResult
llvm::orc::ExecutorAddr Handle

void rt_getInitializers(
    llvm::orc::ELFNixPlatform::
        SendInitializerSequenceFn SendResult,
    llvm::StringRef JDName)

Declared at: llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h:203

Parameters

llvm::orc::ELFNixPlatform:: SendInitializerSequenceFn SendResult
llvm::StringRef JDName

void rt_lookupSymbol(
    llvm::orc::ELFNixPlatform::SendSymbolAddressFn
        SendResult,
    llvm::orc::ExecutorAddr Handle,
    llvm::StringRef SymbolName)

Declared at: llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h:209

Parameters

llvm::orc::ELFNixPlatform::SendSymbolAddressFn SendResult
llvm::orc::ExecutorAddr Handle
llvm::StringRef SymbolName

llvm::Error setupJITDylib(llvm::orc::JITDylib& JD)

Description

This method will be called outside the session lock each time a JITDylib is created (unless it is created with EmptyJITDylib set) to allow the Platform to install any JITDylib specific standard symbols (e.g __dso_handle).

Declared at: llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h:103

Parameters

llvm::orc::JITDylib& JD

static Expected<llvm::orc::SymbolAliasMap>
standardPlatformAliases(
    llvm::orc::ExecutionSession& ES,
    llvm::orc::JITDylib& PlatformJD)

Description

Returns an AliasMap containing the default aliases for the ELFNixPlatform. This can be modified by clients when constructing the platform to add or remove aliases.

Declared at: llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h:112

Parameters

llvm::orc::ExecutionSession& ES
llvm::orc::JITDylib& PlatformJD

static ArrayRef<
    std::pair<const char*, const char*>>
standardRuntimeUtilityAliases()

Description

Returns the array of standard runtime utility aliases for ELF.

Declared at: llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h:120

static bool supportedTarget(
    const llvm::Triple& TT)

Declared at: llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h:186

Parameters

const llvm::Triple& TT

llvm::Error teardownJITDylib(
    llvm::orc::JITDylib& JD)

Description

This method will be called outside the session lock each time a JITDylib is removed to allow the Platform to remove any JITDylib-specific data.

Declared at: llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h:104

Parameters

llvm::orc::JITDylib& JD