[PATCH] D78549: Improve disassembly of branch targets in non-relocatable objects

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 21 03:12:42 PDT 2020


jhenderson created this revision.
jhenderson added reviewers: MaskRay, grimar, hubert.reinterpretcast, Higuoxing, dblaikie.
Herald added a reviewer: alexshap.
Herald added a subscriber: rupprecht.
Herald added a project: LLVM.

llvm-objdump currently tries to pick symbols for branch targets based on the nearest section. However, if there are multiple sections with the same address, it only looks in one of them for the symbols before falling back to using absolute symbols. We should at least look in all sections with the same address for the candidate symbol (but see also https://bugs.llvm.org/show_bug.cgi?id=45627). This change does that, meaning that in some cases we now print a branch target when we didn't before. When there are multiple competing sections, we prefer symbols in the non-empty one over those in empty sections, as the former are more likely to be the "correct" one.

At some point, we should try to fix https://bugs.llvm.org/show_bug.cgi?id=45627 properly, but that might have performance implications with only minor gains, so for now, I'm just improving the situation.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78549

Files:
  llvm/test/tools/llvm-objdump/X86/disassemble-same-section-addr.test
  llvm/tools/llvm-objdump/llvm-objdump.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78549.258940.patch
Type: text/x-patch
Size: 8763 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200421/db146898/attachment.bin>


More information about the llvm-commits mailing list