Objdump ARM aarch64 code?

I have an aarch64 elf binary and I want to parse its .text section using objdump.My amd64 machine.

I tried using objdump for ARM architecture: disassembling in ARM , but objdump does not identify the binary, so it cannot disassemble it.

+3


source to share


2 answers


Go to http://releases.linaro.org/latest/components/toolchain/binaries/ and get your choice gcc-linaro-aarch64-linux-gnu-4.9-*

, for example gcc-linaro-aarch64-linux-gnu-4.9-2014.07_linux.tar.bz2

.

After unpacking invoke aarch64-linux-gnu-objdump

, that is:

echo "int main(void) {return 42;}" > test.c
gcc-linaro-aarch64-linux-gnu-4.9-2014.07_linux/bin/aarch64-linux-gnu-gcc -c test.c
gcc-linaro-aarch64-linux-gnu-4.9-2014.07_linux/bin/aarch64-linux-gnu-objdump -d test.o

      



to get objdump.

test.o:     file format elf64-littleaarch64


Disassembly of section .text:

0000000000000000 <main>:
   0:   52800540    mov w0, #0x2a                   // #42
   4:   d65f03c0    ret

      

+2


source


Use the same toolchain you used to compile the binary

In case of ARM architecture it will look like arm-linux-gnueabi-gcc , so for objdump one should use



hand-linux-gnueabi-objdump

My current guess is that you must use the x86 toolchain (objdump) to disassemble the binary compiled with the ARM toolchain, hence the error

+1


source







All Articles