diff options
author | Andrew Kaylor <andrew.kaylor@intel.com> | 2012-10-02 21:18:39 +0000 |
---|---|---|
committer | Andrew Kaylor <andrew.kaylor@intel.com> | 2012-10-02 21:18:39 +0000 |
commit | 3f23cef24fc9200def464bd4bce820678b5715de (patch) | |
tree | 9d7bd6501c9cda8d5e32fff4b4c8359b66173c77 /tools | |
parent | 9fd304672cec6cd31b1978408a0a0dc375f96969 (diff) | |
download | external_llvm-3f23cef24fc9200def464bd4bce820678b5715de.zip external_llvm-3f23cef24fc9200def464bd4bce820678b5715de.tar.gz external_llvm-3f23cef24fc9200def464bd4bce820678b5715de.tar.bz2 |
Clean-up of memory buffer and object ownership model in MCJIT
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165053 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/llvm-rtdyld/llvm-rtdyld.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/llvm-rtdyld/llvm-rtdyld.cpp b/tools/llvm-rtdyld/llvm-rtdyld.cpp index 95de8d8..7b5bd03 100644 --- a/tools/llvm-rtdyld/llvm-rtdyld.cpp +++ b/tools/llvm-rtdyld/llvm-rtdyld.cpp @@ -14,6 +14,8 @@ #include "llvm/ADT/StringMap.h" #include "llvm/ADT/OwningPtr.h" #include "llvm/ExecutionEngine/RuntimeDyld.h" +#include "llvm/ExecutionEngine/ObjectImage.h" +#include "llvm/ExecutionEngine/ObjectBuffer.h" #include "llvm/Object/MachOObject.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ManagedStatic.h" @@ -120,12 +122,14 @@ static int executeInput() { for(unsigned i = 0, e = InputFileList.size(); i != e; ++i) { // Load the input memory buffer. OwningPtr<MemoryBuffer> InputBuffer; + OwningPtr<ObjectImage> LoadedObject; if (error_code ec = MemoryBuffer::getFileOrSTDIN(InputFileList[i], InputBuffer)) return Error("unable to read input: '" + ec.message() + "'"); - // Load the object file into it. - if (Dyld.loadObject(InputBuffer.take())) { + // Load the object file + LoadedObject.reset(Dyld.loadObject(new ObjectBuffer(InputBuffer.take()))); + if (!LoadedObject) { return Error(Dyld.getErrorString()); } } |