<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/75444>75444</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
llvm-objdump --adjust-vma gives different result than GNU objdump
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
pwprzybyla
</td>
</tr>
</table>
<pre>
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.`
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVU2P2zYQ_TX0ZWCDpmTFOuiwzcbtAm0DFBugN2MkjiwmFCmQlL3Ory9Ia2052QZBKxgy9DFv5r15mkHv1cEQVWzzC9s8LnAMnXXVcBrc13N91riorTxXzx05AuUBQSrfOBrQNGeoKZyIDCyXKD-PPiyPPYJtQetjv7T1Zzn2A6CR8Oufn2C6XjH-yPjDE4ye4Ba2CuQDtM72KTpFHciQw0AQOorh1ARolSZQZhjDyk5Qzx0ZeAI3Gqht6IAV_K6Ae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