6

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.

Community
  • 1
  • 1
in3o
  • 321
  • 2
  • 3
  • 14
  • 1
    If you have Ubuntu or Debian, an alternative is to install *binutils-multiarch*, which can disassembler many different CPU types. Most likely other systems may have a similarly configured package. – artless noise Aug 21 '14 at 15:51

2 Answers2

8

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
auselen
  • 27,577
  • 7
  • 73
  • 114
2

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

Santosh A
  • 5,173
  • 27
  • 37