13#ifndef LLVM_EXECUTIONENGINE_ORC_EXECUTIONUTILS_H
14#define LLVM_EXECUTIONENGINE_ORC_EXECUTIONUTILS_H
40class MachOUniversalBinary;
107 : I(M.global_values().begin()), E(M.global_values().end()),
108 ObjFmt(M.getTargetTriple().getObjectFormat()) {
110 if (!isStaticInitGlobal(*I))
111 moveToNextStaticInitGlobal();
120 assert(I != E &&
"Increment past end of range");
121 moveToNextStaticInitGlobal();
129 void moveToNextStaticInitGlobal() {
131 while (I != E && !isStaticInitGlobal(*I))
154 using CtorDtorList = std::vector<SymbolStringPtr>;
155 using CtorDtorPriorityMap = std::map<unsigned, CtorDtorList>;
158 CtorDtorPriorityMap CtorDtorsByPriority;
208 std::mutex AtExitsMutex;
251 std::move(AddAbsoluteSymbols));
260 SymbolPredicate Allow;
261 AddAbsoluteSymbolsFn AddAbsoluteSymbols;
301 static std::unique_ptr<MemoryBuffer>
317 Create(
ObjectLayer &L, std::unique_ptr<MemoryBuffer> ArchiveBuffer,
318 std::unique_ptr<object::Archive> Archive,
330 Create(
ObjectLayer &L, std::unique_ptr<MemoryBuffer> ArchiveBuffer,
340 ObjectLayer &L, std::unique_ptr<MemoryBuffer> ArchiveBuffer,
341 std::unique_ptr<object::Archive> Archive,
347 std::unique_ptr<MemoryBuffer> ArchiveBuffer;
348 std::unique_ptr<object::Archive>
Archive;
362 static std::unique_ptr<DLLImportDefinitionGenerator>
378 static StringRef getImpPrefix() {
return "__imp_"; }
380 static StringRef getSectionName() {
return "$__DLLIMPORT_STUBS"; }
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
Machine Check Debug Module
ConstantArray - Constant Array Declarations.
Lightweight error class with error context and mandatory checking.
Tagged union holding either a T or a Error.
A Module instance is used to store all the information related to an LLVM module.
concat_iterator< GlobalValue, iterator, global_iterator, alias_iterator, ifunc_iterator > global_value_iterator
StringRef - Represent a constant reference to a string, i.e.
Triple - Helper class for working with autoconf configuration names.
LLVM Value Representation.
A range adaptor for a pair of iterators.
This iterator provides a convenient way to iterate over the elements of an llvm.global_ctors/llvm....
LLVM_ABI bool operator!=(const CtorDtorIterator &Other) const
Test iterators for inequality.
LLVM_ABI Element operator*() const
Dereference iterator.
LLVM_ABI CtorDtorIterator & operator++()
Pre-increment iterator.
LLVM_ABI bool operator==(const CtorDtorIterator &Other) const
Test iterators for equality.
CtorDtorRunner(JITDylib &JD)
LLVM_ABI void add(iterator_range< CtorDtorIterator > CtorDtors)
A utility class to create COFF dllimport GOT symbols (__imp_*) and PLT stubs.
Definition generators can be attached to JITDylibs to generate new definitions for otherwise unresolv...
A utility class to expose symbols found via dlsym to the JIT.
std::function< bool(const SymbolStringPtr &)> SymbolPredicate
static Expected< std::unique_ptr< DynamicLibrarySearchGenerator > > GetForCurrentProcess(char GlobalPrefix, SymbolPredicate Allow=SymbolPredicate(), AddAbsoluteSymbolsFn AddAbsoluteSymbols=nullptr)
Creates a DynamicLibrarySearchGenerator that searches for symbols in the current process.
An ExecutionSession represents a running JIT program.
An interface for Itanium __cxa_atexit interposer implementations.
LLVM_ABI void runAtExits(void *DSOHandle)
LLVM_ABI void registerAtExit(void(*F)(void *), void *Ctx, void *DSOHandle)
Represents a JIT'd dynamic library.
Support class for static dtor execution.
void(*)(void *) DestructorPtr
static LLVM_ABI int CXAAtExitOverride(DestructorPtr Destructor, void *Arg, void *DSOHandle)
std::vector< CXXDestructorDataPair > CXXDestructorDataPairList
CXXDestructorDataPairList DSOHandleOverride
std::pair< DestructorPtr, void * > CXXDestructorDataPair
LLVM_ABI void runDestructors()
Run any destructors recorded by the overriden __cxa_atexit function (CXAAtExitOverride).
LLVM_ABI Error enable(JITDylib &JD, MangleAndInterner &Mangler)
Wraps state for a lookup-in-progress.
Mangles symbol names then uniques them in the context of an ExecutionSession.
Interface for Layers that accept object files.
An ObjectLayer implementation built on JITLink.
This iterator provides a convenient way to iterate over GlobalValues that have initialization effects...
StaticInitGVIterator()=default
GlobalValue & operator*()
StaticInitGVIterator & operator++()
bool operator!=(const StaticInitGVIterator &O) const
bool operator==(const StaticInitGVIterator &O) const
StaticInitGVIterator(Module &M)
A utility class to expose symbols from a static library.
A set of symbols to look up, each associated with a SymbolLookupFlags value.
Pointer to a pooled string representing a symbol name.
This class provides a portable interface to dynamic libraries which also might be known as shared lib...
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
LLVM_ABI iterator_range< CtorDtorIterator > getDestructors(const Module &M)
Create an iterator range over the entries of the llvm.global_ctors array.
iterator_range< StaticInitGVIterator > getStaticInitGVs(Module &M)
Create an iterator range over the GlobalValues that contribute to static initialization.
LLVM_ABI iterator_range< CtorDtorIterator > getConstructors(const Module &M)
Create an iterator range over the entries of the llvm.global_ctors array.
JITDylibLookupFlags
Lookup flags that apply to each dylib in the search order for a lookup.
LookupKind
Describes the kind of lookup being performed.
@ Resolved
Queried, materialization begun.
This is an optimization pass for GlobalISel generic memory operations.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
Accessor for an element of the global_ctors/global_dtors array.
Element(unsigned Priority, Function *Func, Value *Data)