LLVM  10.0.0svn
Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
llvm::orc::LocalCXXRuntimeOverridesBase Class Reference

Support class for static dtor execution. More...

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

Inheritance diagram for llvm::orc::LocalCXXRuntimeOverridesBase:
Inheritance graph
[legend]
Collaboration diagram for llvm::orc::LocalCXXRuntimeOverridesBase:
Collaboration graph
[legend]

Public Member Functions

void runDestructors ()
 Run any destructors recorded by the overriden __cxa_atexit function (CXAAtExitOverride). More...
 

Protected Types

using DestructorPtr = void(*)(void *)
 
using CXXDestructorDataPair = std::pair< DestructorPtr, void * >
 
using CXXDestructorDataPairList = std::vector< CXXDestructorDataPair >
 

Protected Member Functions

template<typename PtrTy >
JITTargetAddress toTargetAddress (PtrTy *P)
 

Static Protected Member Functions

static int CXAAtExitOverride (DestructorPtr Destructor, void *Arg, void *DSOHandle)
 

Protected Attributes

CXXDestructorDataPairList DSOHandleOverride
 

Detailed Description

Support class for static dtor execution.

For hosted (in-process) JITs only!

If a __cxa_atexit function isn't found C++ programs that use static destructors will fail to link. However, we don't want to use the host process's __cxa_atexit, because it will schedule JIT'd destructors to run after the JIT has been torn down, which is no good. This class makes it easy to override __cxa_atexit (and the related __dso_handle).

To use, clients should manually call searchOverrides from their symbol resolver. This should generally be done after attempting symbol resolution inside the JIT, but before searching the host process's symbol table. When the client determines that destructors should be run (generally at JIT teardown or after a return from main), the runDestructors method should be called.

Definition at line 175 of file ExecutionUtils.h.

Member Typedef Documentation

◆ CXXDestructorDataPair

Definition at line 187 of file ExecutionUtils.h.

◆ CXXDestructorDataPairList

Definition at line 188 of file ExecutionUtils.h.

◆ DestructorPtr

using llvm::orc::LocalCXXRuntimeOverridesBase::DestructorPtr = void (*)(void *)
protected

Definition at line 186 of file ExecutionUtils.h.

Member Function Documentation

◆ CXAAtExitOverride()

int llvm::orc::LocalCXXRuntimeOverridesBase::CXAAtExitOverride ( DestructorPtr  Destructor,
void *  Arg,
void *  DSOHandle 
)
staticprotected

Definition at line 155 of file ExecutionUtils.cpp.

◆ runDestructors()

void llvm::orc::LocalCXXRuntimeOverridesBase::runDestructors ( )

Run any destructors recorded by the overriden __cxa_atexit function (CXAAtExitOverride).

Definition at line 148 of file ExecutionUtils.cpp.

References P.

◆ toTargetAddress()

template<typename PtrTy >
JITTargetAddress llvm::orc::LocalCXXRuntimeOverridesBase::toTargetAddress ( PtrTy *  P)
inlineprotected

Definition at line 182 of file ExecutionUtils.h.

References P.

Member Data Documentation

◆ DSOHandleOverride

CXXDestructorDataPairList llvm::orc::LocalCXXRuntimeOverridesBase::DSOHandleOverride
protected

Definition at line 189 of file ExecutionUtils.h.


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