LLVM  6.0.0svn
Classes | Public Types | Public Member Functions | List of all members
llvm::orc::RTDyldObjectLinkingLayer Class Reference

Bare bones object linking layer. More...

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

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

Public Types

using NotifyLoadedFtor = std::function< void(ObjHandleT, const ObjectPtr &Obj, const RuntimeDyld::LoadedObjectInfo &)>
 Functor for receiving object-loaded notifications. More...
 
using NotifyFinalizedFtor = std::function< void(ObjHandleT)>
 Functor for receiving finalization notifications. More...
 
using MemoryManagerGetter = std::function< std::shared_ptr< RuntimeDyld::MemoryManager >()>
 Functor for creating memory managers. More...
 
using ObjectPtr = std::shared_ptr< object::OwningBinary< object::ObjectFile > >
 
- Public Types inherited from llvm::orc::RTDyldObjectLinkingLayerBase
using ObjectPtr = std::shared_ptr< object::OwningBinary< object::ObjectFile > >
 
using ObjHandleT = LinkedObjectListT::iterator
 Handle to a loaded object. More...
 

Public Member Functions

 RTDyldObjectLinkingLayer (MemoryManagerGetter GetMemMgr, NotifyLoadedFtor NotifyLoaded=NotifyLoadedFtor(), NotifyFinalizedFtor NotifyFinalized=NotifyFinalizedFtor())
 Construct an ObjectLinkingLayer with the given NotifyLoaded, and NotifyFinalized functors. More...
 
void setProcessAllSections (bool ProcessAllSections)
 Set the 'ProcessAllSections' flag. More...
 
Expected< ObjHandleTaddObject (ObjectPtr Obj, std::shared_ptr< JITSymbolResolver > Resolver)
 Add an object to the JIT. More...
 
Error removeObject (ObjHandleT H)
 Remove the object associated with handle H. More...
 
JITSymbol findSymbol (StringRef Name, bool ExportedSymbolsOnly)
 Search for the given named symbol. More...
 
JITSymbol findSymbolIn (ObjHandleT H, StringRef Name, bool ExportedSymbolsOnly)
 Search for the given named symbol in the context of the loaded object represented by the handle H. More...
 
void mapSectionAddress (ObjHandleT H, const void *LocalAddress, JITTargetAddress TargetAddr)
 Map section addresses for the object associated with the handle H. More...
 
Error emitAndFinalize (ObjHandleT H)
 Immediately emit and finalize the object represented by the given handle. More...
 

Additional Inherited Members

- Protected Types inherited from llvm::orc::RTDyldObjectLinkingLayerBase
using LinkedObjectListT = std::list< std::unique_ptr< LinkedObject > >
 

Detailed Description

Bare bones object linking layer.

This class is intended to be used as the base layer for a JIT. It allows object files to be loaded into memory, linked, and the addresses of their symbols queried. All objects added to this layer can see each other's symbols.

Definition at line 96 of file RTDyldObjectLinkingLayer.h.

Member Typedef Documentation

◆ MemoryManagerGetter

Functor for creating memory managers.

Definition at line 234 of file RTDyldObjectLinkingLayer.h.

◆ NotifyFinalizedFtor

Functor for receiving finalization notifications.

Definition at line 107 of file RTDyldObjectLinkingLayer.h.

◆ NotifyLoadedFtor

Functor for receiving object-loaded notifications.

Definition at line 104 of file RTDyldObjectLinkingLayer.h.

◆ ObjectPtr

Definition at line 40 of file RTDyldObjectLinkingLayer.h.

Constructor & Destructor Documentation

◆ RTDyldObjectLinkingLayer()

llvm::orc::RTDyldObjectLinkingLayer::RTDyldObjectLinkingLayer ( MemoryManagerGetter  GetMemMgr,
NotifyLoadedFtor  NotifyLoaded = NotifyLoadedFtor(),
NotifyFinalizedFtor  NotifyFinalized = NotifyFinalizedFtor() 
)
inline

Construct an ObjectLinkingLayer with the given NotifyLoaded, and NotifyFinalized functors.

Definition at line 238 of file RTDyldObjectLinkingLayer.h.

Member Function Documentation

◆ addObject()

Expected<ObjHandleT> llvm::orc::RTDyldObjectLinkingLayer::addObject ( ObjectPtr  Obj,
std::shared_ptr< JITSymbolResolver Resolver 
)
inline

Add an object to the JIT.

Returns
A handle that can be used to refer to the loaded object (for symbol searching, finalization, freeing memory, etc.).

Definition at line 261 of file RTDyldObjectLinkingLayer.h.

References H, and llvm::AArch64CC::LO.

◆ emitAndFinalize()

Error llvm::orc::RTDyldObjectLinkingLayer::emitAndFinalize ( ObjHandleT  H)
inline

Immediately emit and finalize the object represented by the given handle.

Parameters
HHandle for object to emit/finalize.

Definition at line 342 of file RTDyldObjectLinkingLayer.h.

References llvm::Error::success().

◆ findSymbol()

JITSymbol llvm::orc::RTDyldObjectLinkingLayer::findSymbol ( StringRef  Name,
bool  ExportedSymbolsOnly 
)
inline

Search for the given named symbol.

Parameters
NameThe name of the symbol to search for.
ExportedSymbolsOnlyIf true, search only for exported symbols.
Returns
A handle for the given named symbol, if it exists.

Definition at line 312 of file RTDyldObjectLinkingLayer.h.

References E, I, and llvm::ARMBuildAttrs::Symbol.

◆ findSymbolIn()

JITSymbol llvm::orc::RTDyldObjectLinkingLayer::findSymbolIn ( ObjHandleT  H,
StringRef  Name,
bool  ExportedSymbolsOnly 
)
inline

Search for the given named symbol in the context of the loaded object represented by the handle H.

Parameters
HThe handle for the object to search in.
NameThe name of the symbol to search for.
ExportedSymbolsOnlyIf true, search only for exported symbols.
Returns
A handle for the given named symbol, if it is found in the given object.

Definition at line 328 of file RTDyldObjectLinkingLayer.h.

◆ mapSectionAddress()

void llvm::orc::RTDyldObjectLinkingLayer::mapSectionAddress ( ObjHandleT  H,
const void *  LocalAddress,
JITTargetAddress  TargetAddr 
)
inline

Map section addresses for the object associated with the handle H.

Definition at line 334 of file RTDyldObjectLinkingLayer.h.

◆ removeObject()

Error llvm::orc::RTDyldObjectLinkingLayer::removeObject ( ObjHandleT  H)
inline

Remove the object associated with handle H.

All memory allocated for the object will be freed, and the sections and symbols it provided will no longer be available. No attempt is made to re-emit the missing symbols, and any use of these symbols (directly or indirectly) will result in undefined behavior. If dependence tracking is required to detect or resolve such issues it should be added at a higher layer.

Definition at line 302 of file RTDyldObjectLinkingLayer.h.

References llvm::Error::success().

◆ setProcessAllSections()

void llvm::orc::RTDyldObjectLinkingLayer::setProcessAllSections ( bool  ProcessAllSections)
inline

Set the 'ProcessAllSections' flag.

If set to true, all sections in each object file will be allocated using the memory manager, rather than just the sections required for execution.

This is kludgy, and may be removed in the future.

Definition at line 253 of file RTDyldObjectLinkingLayer.h.


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