OSDN Git Service

[llvm-objdump] Look in all viable sections for call/branch targets
authorJames Henderson <james.henderson@sony.com>
Mon, 20 Apr 2020 13:23:01 +0000 (14:23 +0100)
committerJames Henderson <james.henderson@sony.com>
Wed, 22 Apr 2020 11:28:30 +0000 (12:28 +0100)
commite9aac2c3ef4ccbe26a05e9aaea90e0df66cec04d
tree375354d377d8bf9c49bff587458f49a2a7a1fd61
parent727e6fb84a3a6b5568d24edb794083ca2c750038
[llvm-objdump] Look in all viable sections for call/branch targets

Prior to this patch, llvm-objdump would only look in the last section
(according to the section header table order) that matched an address
for a symbol when identifying the target symbol of a call or branch
operation. If there are multiple sections with the same address, due to
some of them being empty, it did not look in those, even if the symbol
couldn't be found in the first section looked in.

This patch causes llvm-objdump to look in all sections for possible
candidate symbols. If there are multiple possible symbols, it picks one
from a non-empty section, if possible (as that is more likely to be the
"real" symbol since functions can't really be in emptiy sections),
before falling back to those in empty sections. If all else fails, it
falls back to absolute symbols as it did before.

Differential Revision: https://reviews.llvm.org/D78549

Reviewed by: grimar, Higuoxing
llvm/test/tools/llvm-objdump/X86/disassemble-same-section-addr.test
llvm/tools/llvm-objdump/llvm-objdump.cpp