There are two possible ways to do objdump in Mac OS X: 1) install GNU binutils; 2) use otool.

1) Install GNU binutils from the source (download), or from the MacPort.

2) Use otool, the Mac OS X native utility. I summarize the usage of otool in the following:

disassemble text sections (= objdump -j .text -d <file>)
otool -tV <file>
disassemble a section (= objdump -j <section> -d <file>)
otool -V -s __text <section> <file>
print out the shared library dependencies (= ldd <file>)
otool -L <file>
print out the data sections (= objdump -j .data -s <file>)
otool -dv <file>

2010/04/22 04:28 2010/04/22 04:28
Posted by 차상길.

In genral, the objdump only supports x86, or your machine's native architecture. The easiest way to objdump different architecture's binary is to use binutils.

Binutils contain many popular programs including readelf, objcopy, and objdump. The only thing you need to do is enable different targets when you compile the binutils. Currently, latest stable version of binutils is 2.20.

So, how do we actually enable various targets? The answer is "--enable-targets" option. The simplest way is "--enable-targets=all", which will compile all possible architectures including ARM, MIPS, PowerPC, and so forth. However, this will generate more than 1 GB of object files inside your source code directory!

So, choose your favorite architectures, and use comma to separate them.

For example, if you want to enable ARM and MIPS for your objdump, use the following command.
./configure --enable-targets=arm-elf,mips

After make, and make install, you will be able to see a different message (objdump --help) from your objdump. Your objdump will show several possible targets for ARM and MIPS.

You can also use pe-i386 target to objdump PE files in your linux box. :D
2010/01/19 21:14 2010/01/19 21:14
Posted by 차상길.
TAGS ,