LLVM  7.0.0svn
Public Member Functions | List of all members
llvm::orc::LocalCXXRuntimeOverrides Class Reference

Support class for static dtor execution. More...

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

Public Member Functions

template<typename MangleFtorT >
 LocalCXXRuntimeOverrides (const MangleFtorT &Mangle)
 Create a runtime-overrides class. More...
JITEvaluatedSymbol searchOverrides (const std::string &Name)
 Search overrided symbols. More...
void runDestructors ()
 Run any destructors recorded by the overriden __cxa_atexit function (CXAAtExitOverride). More...

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

Constructor & Destructor Documentation

◆ LocalCXXRuntimeOverrides()

template<typename MangleFtorT >
llvm::orc::LocalCXXRuntimeOverrides::LocalCXXRuntimeOverrides ( const MangleFtorT &  Mangle)

Create a runtime-overrides class.

Definition at line 149 of file ExecutionUtils.h.

Member Function Documentation

◆ runDestructors()

void llvm::orc::LocalCXXRuntimeOverrides::runDestructors ( )

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

Definition at line 86 of file ExecutionUtils.cpp.

References Arg, and P.

◆ searchOverrides()

JITEvaluatedSymbol llvm::orc::LocalCXXRuntimeOverrides::searchOverrides ( const std::string &  Name)

Search overrided symbols.

Definition at line 155 of file ExecutionUtils.h.

References Arg, llvm::JITSymbolFlags::Exported, I, and P.

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