[objdump][ARM] Use correct offset when printing ARM/Thumb branch targets
authorOliver Stannard <oliver.stannard@linaro.org>
Tue, 2 Mar 2021 13:49:14 +0000 (13:49 +0000)
committerOliver Stannard <oliver.stannard@linaro.org>
Thu, 4 Mar 2021 11:15:57 +0000 (11:15 +0000)
commitaac056c528cf139e6881211ee7fe6743c79a68d4
tree81f42554a5e4bec621cd21ffce9acd07aaa6da13
parentd791695cb5172b527e1b0717458d8852abcf34d1
[objdump][ARM] Use correct offset when printing ARM/Thumb branch targets

llvm-objdump only uses one MCInstrAnalysis object, so if ARM and Thumb
code is mixed in one object, or if an object is disassembled without
explicitly setting the triple to match the ISA used, then branch and
call targets will be printed incorrectly.

This could be fixed by creating two MCInstrAnalysis objects in
llvm-objdump, like we currently do for SubtargetInfo. However, I don't
think there's any reason we need two separate sub-classes of
MCInstrAnalysis, so instead these can be merged into one, and the ISA
determined by checking the opcode of the instruction.

Differential revision: https://reviews.llvm.org/D97766
lld/test/ELF/arm-thunk-many-passes.s
llvm/lib/Target/ARM/ARMInstrInfo.td
llvm/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp
llvm/test/tools/llvm-objdump/ELF/ARM/branch-symbols.s [new file with mode: 0644]