#include "llvm/ExecutionEngine/Orc/COFFPlatform.h"
#include "llvm/ExecutionEngine/Orc/DebugUtils.h"
#include "llvm/ExecutionEngine/Orc/LookupAndRecordAddrs.h"
#include "llvm/ExecutionEngine/Orc/ObjectFileInterface.h"
#include "llvm/ExecutionEngine/Orc/Shared/ObjectFormats.h"
#include "llvm/Object/COFF.h"
#include "llvm/ExecutionEngine/Orc/EPCDynamicLibrarySearchGenerator.h"
#include "llvm/ExecutionEngine/JITLink/x86_64.h"
#define DEBUG_TYPE …
usingnamespacellvm;
usingnamespacellvm::orc;
usingnamespacellvm::orc::shared;
namespace llvm {
namespace orc {
namespace shared {
SPSCOFFJITDylibDepInfo;
SPSCOFFJITDylibDepInfoMap;
SPSCOFFObjectSectionsMap;
SPSCOFFRegisterObjectSectionsArgs;
SPSCOFFDeregisterObjectSectionsArgs;
}
}
}
namespace {
class COFFHeaderMaterializationUnit : public MaterializationUnit { … };
}
namespace llvm {
namespace orc {
Expected<std::unique_ptr<COFFPlatform>> COFFPlatform::Create(
ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer,
JITDylib &PlatformJD, std::unique_ptr<MemoryBuffer> OrcRuntimeArchiveBuffer,
LoadDynamicLibrary LoadDynLibrary, bool StaticVCRuntime,
const char *VCRuntimePath, std::optional<SymbolAliasMap> RuntimeAliases) { … }
Expected<std::unique_ptr<COFFPlatform>>
COFFPlatform::Create(ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer,
JITDylib &PlatformJD, const char *OrcRuntimePath,
LoadDynamicLibrary LoadDynLibrary, bool StaticVCRuntime,
const char *VCRuntimePath,
std::optional<SymbolAliasMap> RuntimeAliases) { … }
Expected<MemoryBufferRef> COFFPlatform::getPerJDObjectFile() { … }
static void addAliases(ExecutionSession &ES, SymbolAliasMap &Aliases,
ArrayRef<std::pair<const char *, const char *>> AL) { … }
Error COFFPlatform::setupJITDylib(JITDylib &JD) { … }
Error COFFPlatform::teardownJITDylib(JITDylib &JD) { … }
Error COFFPlatform::notifyAdding(ResourceTracker &RT,
const MaterializationUnit &MU) { … }
Error COFFPlatform::notifyRemoving(ResourceTracker &RT) { … }
SymbolAliasMap COFFPlatform::standardPlatformAliases(ExecutionSession &ES) { … }
ArrayRef<std::pair<const char *, const char *>>
COFFPlatform::requiredCXXAliases() { … }
ArrayRef<std::pair<const char *, const char *>>
COFFPlatform::standardRuntimeUtilityAliases() { … }
bool COFFPlatform::supportedTarget(const Triple &TT) { … }
COFFPlatform::COFFPlatform(
ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer,
JITDylib &PlatformJD,
std::unique_ptr<StaticLibraryDefinitionGenerator> OrcRuntimeGenerator,
std::unique_ptr<MemoryBuffer> OrcRuntimeArchiveBuffer,
std::unique_ptr<object::Archive> OrcRuntimeArchive,
LoadDynamicLibrary LoadDynLibrary, bool StaticVCRuntime,
const char *VCRuntimePath, Error &Err)
: … { … }
Expected<COFFPlatform::JITDylibDepMap>
COFFPlatform::buildJDDepMap(JITDylib &JD) { … }
void COFFPlatform::pushInitializersLoop(PushInitializersSendResultFn SendResult,
JITDylibSP JD,
JITDylibDepMap &JDDepMap) { … }
void COFFPlatform::rt_pushInitializers(PushInitializersSendResultFn SendResult,
ExecutorAddr JDHeaderAddr) { … }
void COFFPlatform::rt_lookupSymbol(SendSymbolAddressFn SendResult,
ExecutorAddr Handle, StringRef SymbolName) { … }
Error COFFPlatform::associateRuntimeSupportFunctions(JITDylib &PlatformJD) { … }
Error COFFPlatform::runBootstrapInitializers(JDBootstrapState &BState) { … }
Error COFFPlatform::runBootstrapSubsectionInitializers(JDBootstrapState &BState,
StringRef Start,
StringRef End) { … }
Error COFFPlatform::bootstrapCOFFRuntime(JITDylib &PlatformJD) { … }
Error COFFPlatform::runSymbolIfExists(JITDylib &PlatformJD,
StringRef SymbolName) { … }
void COFFPlatform::COFFPlatformPlugin::modifyPassConfig(
MaterializationResponsibility &MR, jitlink::LinkGraph &LG,
jitlink::PassConfiguration &Config) { … }
Error COFFPlatform::COFFPlatformPlugin::associateJITDylibHeaderSymbol(
jitlink::LinkGraph &G, MaterializationResponsibility &MR,
bool IsBootstraping) { … }
Error COFFPlatform::COFFPlatformPlugin::registerObjectPlatformSections(
jitlink::LinkGraph &G, JITDylib &JD) { … }
Error COFFPlatform::COFFPlatformPlugin::preserveInitializerSections(
jitlink::LinkGraph &G, MaterializationResponsibility &MR) { … }
Error COFFPlatform::COFFPlatformPlugin::
registerObjectPlatformSectionsInBootstrap(jitlink::LinkGraph &G,
JITDylib &JD) { … }
}
}