LLVM 20.0.0git
Public Member Functions | Protected Types | 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]

Public Member Functions

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

Protected Types

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

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 183 of file ExecutionUtils.h.

◆ CXXDestructorDataPairList

Definition at line 184 of file ExecutionUtils.h.

◆ DestructorPtr

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

Definition at line 182 of file ExecutionUtils.h.

Member Function Documentation

◆ CXAAtExitOverride()

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

Definition at line 177 of file ExecutionUtils.cpp.

Referenced by llvm::orc::LocalCXXRuntimeOverrides::enable().

◆ runDestructors()

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

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

Definition at line 170 of file ExecutionUtils.cpp.

References DSOHandleOverride, and P.

Member Data Documentation

◆ DSOHandleOverride

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

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