Using Objdump for Arm Architecture: Disassembling to Arm

Objdump ARM aarch64 code?

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

how to use aarch64-linux-gnu-objdump to disassemble V7 mode instructions (A32,T32)

Unlike for A32 ("ARM") and T32 ("Thumb") within a 32-bit toolchain, there is no cross-instruction-set support between 32-bit and 64-bit ARM architectures. A64 really is a completely new instruction set.

Since interworking does not exist between the 64-bit and 32-bit states (you can only change 'width' on taking an exception) this is not an issue in normal usage. But when building a standalone image containing code for several exception levels I can imagine it will get a bit tedious.

You need to use aarch64-linux-gnu- for A64 portions and arm-linux-gnueabihf- for A32/T32 portions.

Post process `objdump --disassemble` with ARM cycle counts

There is an online tool which estimates cycle counts on Cortex-A8. However, this CPU is quite old, and programs optimized for it might be suboptimal on newer CPUs.

AFAIK ARM also provides Cortex-A9 and Cortex-A5 cycle-accurate emulators in their RVDS software, but it is quite expensive.

Building objdump on osx to allow disassembling arm64 objects

The objdump you're using doesn't know about the arm64 arch. 0x100000c/0x0 is the cputype (CPU_TYPE_ARM64) and cpusubtype CPU_SUBTYPE_ARM64_ALL.

Why use objdump? The otool(1) program works well and is included in the Xcode developer tools / command line tools package. The command line options are a little different but one look at the man page will make it clear how to use it.



Related Topics



Leave a reply



Submit