Usage: objdump <option(s)> <file(s)>
Display information from object <file(s)>.
At least one of the following switches must be given:
-a, --archive-headers Display archive header information
-f, --file-headers Display the contents of the overall file header
-p, --private-headers Display object format specific file header contents
-P, --private=OPT,OPT... Display object format specific contents
-h, --[section-]headers Display the contents of the section headers
-x, --all-headers Display the contents of all headers
-d, --disassemble Display assembler contents of executable sections
-D, --disassemble-all Display assembler contents of all sections
-S, --source Intermix source code with disassembly
-s, --full-contents Display the full contents of all sections requested
-g, --debugging Display debug information in object file
-e, --debugging-tags Display debug information using ctags style
-G, --stabs Display (in raw form) any STABS info in the file
-W[lLiaprmfFsoRt] or
--dwarf[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,
=frames-interp,=str,=loc,=Ranges,=pubtypes,
=gdb_index,=trace_info,=trace_abbrev,=trace_aranges]
Display DWARF info in the file
-t, --syms Display the contents of the symbol table(s)
-T, --dynamic-syms Display the contents of the dynamic symbol table
-r, --reloc Display the relocation entries in the file
-R, --dynamic-reloc Display the dynamic relocation entries in the file
@<file> Read options from <file>
-v, --version Display this program's version number
-i, --info List object formats and architectures supported
-H, --help Display this information
依然用上一篇文章的静态库libhello.a
查看文件组成:$ objdump -a libhello.a
In archive libhello.a:
h1.o: file format elf32-i386
rw-rw-r-- 1000/1000 1024 Jul 26 06:43 2012 h1.o
h2.o: file format elf32-i386
rw-rw-r-- 1000/1000 1028 Jul 26 06:38 2012 h2.o
查看文件组成部分的头部:$ objdump -h libhello.a
In archive libhello.a:
h1.o: file format elf32-i386
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00000014 00000000 00000000 00000034 2**2
CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
1 .data 00000000 00000000 00000000 00000048 2**2
CONTENTS, ALLOC, LOAD, DATA
2 .bss 00000000 00000000 00000000 00000048 2**2
ALLOC
3 .rodata 0000000c 00000000 00000000 00000048 2**0
CONTENTS, ALLOC, LOAD, READONLY, DATA
4 .comment 0000002b 00000000 00000000 00000054 2**0
CONTENTS, READONLY
5 .note.GNU-stack 00000000 00000000 00000000 0000007f 2**0
CONTENTS, READONLY
6 .eh_frame 00000038 00000000 00000000 00000080 2**2
CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
h2.o: file format elf32-i386
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00000014 00000000 00000000 00000034 2**2
CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
1 .data 00000000 00000000 00000000 00000048 2**2
CONTENTS, ALLOC, LOAD, DATA
2 .bss 00000000 00000000 00000000 00000048 2**2
ALLOC
3 .rodata 0000000e 00000000 00000000 00000048 2**0
CONTENTS, ALLOC, LOAD, READONLY, DATA
4 .comment 0000002b 00000000 00000000 00000056 2**0
CONTENTS, READONLY
5 .note.GNU-stack 00000000 00000000 00000000 00000081 2**0
CONTENTS, READONLY
6 .eh_frame 00000038 00000000 00000000 00000084 2**2
CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
查看反汇编:$ objdump -d libhello.a
In archive libhello.a:
h1.o: file format elf32-i386
Disassembly of section .text:
00000000 <firsthello>:
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 ec 18 sub $0x18,%esp
6: c7 04 24 00 00 00 00 movl $0x0,(%esp)
d: e8 fc ff ff ff call e <firsthello+0xe>
12: c9 leave
13: c3 ret
h2.o: file format elf32-i386
Disassembly of section .text:
00000000 <secondhello>:
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 ec 18 sub $0x18,%esp
6: c7 04 24 00 00 00 00 movl $0x0,(%esp)
d: e8 fc ff ff ff call e <secondhello+0xe>
12: c9 leave
13: c3 ret