From ebe69fe11e48d322045d5949c83283927a0d790b Mon Sep 17 00:00:00 2001 From: Stephen Hines Date: Mon, 23 Mar 2015 12:10:34 -0700 Subject: Update aosp/master LLVM for rebase to r230699. Change-Id: I2b5be30509658cb8266be782de0ab24f9099f9b9 --- tools/llvm-rtdyld/Android.mk | 3 +- tools/llvm-rtdyld/CMakeLists.txt | 3 +- tools/llvm-rtdyld/Makefile | 2 +- tools/llvm-rtdyld/llvm-rtdyld.cpp | 62 ++++++++++++++++++++++++++------------- 4 files changed, 46 insertions(+), 24 deletions(-) (limited to 'tools/llvm-rtdyld') diff --git a/tools/llvm-rtdyld/Android.mk b/tools/llvm-rtdyld/Android.mk index 4f4fb4c..853c71a 100644 --- a/tools/llvm-rtdyld/Android.mk +++ b/tools/llvm-rtdyld/Android.mk @@ -37,7 +37,8 @@ llvm_rtdyld_STATIC_LIBRARIES := \ libLLVMX86AsmParser \ libLLVMX86Utils \ libLLVMX86Disassembler \ - libLLVMDebugInfo \ + libLLVMDebugInfoDWARF \ + libLLVMDebugInfoPDB \ libLLVMExecutionEngine \ libLLVMCodeGen \ libLLVMObject \ diff --git a/tools/llvm-rtdyld/CMakeLists.txt b/tools/llvm-rtdyld/CMakeLists.txt index feb2134..c1acbe5 100644 --- a/tools/llvm-rtdyld/CMakeLists.txt +++ b/tools/llvm-rtdyld/CMakeLists.txt @@ -1,8 +1,9 @@ set(LLVM_LINK_COMPONENTS ${LLVM_TARGETS_TO_BUILD} - DebugInfo + DebugInfoDWARF ExecutionEngine MC + Object RuntimeDyld Support ) diff --git a/tools/llvm-rtdyld/Makefile b/tools/llvm-rtdyld/Makefile index 9de753e..3e868b9 100644 --- a/tools/llvm-rtdyld/Makefile +++ b/tools/llvm-rtdyld/Makefile @@ -9,7 +9,7 @@ LEVEL := ../.. TOOLNAME := llvm-rtdyld -LINK_COMPONENTS := all-targets support MC object RuntimeDyld MCJIT debuginfo +LINK_COMPONENTS := all-targets support MC object RuntimeDyld MCJIT DebugInfoDWARF # This tool has no plugins, optimize startup time. TOOL_NO_EXPORTS := 1 diff --git a/tools/llvm-rtdyld/llvm-rtdyld.cpp b/tools/llvm-rtdyld/llvm-rtdyld.cpp index 87d381e..58bf206 100644 --- a/tools/llvm-rtdyld/llvm-rtdyld.cpp +++ b/tools/llvm-rtdyld/llvm-rtdyld.cpp @@ -12,16 +12,14 @@ //===----------------------------------------------------------------------===// #include "llvm/ADT/StringMap.h" -#include "llvm/DebugInfo/DIContext.h" -#include "llvm/ExecutionEngine/ObjectBuffer.h" -#include "llvm/ExecutionEngine/ObjectImage.h" +#include "llvm/DebugInfo/DWARF/DIContext.h" #include "llvm/ExecutionEngine/RuntimeDyld.h" #include "llvm/ExecutionEngine/RuntimeDyldChecker.h" #include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCDisassembler.h" -#include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCInstPrinter.h" +#include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCRegisterInfo.h" #include "llvm/Object/MachO.h" #include "llvm/Support/CommandLine.h" @@ -30,10 +28,10 @@ #include "llvm/Support/Memory.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/PrettyStackTrace.h" -#include "llvm/Support/raw_ostream.h" #include "llvm/Support/Signals.h" #include "llvm/Support/TargetRegistry.h" #include "llvm/Support/TargetSelect.h" +#include "llvm/Support/raw_ostream.h" #include #include @@ -207,23 +205,32 @@ static int printLineInfoForInput() { if (std::error_code EC = InputBuffer.getError()) return Error("unable to read input: '" + EC.message() + "'"); - std::unique_ptr LoadedObject; + ErrorOr> MaybeObj( + ObjectFile::createObjectFile((*InputBuffer)->getMemBufferRef())); + + if (std::error_code EC = MaybeObj.getError()) + return Error("unable to create object file: '" + EC.message() + "'"); + + ObjectFile &Obj = **MaybeObj; + // Load the object file - LoadedObject = Dyld.loadObject( - llvm::make_unique(std::move(*InputBuffer))); - if (!LoadedObject) { + std::unique_ptr LoadedObjInfo = + Dyld.loadObject(Obj); + + if (Dyld.hasError()) return Error(Dyld.getErrorString()); - } // Resolve all the relocations we can. Dyld.resolveRelocations(); + OwningBinary DebugObj = LoadedObjInfo->getObjectForDebug(Obj); + std::unique_ptr Context( - DIContext::getDWARFContext(*LoadedObject->getObjectFile())); + DIContext::getDWARFContext(*DebugObj.getBinary())); // Use symbol info to iterate functions in the object. - for (object::symbol_iterator I = LoadedObject->begin_symbols(), - E = LoadedObject->end_symbols(); + for (object::symbol_iterator I = DebugObj.getBinary()->symbol_begin(), + E = DebugObj.getBinary()->symbol_end(); I != E; ++I) { object::SymbolRef::Type SymType; if (I->getType(SymType)) continue; @@ -268,11 +275,17 @@ static int executeInput() { MemoryBuffer::getFileOrSTDIN(InputFileList[i]); if (std::error_code EC = InputBuffer.getError()) return Error("unable to read input: '" + EC.message() + "'"); - std::unique_ptr LoadedObject; + ErrorOr> MaybeObj( + ObjectFile::createObjectFile((*InputBuffer)->getMemBufferRef())); + + if (std::error_code EC = MaybeObj.getError()) + return Error("unable to create object file: '" + EC.message() + "'"); + + ObjectFile &Obj = **MaybeObj; + // Load the object file - LoadedObject = Dyld.loadObject( - llvm::make_unique(std::move(*InputBuffer))); - if (!LoadedObject) { + Dyld.loadObject(Obj); + if (Dyld.hasError()) { return Error(Dyld.getErrorString()); } } @@ -512,14 +525,21 @@ static int linkAndVerify() { // Load the input memory buffer. ErrorOr> InputBuffer = MemoryBuffer::getFileOrSTDIN(InputFileList[i]); + if (std::error_code EC = InputBuffer.getError()) return Error("unable to read input: '" + EC.message() + "'"); - std::unique_ptr LoadedObject; + ErrorOr> MaybeObj( + ObjectFile::createObjectFile((*InputBuffer)->getMemBufferRef())); + + if (std::error_code EC = MaybeObj.getError()) + return Error("unable to create object file: '" + EC.message() + "'"); + + ObjectFile &Obj = **MaybeObj; + // Load the object file - LoadedObject = Dyld.loadObject( - llvm::make_unique(std::move(*InputBuffer))); - if (!LoadedObject) { + Dyld.loadObject(Obj); + if (Dyld.hasError()) { return Error(Dyld.getErrorString()); } } -- cgit v1.1