LLVM 22.0.0git
llvm::orc::COFFVCRuntimeBootstrapper Class Reference

Bootstraps the vc runtime within jitdylibs. More...

#include "llvm/ExecutionEngine/Orc/COFFVCRuntimeSupport.h"

Public Member Functions

LLVM_ABI Expected< std::vector< std::string > > loadStaticVCRuntime (JITDylib &JD, bool DebugVersion=false)
 Adds symbol definitions of static version of msvc runtime libraries.
LLVM_ABI Error initializeStaticVCRuntime (JITDylib &JD)
 Runs the initializer of static version of msvc runtime libraries.
LLVM_ABI Expected< std::vector< std::string > > loadDynamicVCRuntime (JITDylib &JD, bool DebugVersion=false)
 Adds symbol definitions of dynamic version of msvc runtime libraries.

Static Public Member Functions

static LLVM_ABI Expected< std::unique_ptr< COFFVCRuntimeBootstrapper > > Create (ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer, const char *RuntimePath=nullptr)
 Try to create a COFFVCRuntimeBootstrapper instance.

Detailed Description

Bootstraps the vc runtime within jitdylibs.

Definition at line 32 of file COFFVCRuntimeSupport.h.

Member Function Documentation

◆ Create()

Expected< std::unique_ptr< COFFVCRuntimeBootstrapper > > COFFVCRuntimeBootstrapper::Create ( ExecutionSession & ES,
ObjectLinkingLayer & ObjLinkingLayer,
const char * RuntimePath = nullptr )
static

Try to create a COFFVCRuntimeBootstrapper instance.

An optional RuntimePath can be given to specify the location of directory that contains all vc runtime library files such as ucrt.lib and msvcrt.lib. If no path was given, it will try to search the MSVC toolchain and Windows SDK installation and use the found library files automatically.

Note that depending on the build setting, a different library file must be used. In general, if vc runtime was statically linked to the object file that is to be jit-linked, LoadStaticVCRuntime and InitializeStaticVCRuntime must be used with libcmt.lib, libucrt.lib, libvcruntimelib. If vc runtime was dynamically linked LoadDynamicVCRuntime must be used along with msvcrt.lib, ucrt.lib, vcruntime.lib.

More information is on: https://docs.microsoft.com/en-us/cpp/c-runtime-library/crt-library-features

Definition at line 24 of file COFFVCRuntimeSupport.cpp.

◆ initializeStaticVCRuntime()

Error COFFVCRuntimeBootstrapper::initializeStaticVCRuntime ( JITDylib & JD)

Runs the initializer of static version of msvc runtime libraries.

This must be called before calling any functions requiring c runtime (e.g. printf) within the jit session. Note that proper initialization of vc runtime requires ability of running static initializers. Cosider setting up COFFPlatform.

Definition at line 111 of file COFFVCRuntimeSupport.cpp.

References llvm::orc::JITDylib::define(), llvm::JITSymbolFlags::Exported, llvm::orc::lookupAndRecordAddrs(), llvm::orc::makeJITDylibSearchOrder(), llvm::orc::Static, llvm::Error::success(), and llvm::orc::symbolAliases().

◆ loadDynamicVCRuntime()

Expected< std::vector< std::string > > COFFVCRuntimeBootstrapper::loadDynamicVCRuntime ( JITDylib & JD,
bool DebugVersion = false )

Adds symbol definitions of dynamic version of msvc runtime libraries.

Definition at line 52 of file COFFVCRuntimeSupport.cpp.

References llvm::ArrayRef().

◆ loadStaticVCRuntime()

Expected< std::vector< std::string > > COFFVCRuntimeBootstrapper::loadStaticVCRuntime ( JITDylib & JD,
bool DebugVersion = false )

Adds symbol definitions of static version of msvc runtime libraries.

Definition at line 40 of file COFFVCRuntimeSupport.cpp.

References llvm::ArrayRef().


The documentation for this class was generated from the following files: