summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2014-01-08 04:09:09 +0000
committerLang Hames <lhames@gmail.com>2014-01-08 04:09:09 +0000
commit42fdb1f00ffc5d0a0326f11cadaeec1c26691688 (patch)
tree5294abeb5fb8c95d81ced305ed1a9d5d0ba7849b /include
parent0fe78d5669e37cf9c5b613ef56b4e5a2de975271 (diff)
downloadllvm-42fdb1f00ffc5d0a0326f11cadaeec1c26691688.tar.gz
llvm-42fdb1f00ffc5d0a0326f11cadaeec1c26691688.tar.bz2
llvm-42fdb1f00ffc5d0a0326f11cadaeec1c26691688.tar.xz
Re-apply r196639: Add support for archives and object file caching under MCJIT.
I believe the bot failures on linux systems were due to overestimating the alignment of object-files within archives, which are only guaranteed to be two-byte aligned. I have reduced the alignment in RuntimeDyldELF::createObjectImageFromFile accordingly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198737 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/ExecutionEngine/ExecutionEngine.h32
-rw-r--r--include/llvm/ExecutionEngine/RuntimeDyld.h10
2 files changed, 42 insertions, 0 deletions
diff --git a/include/llvm/ExecutionEngine/ExecutionEngine.h b/include/llvm/ExecutionEngine/ExecutionEngine.h
index ee43cbcf0e..199cf8deb8 100644
--- a/include/llvm/ExecutionEngine/ExecutionEngine.h
+++ b/include/llvm/ExecutionEngine/ExecutionEngine.h
@@ -48,6 +48,11 @@ class RTDyldMemoryManager;
class Triple;
class Type;
+namespace object {
+ class Archive;
+ class ObjectFile;
+}
+
/// \brief Helper class for helping synchronize access to the global address map
/// table.
class ExecutionEngineState {
@@ -204,6 +209,33 @@ public:
Modules.push_back(M);
}
+ /// addObjectFile - Add an ObjectFile to the execution engine.
+ ///
+ /// This method is only supported by MCJIT. MCJIT will immediately load the
+ /// object into memory and adds its symbols to the list used to resolve
+ /// external symbols while preparing other objects for execution.
+ ///
+ /// Objects added using this function will not be made executable until
+ /// needed by another object.
+ ///
+ /// MCJIT will take ownership of the ObjectFile.
+ virtual void addObjectFile(object::ObjectFile *O) {
+ llvm_unreachable(
+ "ExecutionEngine subclass doesn't implement addObjectFile.");
+ }
+
+ /// addArchive - Add an Archive to the execution engine.
+ ///
+ /// This method is only supported by MCJIT. MCJIT will use the archive to
+ /// resolve external symbols in objects it is loading. If a symbol is found
+ /// in the Archive the contained object file will be extracted (in memory)
+ /// and loaded for possible execution.
+ ///
+ /// MCJIT will take ownership of the Archive.
+ virtual void addArchive(object::Archive *A) {
+ llvm_unreachable("ExecutionEngine subclass doesn't implement addArchive.");
+ }
+
//===--------------------------------------------------------------------===//
const DataLayout *getDataLayout() const { return TD; }
diff --git a/include/llvm/ExecutionEngine/RuntimeDyld.h b/include/llvm/ExecutionEngine/RuntimeDyld.h
index b8324387bb..fd9f338669 100644
--- a/include/llvm/ExecutionEngine/RuntimeDyld.h
+++ b/include/llvm/ExecutionEngine/RuntimeDyld.h
@@ -21,6 +21,10 @@
namespace llvm {
+namespace object {
+ class ObjectFile;
+}
+
class RuntimeDyldImpl;
class ObjectImage;
@@ -46,6 +50,12 @@ public:
/// failure, the input buffer will be deleted.
ObjectImage *loadObject(ObjectBuffer *InputBuffer);
+ /// Prepare the referenced object file for execution.
+ /// Ownership of the input object is transferred to the ObjectImage
+ /// instance returned from this function if successful. In the case of load
+ /// failure, the input object will be deleted.
+ ObjectImage *loadObject(object::ObjectFile *InputObject);
+
/// Get the address of our local copy of the symbol. This may or may not
/// be the address used for relocation (clients can copy the data around
/// and resolve relocatons based on where they put it).