diff options
author | David Carlier <devnexen@gmail.com> | 2018-09-10 05:00:43 +0000 |
---|---|---|
committer | David Carlier <devnexen@gmail.com> | 2018-09-10 05:00:43 +0000 |
commit | 07cc5a8df9edd94de7390607b0664cf83820089a (patch) | |
tree | 120d2fac66d270be5bc4f78ba0ece329d82c14cb /llvm/lib/XRay/InstrumentationMap.cpp | |
parent | f3a3679e72617f7ae56780f25b6d0248b7665d38 (diff) | |
download | bcm5719-llvm-07cc5a8df9edd94de7390607b0664cf83820089a.tar.gz bcm5719-llvm-07cc5a8df9edd94de7390607b0664cf83820089a.zip |
[Xray] tooling allow MachO format support
Getting writable xray __DATA sections from MachO as well.
Reviewers: dberris
Reviewed By: dberris
Differential Revision: https://reviews.llvm.org/D51758
llvm-svn: 341772
Diffstat (limited to 'llvm/lib/XRay/InstrumentationMap.cpp')
-rw-r--r-- | llvm/lib/XRay/InstrumentationMap.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/XRay/InstrumentationMap.cpp b/llvm/lib/XRay/InstrumentationMap.cpp index a7d6600b0d8..84317708d3f 100644 --- a/llvm/lib/XRay/InstrumentationMap.cpp +++ b/llvm/lib/XRay/InstrumentationMap.cpp @@ -47,18 +47,18 @@ Optional<uint64_t> InstrumentationMap::getFunctionAddr(int32_t FuncId) const { } static Error -loadELF64(StringRef Filename, object::OwningBinary<object::ObjectFile> &ObjFile, +loadObj(StringRef Filename, object::OwningBinary<object::ObjectFile> &ObjFile, InstrumentationMap::SledContainer &Sleds, InstrumentationMap::FunctionAddressMap &FunctionAddresses, InstrumentationMap::FunctionAddressReverseMap &FunctionIds) { InstrumentationMap Map; // Find the section named "xray_instr_map". - if (!ObjFile.getBinary()->isELF() || + if ((!ObjFile.getBinary()->isELF() && !ObjFile.getBinary()->isMachO()) || !(ObjFile.getBinary()->getArch() == Triple::x86_64 || ObjFile.getBinary()->getArch() == Triple::ppc64le)) return make_error<StringError>( - "File format not supported (only does ELF little endian 64-bit).", + "File format not supported (only does ELF and Mach-O little endian 64-bit).", std::make_error_code(std::errc::not_supported)); StringRef Contents = ""; @@ -191,7 +191,7 @@ llvm::xray::loadInstrumentationMap(StringRef Filename) { if (auto E = loadYAML(Fd, FileSize, Filename, Map.Sleds, Map.FunctionAddresses, Map.FunctionIds)) return std::move(E); - } else if (auto E = loadELF64(Filename, *ObjectFileOrError, Map.Sleds, + } else if (auto E = loadObj(Filename, *ObjectFileOrError, Map.Sleds, Map.FunctionAddresses, Map.FunctionIds)) { return std::move(E); } |