[llvm-objdump] Support nonzero section addresses in addSymbolizer
authorPierre van Houtryve <pierre.vanhoutryve@amd.com>
Fri, 7 Oct 2022 08:12:36 +0000 (08:12 +0000)
committerPierre van Houtryve <pierre.vanhoutryve@amd.com>
Wed, 12 Oct 2022 10:44:03 +0000 (10:44 +0000)
commit02b5d3bc3bb9108e8d18308395120f7e3161dbe8
treebf71b707499604c55b448ee0f22b3033c95426fa
parent1e723b7ab30360fcf70c3a66dadcc4d5bbb2ace9
[llvm-objdump] Support nonzero section addresses in addSymbolizer

The previous calculations seem to have assumed that the section address would be zero.
This is true for relocatable object files, but certainly not for linked files like shared libraries.

Fixed the calculations to make them identical to the "real" `getInstruction` call below & added a regression test.

Reviewed By: scott.linder, simon_tatham

Differential Revision: https://reviews.llvm.org/D135430
llvm/test/tools/llvm-objdump/AMDGPU/elf-disassemble-symbolize-operands.yaml
llvm/tools/llvm-objdump/llvm-objdump.cpp