forked from OSchip/llvm-project
[RuntimeDyld] Add a notifyObjectLoaded method to RuntimeDyld::MemoryManager.
This is a more generic version of the MCJITMemoryManager::notifyObjectLoaded method: It provides only a RuntimeDyld reference (rather than an ExecutionEngine), and so can be used with ORC JIT stacks. llvm-svn: 257296
This commit is contained in:
parent
8a5bdb5dce
commit
b0934294b2
|
@ -30,6 +30,10 @@ class ExecutionEngine;
|
|||
|
||||
class MCJITMemoryManager : public RuntimeDyld::MemoryManager {
|
||||
public:
|
||||
|
||||
// Don't hide the notifyObjectLoaded method from RuntimeDyld::MemoryManager.
|
||||
using RuntimeDyld::MemoryManager::notifyObjectLoaded;
|
||||
|
||||
/// This method is called after an object has been loaded into memory but
|
||||
/// before relocations are applied to the loaded sections. The object load
|
||||
/// may have been initiated by MCJIT to resolve an external symbol for another
|
||||
|
|
|
@ -155,6 +155,20 @@ public:
|
|||
/// Returns true if an error occurred, false otherwise.
|
||||
virtual bool finalizeMemory(std::string *ErrMsg = nullptr) = 0;
|
||||
|
||||
/// This method is called after an object has been loaded into memory but
|
||||
/// before relocations are applied to the loaded sections.
|
||||
///
|
||||
/// Memory managers which are preparing code for execution in an external
|
||||
/// address space can use this call to remap the section addresses for the
|
||||
/// newly loaded object.
|
||||
///
|
||||
/// For clients that do not need access to an ExecutionEngine instance this
|
||||
/// method should be preferred to its cousin
|
||||
/// MCJITMemoryManager::notifyObjectLoaded as this method is compatible with
|
||||
/// ORC JIT stacks.
|
||||
virtual void notifyObjectLoaded(RuntimeDyld &RTDyld,
|
||||
const object::ObjectFile &Obj) {}
|
||||
|
||||
private:
|
||||
virtual void anchor();
|
||||
bool FinalizationLocked;
|
||||
|
|
|
@ -940,7 +940,9 @@ RuntimeDyld::loadObject(const ObjectFile &Obj) {
|
|||
if (!Dyld->isCompatibleFile(Obj))
|
||||
report_fatal_error("Incompatible object format!");
|
||||
|
||||
return Dyld->loadObject(Obj);
|
||||
auto LoadedObjInfo = Dyld->loadObject(Obj);
|
||||
MemMgr.notifyObjectLoaded(*this, Obj);
|
||||
return LoadedObjInfo;
|
||||
}
|
||||
|
||||
void *RuntimeDyld::getSymbolLocalAddress(StringRef Name) const {
|
||||
|
|
Loading…
Reference in New Issue