From LinuxIntro
Jump to: navigation, search

Objdump displays information from object files. That means you can for example disassemble an executable file with it.


Let's look at an example:

# cat main.cpp 
#include <iostream>
int main()
  std::cout << "hello world" << std::endl;

You can now compile this file and look at the executable file using objdump.


Here is the disassembly on the ARM architecture, a fixed-length-command-set-architecture:

Nokia-N810-43-7:~# g\+\+-3.4 main.cpp 
Nokia-N810-43-7:~# objdump -d a.out | head

a.out:     file format elf32-littlearm

Disassembly of section .init:

000084f8 <_init>:
    84f8:	e52de004 	str	lr, [sp, #-4]!
    84fc:	e24dd004 	sub	sp, sp, #4	; 0x4
    8500:	eb000035 	bl	85dc <call_gmon_start>
    8504:	e28dd004 	add	sp, sp, #4	; 0x4

See also