aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-objdump/llvm-objdump.cpp
diff options
context:
space:
mode:
authorAiden Grossman <agrossman154@yahoo.com>2023-02-25 10:18:57 +0000
committerAiden Grossman <agrossman154@yahoo.com>2023-03-13 21:29:48 +0000
commit175aa049c7c1a319289a27aca538e9ba59111383 (patch)
treee6eed1c6883f1db29d3177e31ed6c21b1489e4b9 /llvm/tools/llvm-objdump/llvm-objdump.cpp
parent60d2dbf522c0a4d7dc85e6146a830dfbb40bbc96 (diff)
downloadllvm-175aa049c7c1a319289a27aca538e9ba59111383.zip
llvm-175aa049c7c1a319289a27aca538e9ba59111383.tar.gz
llvm-175aa049c7c1a319289a27aca538e9ba59111383.tar.bz2
[Propeller] Make decoding BBAddrMaps trace through relocations
Currently when using the LLVM tools (eg llvm-readobj, llvm-objdump) to find information about basic block locations using the propeller tooling in relocatable object files function addresses are not mapped properly which causes problems. In llvm-readobj this means that incorrect function names will be pulled. In llvm-objdum this means that most BBs won't show up in the output if --symbolize-operands is used. This patch changes the behavior of decodeBBAddrMap to trace through relocations to get correct function addresses if it is going through a relocatable object file. This fixes the behavior in both tools and also other consumers of decodeBBAddrMap. Some helper functions have been added in/refactoring done to aid in grabbing BB address map sections now that in some cases both relocation and BB address map sections need to be obtained at the same time. Regression tests moved around/added. Differential Revision: https://reviews.llvm.org/D143841
Diffstat (limited to 'llvm/tools/llvm-objdump/llvm-objdump.cpp')
-rw-r--r--llvm/tools/llvm-objdump/llvm-objdump.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp
index 44f685f6..e3d1419 100644
--- a/llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -1439,8 +1439,10 @@ static void disassembleObject(const Target *TheTarget, ObjectFile &Obj,
AddrToBBAddrMap.clear();
if (const auto *Elf = dyn_cast<ELFObjectFileBase>(&Obj)) {
auto BBAddrMapsOrErr = Elf->readBBAddrMap(SectionIndex);
- if (!BBAddrMapsOrErr)
+ if (!BBAddrMapsOrErr) {
reportWarning(toString(BBAddrMapsOrErr.takeError()), Obj.getFileName());
+ return;
+ }
for (auto &FunctionBBAddrMap : *BBAddrMapsOrErr)
AddrToBBAddrMap.emplace(FunctionBBAddrMap.Addr,
std::move(FunctionBBAddrMap));