Building objdump on osx to allow disassembling arm64 objects

1.1k views Asked by At

I'm trying to disassemble openSSL that I've built for iOS targeting arm64 architecture with objdump (from GNU binutil) giving it following options:

./objdump openssl -f (file headers), -t (symbol table), and -h (section headers)

but getting following error:

BFD: bfd_mach_o_scan: unknown architecture 0x100000c/0x0
objdump: ./openssl: File format not recognized
TARGET: 
BFD: bfd_mach_o_scan: unknown architecture 0x100000c/0x0

The objdump -v 2.21.1 that I've built with following options:

./configure CC="gcc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -arch i386" CXX="g++ -arch i386" -disable-werror -enable-install-libiberty -enable-targets=arm-eabi

was working fine with all arm 32-bit architectures but failed to disassemble arm64.

Does anyone know how to build objdump to allow calling:

./objdump openssl -f (file headers), -t (symbol table), and -h (section headers)

for binary that was build targeting arm64?

Thanks in advance

1

There are 1 answers

3
Jason Molenda On BEST ANSWER

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.