Search code examples
macosx86-64disassemblyobjdumpintel-syntax

how to update objdump? got: unknown command line argument -M


Working through Jon Erickson's book on Hacking. He uses an intel format assembly code. He provides the following snippet:

reader@hacking:~/booksrc 08048374 <main>:
$ objdump -M intel -D
a.out | grep -A20 main.

I'm getting this error:

Mac-of-Thor:test thorkamphefner$ objdump -M
objdump: Unknown command line argument '-M'.  Try: '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/objdump -help'
objdump: Did you mean '-C'?

What do I need to do to update objdump?


Solution

  • objdump on a Mac is llvm-objdump, not GNU Binutils objdump that takes command-line options like -Mintel

    I think I've read that the standard ways of installing GNU binutils on Mac will give you gobjdump.


    See Disassemble into x86_64 on OSX10.6 (But with _Intel_ Syntax)
    objdump -disassemble -x86-asm-syntax=intel should work on a Mac (for llvm-objdump).