OSDN Git Service

[llvm-objdump] - Implement the --adjust-vma option.
authorGeorge Rimar <grimar@accesssoftek.com>
Mon, 28 Jan 2019 10:44:01 +0000 (10:44 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Mon, 28 Jan 2019 10:44:01 +0000 (10:44 +0000)
commit747cd64953273b5c477429fabd6f541985178e7b
treeb9d3dc1fdab1753eeea75e90d277883836da38c0
parenta48d0005963123845fa238878ddf6c429a39bf41
[llvm-objdump] - Implement the --adjust-vma option.

GNU objdump's help says: "--adjust-vma: Add OFFSET to all displayed section addresses"
In real life what it does is a bit more complicated
(and IMO not always reasonable. For example, GNU objdump prints not only VMA, but also LMA
for sections. And with --adjust-vma it adjusts LMA, but only when a section has relocations.
llvm-objsump does not seem to support printing LMAs yet, but GNU's logic anyways does not
make sense for me here).

This patch tries to adjust VMA. I tried to implement a reasonable approach.
I am not adjusting sections that are not allocatable. As, for example, adjusting debug sections
VA's and rel[a] sections VA's should not make sense. This behavior seems to be GNU compatible.

Differential revision: https://reviews.llvm.org/D57051

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352347 91177308-0d34-0410-b5e6-96231b3b80d8
test/tools/llvm-objdump/X86/adjust-vma.test [new file with mode: 0644]
tools/llvm-objdump/llvm-objdump.cpp