[lld] [llvm] [feature][riscv] handle target address calculation in llvm-objdump disassembly for riscv (PR #109914)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 9 15:49:17 PDT 2025
================
@@ -2392,14 +2393,18 @@ disassembleObject(ObjectFile &Obj, const ObjectFile &DbgObj,
[=](const std::pair<uint64_t, SectionRef> &O) {
return O.first <= Target;
});
- uint64_t TargetSecAddr = 0;
+ uint64_t TargetSecAddr = It == SectionAddresses.end() ? 0 : It->first;
+ bool FoundSymbols = false;
while (It != SectionAddresses.begin()) {
--It;
- if (TargetSecAddr == 0)
+ if (It->first != TargetSecAddr) {
+ if (FoundSymbols)
+ break;
TargetSecAddr = It->first;
- if (It->first != TargetSecAddr)
- break;
+ }
TargetSectionSymbols.push_back(&AllSymbols[It->second]);
+ if (!AllSymbols[It->second].empty())
----------------
topperc wrote:
Can we avoid a second `AllSymbols[It->second]` here since we already did it for the previous line. That's a map lookup, we shouldn't do it twice.
https://github.com/llvm/llvm-project/pull/109914
More information about the llvm-commits
mailing list