Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Objdump ARM aarch64 code?

Tags:

arm

arm64

objdump

I have an elf arm aarch64 binary and i want to disassemble it .text section using objdump.My machine is amd64.

I tried Using objdump for ARM architecture: Disassembling to ARM but objdump is not identifying the binary so not able to disassemble it.

like image 724
in3o Avatar asked Aug 20 '14 23:08

in3o


2 Answers

Go to http://releases.linaro.org/latest/components/toolchain/binaries/ and get your choice of gcc-linaro-aarch64-linux-gnu-4.9-* like for example gcc-linaro-aarch64-linux-gnu-4.9-2014.07_linux.tar.bz2.

After unpacking invoke aarch64-linux-gnu-objdump, ie:

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
like image 83
auselen Avatar answered Nov 04 '22 22:11

auselen


Use the same toolchain which you used to compile the binary

In case of ARM architecture, it would generally be like arm-linux-gnueabi-gcc, so for objdump you should use

arm-linux-gnueabi-objdump

At present I guess you must using x86 toolchain(objdump) to disassemble the binary compiled using ARM toolchain hence the error

like image 32
Santosh A Avatar answered Nov 04 '22 20:11

Santosh A