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
This commit is contained in:
Lang Hames
2014-01-08 04:09:09 +00:00
parent 0fe78d5669
commit 42fdb1f00f
12 changed files with 314 additions and 10 deletions

View File

@ -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; }