#include "llvm/ExecutionEngine/Orc/ELFNixPlatform.h"
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/ExecutionEngine/JITLink/ELF_x86_64.h"
#include "llvm/ExecutionEngine/JITLink/aarch64.h"
#include "llvm/ExecutionEngine/JITLink/ppc64.h"
#include "llvm/ExecutionEngine/JITLink/x86_64.h"
#include "llvm/ExecutionEngine/Orc/DebugUtils.h"
#include "llvm/ExecutionEngine/Orc/ExecutionUtils.h"
#include "llvm/ExecutionEngine/Orc/LookupAndRecordAddrs.h"
#include "llvm/ExecutionEngine/Orc/Shared/ObjectFormats.h"
#include "llvm/Support/BinaryByteStream.h"
#include "llvm/Support/Debug.h"
#include <optional>
#define DEBUG_TYPE …
usingnamespacellvm;
usingnamespacellvm::orc;
usingnamespacellvm::orc::shared;
namespace {
template <typename SPSSerializer, typename... ArgTs>
shared::WrapperFunctionCall::ArgDataBufferType
getArgDataBufferType(const ArgTs &...Args) { … }
std::unique_ptr<jitlink::LinkGraph> createPlatformGraph(ELFNixPlatform &MOP,
std::string Name) { … }
class ELFNixPlatformCompleteBootstrapMaterializationUnit
: public MaterializationUnit { … };
class DSOHandleMaterializationUnit : public MaterializationUnit { … };
}
namespace llvm {
namespace orc {
Expected<std::unique_ptr<ELFNixPlatform>> ELFNixPlatform::Create(
ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer,
JITDylib &PlatformJD, std::unique_ptr<DefinitionGenerator> OrcRuntime,
std::optional<SymbolAliasMap> RuntimeAliases) { … }
Expected<std::unique_ptr<ELFNixPlatform>>
ELFNixPlatform::Create(ExecutionSession &ES,
ObjectLinkingLayer &ObjLinkingLayer,
JITDylib &PlatformJD, const char *OrcRuntimePath,
std::optional<SymbolAliasMap> RuntimeAliases) { … }
Error ELFNixPlatform::setupJITDylib(JITDylib &JD) { … }
Error ELFNixPlatform::teardownJITDylib(JITDylib &JD) { … }
Error ELFNixPlatform::notifyAdding(ResourceTracker &RT,
const MaterializationUnit &MU) { … }
Error ELFNixPlatform::notifyRemoving(ResourceTracker &RT) { … }
static void addAliases(ExecutionSession &ES, SymbolAliasMap &Aliases,
ArrayRef<std::pair<const char *, const char *>> AL) { … }
Expected<SymbolAliasMap>
ELFNixPlatform::standardPlatformAliases(ExecutionSession &ES,
JITDylib &PlatformJD) { … }
ArrayRef<std::pair<const char *, const char *>>
ELFNixPlatform::requiredCXXAliases() { … }
ArrayRef<std::pair<const char *, const char *>>
ELFNixPlatform::standardRuntimeUtilityAliases() { … }
bool ELFNixPlatform::supportedTarget(const Triple &TT) { … }
ELFNixPlatform::ELFNixPlatform(
ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer,
JITDylib &PlatformJD,
std::unique_ptr<DefinitionGenerator> OrcRuntimeGenerator, Error &Err)
: … { … }
Error ELFNixPlatform::associateRuntimeSupportFunctions(JITDylib &PlatformJD) { … }
void ELFNixPlatform::pushInitializersLoop(
PushInitializersSendResultFn SendResult, JITDylibSP JD) { … }
void ELFNixPlatform::rt_recordInitializers(
PushInitializersSendResultFn SendResult, ExecutorAddr JDHeaderAddr) { … }
void ELFNixPlatform::rt_lookupSymbol(SendSymbolAddressFn SendResult,
ExecutorAddr Handle,
StringRef SymbolName) { … }
Error ELFNixPlatform::ELFNixPlatformPlugin::bootstrapPipelineStart(
jitlink::LinkGraph &G) { … }
Error ELFNixPlatform::ELFNixPlatformPlugin::
bootstrapPipelineRecordRuntimeFunctions(jitlink::LinkGraph &G) { … }
Error ELFNixPlatform::ELFNixPlatformPlugin::bootstrapPipelineEnd(
jitlink::LinkGraph &G) { … }
Error ELFNixPlatform::registerPerObjectSections(
jitlink::LinkGraph &G, const ELFPerObjectSectionsToRegister &POSR,
bool IsBootstrapping) { … }
Expected<uint64_t> ELFNixPlatform::createPThreadKey() { … }
void ELFNixPlatform::ELFNixPlatformPlugin::modifyPassConfig(
MaterializationResponsibility &MR, jitlink::LinkGraph &LG,
jitlink::PassConfiguration &Config) { … }
void ELFNixPlatform::ELFNixPlatformPlugin::addDSOHandleSupportPasses(
MaterializationResponsibility &MR, jitlink::PassConfiguration &Config) { … }
void ELFNixPlatform::ELFNixPlatformPlugin::addEHAndTLVSupportPasses(
MaterializationResponsibility &MR, jitlink::PassConfiguration &Config,
bool IsBootstrapping) { … }
Error ELFNixPlatform::ELFNixPlatformPlugin::preserveInitSections(
jitlink::LinkGraph &G, MaterializationResponsibility &MR) { … }
Error ELFNixPlatform::ELFNixPlatformPlugin::registerInitSections(
jitlink::LinkGraph &G, JITDylib &JD, bool IsBootstrapping) { … }
Error ELFNixPlatform::ELFNixPlatformPlugin::fixTLVSectionsAndEdges(
jitlink::LinkGraph &G, JITDylib &JD) { … }
}
}