Adding support and tests for multiple module handling in lli
[oota-llvm.git] / include / llvm / ExecutionEngine / RTDyldMemoryManager.h
index 59326875850d66e838dc3e8847a0e209a2570593..09a5cb4884082b10bbf17586bed720f96879d5b3 100644 (file)
@@ -21,6 +21,9 @@
 
 namespace llvm {
 
+class ExecutionEngine;
+class ObjectImage;
+
 // RuntimeDyld clients often want to handle the memory management of
 // what gets placed where. For JIT clients, this is the subset of
 // JITMemoryManager required for dynamic loading of binaries.
@@ -41,7 +44,7 @@ public:
   virtual uint8_t *allocateCodeSection(
     uintptr_t Size, unsigned Alignment, unsigned SectionID,
     StringRef SectionName) = 0;
-  
+
   /// Allocate a memory block of (at least) the given size suitable for data.
   /// The SectionID is a unique identifier assigned by the JIT engine, and
   /// optionally recorded by the memory manager to access a loaded section.
@@ -63,11 +66,24 @@ public:
   /// found, this function returns a null pointer. Otherwise, it prints a
   /// message to stderr and aborts.
   ///
-  /// This function is deprecated for memory managers used to be used with
+  /// This function is deprecated for memory managers to be used with
   /// MCJIT or RuntimeDyld.  Use getSymbolAddress instead.
   virtual void *getPointerToNamedFunction(const std::string &Name,
                                           bool AbortOnFailure = true);
 
+  /// 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
+  /// object that is being finalized.  In that case, the object about which
+  /// the memory manager is being notified will be finalized immediately after
+  /// the memory manager returns from this call.
+  ///
+  /// 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.
+  virtual void notifyObjectLoaded(ExecutionEngine *EE,
+                                  const ObjectImage *) {}
+
   /// This method is called when object loading is complete and section page
   /// permissions can be applied.  It is up to the memory manager implementation
   /// to decide whether or not to act on this method.  The memory manager will