I have a file containing ARM v8 binary code. I want to disassemble the file and get the actual assembly code contained in it.
Assuming the file name is tmp.o I run:
/opt/linaro/A64-tools/bin/aarch64-linux-gnu-objdump -b binary -m AARCH64 -D tmp.o
This gives me the correct disassembly. However, the offset for branch instructions assumes that this code sits in address 0x00000000.
If I know that the code will sit in address 0x12345678 in memory:
If not, can I add some header to the binary file that says something like:
. = 0x12345678
Thanks in Advance..
A quick poke around reveals objdump's --adjust-vma
option, which seems to do exactly this.
Using the first raw binary which came to hand:
$ aarch64-linux-gnu-objdump -b binary -m aarch64 -D arch/arm64/boot/Image
arch/arm64/boot/Image: file format binary
Disassembly of section .data:
0000000000000000 <.data>:
0: 91005a4d add x13, x18, #0x16
4: 140003ff b 0x1000
...
vs.
$ aarch64-linux-gnu-objdump -b binary -m aarch64 --adjust-vma=0x12345678 -D arch/arm64/boot/Image
arch/arm64/boot/Image: file format binary
Disassembly of section .data:
0000000012345678 <.data>:
12345678: 91005a4d add x13, x18, #0x16
1234567c: 140003ff b 0x12346678
...