LLVM 19.0.0git
Classes | Public Member Functions | Static Public Member Functions | List of all members
llvm::orc::COFFVCRuntimeBootstrapper Class Reference

Bootstraps the vc runtime within jitdylibs. More...

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

Public Member Functions

Expected< std::vector< std::string > > loadStaticVCRuntime (JITDylib &JD, bool DebugVersion=false)
 Adds symbol definitions of static version of msvc runtime libraries.
 
Error initializeStaticVCRuntime (JITDylib &JD)
 Runs the initializer of static version of msvc runtime libraries.
 
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 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 31 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 23 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 109 of file COFFVCRuntimeSupport.cpp.

References Addr, llvm::orc::JITDylib::define(), llvm::JITSymbolFlags::Exported, llvm::orc::ExecutionSession::getExecutorProcessControl(), llvm::orc::ExecutionSession::intern(), llvm::orc::lookupAndRecordAddrs(), llvm::orc::makeJITDylibSearchOrder(), llvm::orc::ExecutorProcessControl::runAsIntFunction(), llvm::orc::ExecutorProcessControl::runAsVoidFunction(), 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 51 of file COFFVCRuntimeSupport.cpp.

◆ 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 39 of file COFFVCRuntimeSupport.cpp.


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