LLVM  7.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]

Classes

struct  Resources
 

Public Types

using NotifyLoadedFtor = std::function< void(VModuleKey, const ObjectPtr &Obj, const RuntimeDyld::LoadedObjectInfo &)>
 Functor for receiving object-loaded notifications. More...
 
using NotifyFinalizedFtor = std::function< void(VModuleKey)>
 Functor for receiving finalization notifications. More...
 
using ResourcesGetter = std::function< Resources(VModuleKey)>
 
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 > >
 

Public Member Functions

 RTDyldObjectLinkingLayer (ExecutionSession &ES, ResourcesGetter GetResources, 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...
 
Error addObject (VModuleKey K, ObjectPtr Obj)
 Add an object to the JIT. More...
 
Error removeObject (VModuleKey K)
 Remove the object associated with VModuleKey K. More...
 
JITSymbol findSymbol (StringRef Name, bool ExportedSymbolsOnly)
 Search for the given named symbol. More...
 
JITSymbol findSymbolIn (VModuleKey K, StringRef Name, bool ExportedSymbolsOnly)
 Search for the given named symbol in the context of the loaded object represented by the VModuleKey K. More...
 
void mapSectionAddress (VModuleKey K, const void *LocalAddress, JITTargetAddress TargetAddr)
 Map section addresses for the object associated with the VModuleKey K. More...
 
Error emitAndFinalize (VModuleKey K)
 Immediately emit and finalize the object represented by the given VModuleKey. More...
 

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 92 of file RTDyldObjectLinkingLayer.h.

Member Typedef Documentation

◆ NotifyFinalizedFtor

Functor for receiving finalization notifications.

Definition at line 102 of file RTDyldObjectLinkingLayer.h.

◆ NotifyLoadedFtor

Functor for receiving object-loaded notifications.

Definition at line 99 of file RTDyldObjectLinkingLayer.h.

◆ ObjectPtr

Definition at line 42 of file RTDyldObjectLinkingLayer.h.

◆ ResourcesGetter

Definition at line 221 of file RTDyldObjectLinkingLayer.h.

Constructor & Destructor Documentation

◆ RTDyldObjectLinkingLayer()

llvm::orc::RTDyldObjectLinkingLayer::RTDyldObjectLinkingLayer ( ExecutionSession ES,
ResourcesGetter  GetResources,
NotifyLoadedFtor  NotifyLoaded = NotifyLoadedFtor(),
NotifyFinalizedFtor  NotifyFinalized = NotifyFinalizedFtor() 
)
inline

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

Definition at line 225 of file RTDyldObjectLinkingLayer.h.

Member Function Documentation

◆ addObject()

Error llvm::orc::RTDyldObjectLinkingLayer::addObject ( VModuleKey  K,
ObjectPtr  Obj 
)
inline

◆ emitAndFinalize()

Error llvm::orc::RTDyldObjectLinkingLayer::emitAndFinalize ( VModuleKey  K)
inline

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

Parameters
KVModuleKey for object to emit/finalize.

Definition at line 332 of file RTDyldObjectLinkingLayer.h.

References assert().

◆ 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 298 of file RTDyldObjectLinkingLayer.h.

◆ findSymbolIn()

JITSymbol llvm::orc::RTDyldObjectLinkingLayer::findSymbolIn ( VModuleKey  K,
StringRef  Name,
bool  ExportedSymbolsOnly 
)
inline

Search for the given named symbol in the context of the loaded object represented by the VModuleKey K.

Parameters
KThe VModuleKey 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 315 of file RTDyldObjectLinkingLayer.h.

References assert().

◆ mapSectionAddress()

void llvm::orc::RTDyldObjectLinkingLayer::mapSectionAddress ( VModuleKey  K,
const void *  LocalAddress,
JITTargetAddress  TargetAddr 
)
inline

Map section addresses for the object associated with the VModuleKey K.

Definition at line 323 of file RTDyldObjectLinkingLayer.h.

References assert().

◆ removeObject()

Error llvm::orc::RTDyldObjectLinkingLayer::removeObject ( VModuleKey  K)
inline

Remove the object associated with VModuleKey K.

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 287 of file RTDyldObjectLinkingLayer.h.

References assert(), and 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 240 of file RTDyldObjectLinkingLayer.h.


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