Description
There is a discrepancy between --adjust-vma of llvm-objdump and GNU objdump.
I use adjust-vma.test from llvm and generate the object file input.o.
Then I run both llvm-objdump --adjust-vma=0x123000 --all-headers -D -z input.o
and objdump --adjust-vma=0x123000 --all-headers -D -z input.o
.
From this thest I would expect to have same section adresses adjusted.
However there is difference between both:
GNU objdump
0000000000000000 <debug_str_sym>:
0: 00 00 add %al,(%rax)
1: R_X86_64_32 .text
2: 00 00 add %al,(%rax)
llvm-objdump
0000000000000000 <debug_str_sym>:
0: 00 00 addb %al, (%rax)
0000000000123001: R_X86_64_32 .text
2: 00 00 addb %al, (%rax)
To my understanding section debug_str_sym should not be adjusted as it is not allocatable section and it is debug one.
More to say in source code of llvm-objdump I can find following comment:
// Used for --adjust-vma to check if address should be adjusted by the
// specified value for a given section.
// For ELF we do not adjust non-allocatable sections like debug ones,
// because they are not loadable.
// TODO: implement for other file formats.