linux 命令之 objdump 简单使用

objdump 介绍

objdump命令是用查看目标文件或者可执行的目标文件的构成的gcc工具

objdump 选项介绍

--archive-headers 
-a 
显示档案库的成员信息,类似ls -l将lib*.a的信息列出。 

-b bfdname 
--target=bfdname 
指定目标码格式。这不是必须的,objdump能自动识别许多格式,比如: 

objdump -b oasys -m vax -h fu.o 
显示fu.o的头部摘要信息,明确指出该文件是Vax系统下用Oasys编译器生成的目标文件。objdump -i将给出这里可以指定的目标码格式列表。 

-C 
--demangle 
将底层的符号名解码成用户级名字,除了去掉所开头的下划线之外,还使得C++函数名以可理解的方式显示出来。 

--debugging 
-g 
显示调试信息。企图解析保存在文件中的调试信息并以C语言的语法显示出来。仅仅支持某些类型的调试信息。有些其他的格式被readelf -w支持。 

-e 
--debugging-tags 
类似-g选项,但是生成的信息是和ctags工具相兼容的格式。 

--disassemble 
-d 
从objfile中反汇编那些特定指令机器码的section。 

-D 
--disassemble-all 
与 -d 类似,但反汇编所有section. 

--prefix-addresses 
反汇编的时候,显示每一行的完整地址。这是一种比较老的反汇编格式。 

-EB 
-EL 
--endian={big|little} 
指定目标文件的小端。这个项将影响反汇编出来的指令。在反汇编的文件没描述小端信息的时候用。例如S-records. 

-f 
--file-headers 
显示objfile中每个文件的整体头部摘要信息。 

-h 
--section-headers 
--headers 
显示目标文件各个section的头部摘要信息。 

-H 
--help 
简短的帮助信息。 

-i 
--info 
显示对于 -b 或者 -m 选项可用的架构和目标格式列表。 

-j name
--section=name 
仅仅显示指定名称为name的section的信息 

-l
--line-numbers 
用文件名和行号标注相应的目标代码,仅仅和-d、-D或者-r一起使用使用-ld和使用-d的区别不是很大,在源码级调试的时候有用,要求编译时使用了-g之类的调试编译选项。 

-m machine 
--architecture=machine 
指定反汇编目标文件时使用的架构,当待反汇编文件本身没描述架构信息的时候(比如S-records),这个选项很有用。可以用-i选项列出这里能够指定的架构. 

--reloc 
-r 
显示文件的重定位入口。如果和-d或者-D一起使用,重定位部分以反汇编后的格式显示出来。 

--dynamic-reloc 
-R 
显示文件的动态重定位入口,仅仅对于动态目标文件意义,比如某些共享库。 

-s 
--full-contents 
显示指定section的完整内容。默认所有的非空section都会被显示。 

-S 
--source 
尽可能反汇编出源代码,尤其当编译的时候指定了-g这种调试参数时,效果比较明显。隐含了-d参数。 

--show-raw-insn 
反汇编的时候,显示每条汇编指令对应的机器码,如不指定--prefix-addresses,这将是缺省选项。 

--no-show-raw-insn 
反汇编时,不显示汇编指令的机器码,如不指定--prefix-addresses,这将是缺省选项。 

--start-address=address 
从指定地址开始显示数据,该选项影响-d、-r和-s选项的输出。 

--stop-address=address 
显示数据直到指定地址为止,该项影响-d、-r和-s选项的输出。 

-t 
--syms 
显示文件的符号表入口。类似于nm -s提供的信息 

-T 
--dynamic-syms 
显示文件的动态符号表入口,仅仅对动态目标文件意义,比如某些共享库。它显示的信息类似于 nm -D|--dynamic 显示的信息。 

-V 
--version 
版本信息 

--all-headers 
-x 
显示所可用的头信息,包括符号表、重定位入口。-x 等价于-a -f -h -r -t 同时指定。 

-z 
--disassemble-zeroes 
一般反汇编输出将省略大块的零,该选项使得这些零块也被反汇编。 

@file 可以将选项集中到一个文件中,然后使用这个@file选项载入。

实例

首先,在给出后面大部分测试所基于的源代码以及编译指令。 源代码如下:

     1	#include <stdio.h>
     2	#include <stdlib.h>
       
     3	int test_pass_parm(int a, int b, int c, int d, int e, int f, int g, int h)
     4	{
     5		
     6		printf("a:%0x, b:%0x c:%0x d:%0x e:%0x f:%0x g;%0x h:%0x\n", a,b,c,d,e,f,g,g);
     7		return 0;
     8	}
       
     9	int main(int argc, char **argv)
    10	{
       
    11		int a = 1, b= 2, c=3, d = 4, e =5, f=6,  g= 7, h =8;
    12		test_pass_parm(a,b,c,d,e,f,g,h);
    13		return 0;
    14	}
       

对以上源代码进行编译生成可执行程序 *** pass_para ***,如下:

[root@localhost test]# gcc -g pass_parm.c -o pass_parm

查看当前使用的objdump的版本号:

[root@localhost test]# objdump -v
GNU objdump version 2.27-27.base.el7
Copyright (C) 2016 Free Software Foundation, Inc.
这个程序是自由软件;您可以遵循 GNU 通用公共授权版本 3 或
(您自行选择的) 稍后版本再发布它。
这个程序不含任何担保。

显示 pass_para 文件中的text段的内容:

[root@localhost test]# objdump --section=.text -s pass_parm

pass_parm:     文件格式 elf64-x86-64

Contents of section .text:
 400430 31ed4989 d15e4889 e24883e4 f0505449  1.I..^H..H...PTI
 400440 c7c07006 400048c7 c1000640 0048c7c7  ..p.@.H....@.H..
 400450 7b054000 e8b7ffff fff4660f 1f440000  {.@.......f..D..
 400460 b8371060 0055482d 30106000 4883f80e  .7.`.UH-0.`.H...
 400470 4889e577 025dc3b8 00000000 4885c074  H..w.]......H..t
 400480 f45dbf30 106000ff e00f1f80 00000000  .].0.`..........
 400490 b8301060 0055482d 30106000 48c1f803  .0.`.UH-0.`.H...
 4004a0 4889e548 89c248c1 ea3f4801 d048d1f8  H..H..H..?H..H..
 4004b0 75025dc3 ba000000 004885d2 74f45d48  u.]......H..t.]H
 4004c0 89c6bf30 106000ff e20f1f80 00000000  ...0.`..........
 4004d0 803d550b 20000075 11554889 e5e87eff  .=U. ..u.UH...~.
 4004e0 ffff5dc6 05420b20 0001f3c3 0f1f4000  ..]..B. ......@.
 4004f0 48833d28 09200000 741eb800 00000048  H.=(. ..t......H
 400500 85c07414 55bf200e 60004889 e5ffd05d  ..t.U. .`.H....]
 400510 e97bffff ff0f1f00 e973ffff ff554889  .{.......s...UH.
 400520 e54883ec 30897dfc 8975f889 55f4894d  .H..0.}..u..U..M
 400530 f0448945 ec44894d e8448b45 ec8b7df0  .D.E.D.M.D.E..}.
 400540 8b4df48b 55f88b45 fc8b7510 89742410  .M..U..E..u..t$.
 400550 8b751089 7424088b 75e88934 244589c1  .u..t$..u..4$E..
 400560 4189f889 c6bf9006 4000b800 000000e8  A.......@.......
 400570 8cfeffff b8000000 00c9c355 4889e548  ...........UH..H
 400580 83ec4089 7ddc4889 75d0c745 fc010000  ..@.}.H.u..E....
 400590 00c745f8 02000000 c745f403 000000c7  ..E......E......
 4005a0 45f00400 0000c745 ec050000 00c745e8  E......E......E.
 4005b0 06000000 c745e407 000000c7 45e00800  .....E......E...
 4005c0 0000448b 4de8448b 45ec8b4d f08b55f4  ..D.M.D.E..M..U.
 4005d0 8b75f88b 45fc8b7d e0897c24 088b7de4  .u..E..}..|$..}.
 4005e0 893c2489 c7e833ff ffffb800 000000c9  .<$...3.........
 4005f0 c3662e0f 1f840000 0000000f 1f440000  .f...........D..
 400600 41574189 ff415649 89f64155 4989d541  AWA..AVI..AUI..A
 400610 544c8d25 f8072000 55488d2d f8072000  TL.%.. .UH.-.. .
 400620 534c29e5 31db48c1 fd034883 ec08e895  SL).1.H...H.....
 400630 fdffff48 85ed741e 0f1f8400 00000000  ...H..t.........
 400640 4c89ea4c 89f64489 ff41ff14 dc4883c3  L..L..D..A...H..
 400650 014839eb 75ea4883 c4085b5d 415c415d  .H9.u.H...[]A\A]
 400660 415e415f c390662e 0f1f8400 00000000  A^A_..f.........
 400670 f3c3                                 ..              

反汇编 pass_para 程序中的text段内容,并尽可能用源代码形式表示:

[root@localhost test]# objdump -j .text -S pass_parm 

pass_parm:     文件格式 elf64-x86-64


Disassembly of section .text:

0000000000400430 <_start>:
  400430:	31 ed                	xor    %ebp,%ebp
  400432:	49 89 d1             	mov    %rdx,%r9
  400435:	5e                   	pop    %rsi
  400436:	48 89 e2             	mov    %rsp,%rdx
  400439:	48 83 e4 f0          	and    $0xfffffffffffffff0,%rsp
  40043d:	50                   	push   %rax
  40043e:	54                   	push   %rsp
  40043f:	49 c7 c0 70 06 40 00 	mov    $0x400670,%r8
  400446:	48 c7 c1 00 06 40 00 	mov    $0x400600,%rcx
  40044d:	48 c7 c7 7b 05 40 00 	mov    $0x40057b,%rdi
  400454:	e8 b7 ff ff ff       	callq  400410 <__libc_start_main@plt>
  400459:	f4                   	hlt    
  40045a:	66 0f 1f 44 00 00    	nopw   0x0(%rax,%rax,1)

0000000000400460 <deregister_tm_clones>:
  400460:	b8 37 10 60 00       	mov    $0x601037,%eax
  400465:	55                   	push   %rbp
  400466:	48 2d 30 10 60 00    	sub    $0x601030,%rax
  40046c:	48 83 f8 0e          	cmp    $0xe,%rax
  400470:	48 89 e5             	mov    %rsp,%rbp
  400473:	77 02                	ja     400477 <deregister_tm_clones+0x17>
  400475:	5d                   	pop    %rbp
  400476:	c3                   	retq   
  400477:	b8 00 00 00 00       	mov    $0x0,%eax
  40047c:	48 85 c0             	test   %rax,%rax
  40047f:	74 f4                	je     400475 <deregister_tm_clones+0x15>
  400481:	5d                   	pop    %rbp
  400482:	bf 30 10 60 00       	mov    $0x601030,%edi
  400487:	ff e0                	jmpq   *%rax
  400489:	0f 1f 80 00 00 00 00 	nopl   0x0(%rax)

0000000000400490 <register_tm_clones>:
  400490:	b8 30 10 60 00       	mov    $0x601030,%eax
  400495:	55                   	push   %rbp
  400496:	48 2d 30 10 60 00    	sub    $0x601030,%rax
  40049c:	48 c1 f8 03          	sar    $0x3,%rax
  4004a0:	48 89 e5             	mov    %rsp,%rbp
  4004a3:	48 89 c2             	mov    %rax,%rdx
  4004a6:	48 c1 ea 3f          	shr    $0x3f,%rdx
  4004aa:	48 01 d0             	add    %rdx,%rax
  4004ad:	48 d1 f8             	sar    %rax
  4004b0:	75 02                	jne    4004b4 <register_tm_clones+0x24>
  4004b2:	5d                   	pop    %rbp
  4004b3:	c3                   	retq   
  4004b4:	ba 00 00 00 00       	mov    $0x0,%edx
  4004b9:	48 85 d2             	test   %rdx,%rdx
  4004bc:	74 f4                	je     4004b2 <register_tm_clones+0x22>
  4004be:	5d                   	pop    %rbp
  4004bf:	48 89 c6             	mov    %rax,%rsi
  4004c2:	bf 30 10 60 00       	mov    $0x601030,%edi
  4004c7:	ff e2                	jmpq   *%rdx
  4004c9:	0f 1f 80 00 00 00 00 	nopl   0x0(%rax)

00000000004004d0 <__do_global_dtors_aux>:
  4004d0:	80 3d 55 0b 20 00 00 	cmpb   $0x0,0x200b55(%rip)        # 60102c <_edata>
  4004d7:	75 11                	jne    4004ea <__do_global_dtors_aux+0x1a>
  4004d9:	55                   	push   %rbp
  4004da:	48 89 e5             	mov    %rsp,%rbp
  4004dd:	e8 7e ff ff ff       	callq  400460 <deregister_tm_clones>
  4004e2:	5d                   	pop    %rbp
  4004e3:	c6 05 42 0b 20 00 01 	movb   $0x1,0x200b42(%rip)        # 60102c <_edata>
  4004ea:	f3 c3                	repz retq 
  4004ec:	0f 1f 40 00          	nopl   0x0(%rax)

00000000004004f0 <frame_dummy>:
  4004f0:	48 83 3d 28 09 20 00 	cmpq   $0x0,0x200928(%rip)        # 600e20 <__JCR_END__>
  4004f7:	00 
  4004f8:	74 1e                	je     400518 <frame_dummy+0x28>
  4004fa:	b8 00 00 00 00       	mov    $0x0,%eax
  4004ff:	48 85 c0             	test   %rax,%rax
  400502:	74 14                	je     400518 <frame_dummy+0x28>
  400504:	55                   	push   %rbp
  400505:	bf 20 0e 60 00       	mov    $0x600e20,%edi
  40050a:	48 89 e5             	mov    %rsp,%rbp
  40050d:	ff d0                	callq  *%rax
  40050f:	5d                   	pop    %rbp
  400510:	e9 7b ff ff ff       	jmpq   400490 <register_tm_clones>
  400515:	0f 1f 00             	nopl   (%rax)
  400518:	e9 73 ff ff ff       	jmpq   400490 <register_tm_clones>

000000000040051d <test_pass_parm>:
#include <stdio.h>
#include <stdlib.h>

int test_pass_parm(int a, int b, int c, int d, int e, int f, int g, int h)
{
  40051d:	55                   	push   %rbp
  40051e:	48 89 e5             	mov    %rsp,%rbp
  400521:	48 83 ec 30          	sub    $0x30,%rsp
  400525:	89 7d fc             	mov    %edi,-0x4(%rbp)
  400528:	89 75 f8             	mov    %esi,-0x8(%rbp)
  40052b:	89 55 f4             	mov    %edx,-0xc(%rbp)
  40052e:	89 4d f0             	mov    %ecx,-0x10(%rbp)
  400531:	44 89 45 ec          	mov    %r8d,-0x14(%rbp)
  400535:	44 89 4d e8          	mov    %r9d,-0x18(%rbp)
	
	printf("a:%0x, b:%0x c:%0x d:%0x e:%0x f:%0x g;%0x h:%0x\n", a,b,c,d,e,f,g,g);
  400539:	44 8b 45 ec          	mov    -0x14(%rbp),%r8d
  40053d:	8b 7d f0             	mov    -0x10(%rbp),%edi
  400540:	8b 4d f4             	mov    -0xc(%rbp),%ecx
  400543:	8b 55 f8             	mov    -0x8(%rbp),%edx
  400546:	8b 45 fc             	mov    -0x4(%rbp),%eax
  400549:	8b 75 10             	mov    0x10(%rbp),%esi
  40054c:	89 74 24 10          	mov    %esi,0x10(%rsp)
  400550:	8b 75 10             	mov    0x10(%rbp),%esi
  400553:	89 74 24 08          	mov    %esi,0x8(%rsp)
  400557:	8b 75 e8             	mov    -0x18(%rbp),%esi
  40055a:	89 34 24             	mov    %esi,(%rsp)
  40055d:	45 89 c1             	mov    %r8d,%r9d
  400560:	41 89 f8             	mov    %edi,%r8d
  400563:	89 c6                	mov    %eax,%esi
  400565:	bf 90 06 40 00       	mov    $0x400690,%edi
  40056a:	b8 00 00 00 00       	mov    $0x0,%eax
  40056f:	e8 8c fe ff ff       	callq  400400 <printf@plt>
	return 0;
  400574:	b8 00 00 00 00       	mov    $0x0,%eax
}
  400579:	c9                   	leaveq 
  40057a:	c3                   	retq   

000000000040057b <main>:

int main(int argc, char **argv)
{
  40057b:	55                   	push   %rbp
  40057c:	48 89 e5             	mov    %rsp,%rbp
  40057f:	48 83 ec 40          	sub    $0x40,%rsp
  400583:	89 7d dc             	mov    %edi,-0x24(%rbp)
  400586:	48 89 75 d0          	mov    %rsi,-0x30(%rbp)

	int a = 1, b= 2, c=3, d = 4, e =5, f=6,  g= 7, h =8;
  40058a:	c7 45 fc 01 00 00 00 	movl   $0x1,-0x4(%rbp)
  400591:	c7 45 f8 02 00 00 00 	movl   $0x2,-0x8(%rbp)
  400598:	c7 45 f4 03 00 00 00 	movl   $0x3,-0xc(%rbp)
  40059f:	c7 45 f0 04 00 00 00 	movl   $0x4,-0x10(%rbp)
  4005a6:	c7 45 ec 05 00 00 00 	movl   $0x5,-0x14(%rbp)
  4005ad:	c7 45 e8 06 00 00 00 	movl   $0x6,-0x18(%rbp)
  4005b4:	c7 45 e4 07 00 00 00 	movl   $0x7,-0x1c(%rbp)
  4005bb:	c7 45 e0 08 00 00 00 	movl   $0x8,-0x20(%rbp)
	test_pass_parm(a,b,c,d,e,f,g,h);
  4005c2:	44 8b 4d e8          	mov    -0x18(%rbp),%r9d
  4005c6:	44 8b 45 ec          	mov    -0x14(%rbp),%r8d
  4005ca:	8b 4d f0             	mov    -0x10(%rbp),%ecx
  4005cd:	8b 55 f4             	mov    -0xc(%rbp),%edx
  4005d0:	8b 75 f8             	mov    -0x8(%rbp),%esi
  4005d3:	8b 45 fc             	mov    -0x4(%rbp),%eax
  4005d6:	8b 7d e0             	mov    -0x20(%rbp),%edi
  4005d9:	89 7c 24 08          	mov    %edi,0x8(%rsp)
  4005dd:	8b 7d e4             	mov    -0x1c(%rbp),%edi
  4005e0:	89 3c 24             	mov    %edi,(%rsp)
  4005e3:	89 c7                	mov    %eax,%edi
  4005e5:	e8 33 ff ff ff       	callq  40051d <test_pass_parm>
	return 0;
  4005ea:	b8 00 00 00 00       	mov    $0x0,%eax
}
  4005ef:	c9                   	leaveq 
  4005f0:	c3                   	retq   
  4005f1:	66 2e 0f 1f 84 00 00 	nopw   %cs:0x0(%rax,%rax,1)
  4005f8:	00 00 00 
  4005fb:	0f 1f 44 00 00       	nopl   0x0(%rax,%rax,1)

0000000000400600 <__libc_csu_init>:
  400600:	41 57                	push   %r15
  400602:	41 89 ff             	mov    %edi,%r15d
  400605:	41 56                	push   %r14
  400607:	49 89 f6             	mov    %rsi,%r14
  40060a:	41 55                	push   %r13
  40060c:	49 89 d5             	mov    %rdx,%r13
  40060f:	41 54                	push   %r12
  400611:	4c 8d 25 f8 07 20 00 	lea    0x2007f8(%rip),%r12        # 600e10 <__frame_dummy_init_array_entry>
  400618:	55                   	push   %rbp
  400619:	48 8d 2d f8 07 20 00 	lea    0x2007f8(%rip),%rbp        # 600e18 <__init_array_end>
  400620:	53                   	push   %rbx
  400621:	4c 29 e5             	sub    %r12,%rbp
  400624:	31 db                	xor    %ebx,%ebx
  400626:	48 c1 fd 03          	sar    $0x3,%rbp
  40062a:	48 83 ec 08          	sub    $0x8,%rsp
  40062e:	e8 95 fd ff ff       	callq  4003c8 <_init>
  400633:	48 85 ed             	test   %rbp,%rbp
  400636:	74 1e                	je     400656 <__libc_csu_init+0x56>
  400638:	0f 1f 84 00 00 00 00 	nopl   0x0(%rax,%rax,1)
  40063f:	00 
  400640:	4c 89 ea             	mov    %r13,%rdx
  400643:	4c 89 f6             	mov    %r14,%rsi
  400646:	44 89 ff             	mov    %r15d,%edi
  400649:	41 ff 14 dc          	callq  *(%r12,%rbx,8)
  40064d:	48 83 c3 01          	add    $0x1,%rbx
  400651:	48 39 eb             	cmp    %rbp,%rbx
  400654:	75 ea                	jne    400640 <__libc_csu_init+0x40>
  400656:	48 83 c4 08          	add    $0x8,%rsp
  40065a:	5b                   	pop    %rbx
  40065b:	5d                   	pop    %rbp
  40065c:	41 5c                	pop    %r12
  40065e:	41 5d                	pop    %r13
  400660:	41 5e                	pop    %r14
  400662:	41 5f                	pop    %r15
  400664:	c3                   	retq   
  400665:	90                   	nop
  400666:	66 2e 0f 1f 84 00 00 	nopw   %cs:0x0(%rax,%rax,1)
  40066d:	00 00 00 

0000000000400670 <__libc_csu_fini>:
  400670:	f3 c3                	repz retq 

显示文件的符号表入口:

[root@localhost test]# objdump -t pass_parm

pass_parm:     文件格式 elf64-x86-64

SYMBOL TABLE:
0000000000400238 l    d  .interp	0000000000000000              .interp
0000000000400254 l    d  .note.ABI-tag	0000000000000000              .note.ABI-tag
0000000000400274 l    d  .note.gnu.build-id	0000000000000000              .note.gnu.build-id
0000000000400298 l    d  .gnu.hash	0000000000000000              .gnu.hash
00000000004002b8 l    d  .dynsym	0000000000000000              .dynsym
0000000000400318 l    d  .dynstr	0000000000000000              .dynstr
0000000000400358 l    d  .gnu.version	0000000000000000              .gnu.version
0000000000400360 l    d  .gnu.version_r	0000000000000000              .gnu.version_r
0000000000400380 l    d  .rela.dyn	0000000000000000              .rela.dyn
0000000000400398 l    d  .rela.plt	0000000000000000              .rela.plt
00000000004003c8 l    d  .init	0000000000000000              .init
00000000004003f0 l    d  .plt	0000000000000000              .plt
0000000000400420 l    d  .plt.got	0000000000000000              .plt.got
0000000000400430 l    d  .text	0000000000000000              .text
0000000000400674 l    d  .fini	0000000000000000              .fini
0000000000400680 l    d  .rodata	0000000000000000              .rodata
00000000004006c4 l    d  .eh_frame_hdr	0000000000000000              .eh_frame_hdr
0000000000400700 l    d  .eh_frame	0000000000000000              .eh_frame
0000000000600e10 l    d  .init_array	0000000000000000              .init_array
0000000000600e18 l    d  .fini_array	0000000000000000              .fini_array
0000000000600e20 l    d  .jcr	0000000000000000              .jcr
0000000000600e28 l    d  .dynamic	0000000000000000              .dynamic
0000000000600ff8 l    d  .got	0000000000000000              .got
0000000000601000 l    d  .got.plt	0000000000000000              .got.plt
0000000000601028 l    d  .data	0000000000000000              .data
000000000060102c l    d  .bss	0000000000000000              .bss
0000000000000000 l    d  .comment	0000000000000000              .comment
0000000000000000 l    d  .debug_aranges	0000000000000000              .debug_aranges
0000000000000000 l    d  .debug_info	0000000000000000              .debug_info
0000000000000000 l    d  .debug_abbrev	0000000000000000              .debug_abbrev
0000000000000000 l    d  .debug_line	0000000000000000              .debug_line
0000000000000000 l    d  .debug_str	0000000000000000              .debug_str
0000000000000000 l    df *ABS*	0000000000000000              crtstuff.c
0000000000600e20 l     O .jcr	0000000000000000              __JCR_LIST__
0000000000400460 l     F .text	0000000000000000              deregister_tm_clones
0000000000400490 l     F .text	0000000000000000              register_tm_clones
00000000004004d0 l     F .text	0000000000000000              __do_global_dtors_aux
000000000060102c l     O .bss	0000000000000001              completed.6355
0000000000600e18 l     O .fini_array	0000000000000000              __do_global_dtors_aux_fini_array_entry
00000000004004f0 l     F .text	0000000000000000              frame_dummy
0000000000600e10 l     O .init_array	0000000000000000              __frame_dummy_init_array_entry
0000000000000000 l    df *ABS*	0000000000000000              pass_parm.c
0000000000000000 l    df *ABS*	0000000000000000              crtstuff.c
0000000000400810 l     O .eh_frame	0000000000000000              __FRAME_END__
0000000000600e20 l     O .jcr	0000000000000000              __JCR_END__
0000000000000000 l    df *ABS*	0000000000000000              
0000000000600e18 l       .init_array	0000000000000000              __init_array_end
0000000000600e28 l     O .dynamic	0000000000000000              _DYNAMIC
0000000000600e10 l       .init_array	0000000000000000              __init_array_start
00000000004006c4 l       .eh_frame_hdr	0000000000000000              __GNU_EH_FRAME_HDR
0000000000601000 l     O .got.plt	0000000000000000              _GLOBAL_OFFSET_TABLE_
0000000000400670 g     F .text	0000000000000002              __libc_csu_fini
0000000000601028  w      .data	0000000000000000              data_start
000000000060102c g       .data	0000000000000000              _edata
0000000000400674 g     F .fini	0000000000000000              _fini
0000000000000000       F *UND*	0000000000000000              printf@@GLIBC_2.2.5
0000000000000000       F *UND*	0000000000000000              __libc_start_main@@GLIBC_2.2.5
0000000000601028 g       .data	0000000000000000              __data_start
0000000000000000  w      *UND*	0000000000000000              __gmon_start__
0000000000400688 g     O .rodata	0000000000000000              .hidden __dso_handle
0000000000400680 g     O .rodata	0000000000000004              _IO_stdin_used
0000000000400600 g     F .text	0000000000000065              __libc_csu_init
0000000000601030 g       .bss	0000000000000000              _end
0000000000400430 g     F .text	0000000000000000              _start
000000000060102c g       .bss	0000000000000000              __bss_start
000000000040057b g     F .text	0000000000000076              main
000000000040051d g     F .text	000000000000005e              test_pass_parm
0000000000601030 g     O .data	0000000000000000              .hidden __TMC_END__
00000000004003c8 g     F .init	0000000000000000              _init

显示目标文件各个段的头部摘要信息:

[root@localhost test]# objdump -h pass_parm

pass_parm:     文件格式 elf64-x86-64

节:
Idx Name          Size      VMA               LMA               File off  Algn
  0 .interp       0000001c  0000000000400238  0000000000400238  00000238  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  1 .note.ABI-tag 00000020  0000000000400254  0000000000400254  00000254  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  2 .note.gnu.build-id 00000024  0000000000400274  0000000000400274  00000274  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  3 .gnu.hash     0000001c  0000000000400298  0000000000400298  00000298  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 .dynsym       00000060  00000000004002b8  00000000004002b8  000002b8  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  5 .dynstr       0000003f  0000000000400318  0000000000400318  00000318  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  6 .gnu.version  00000008  0000000000400358  0000000000400358  00000358  2**1
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  7 .gnu.version_r 00000020  0000000000400360  0000000000400360  00000360  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  8 .rela.dyn     00000018  0000000000400380  0000000000400380  00000380  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  9 .rela.plt     00000030  0000000000400398  0000000000400398  00000398  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 10 .init         0000001a  00000000004003c8  00000000004003c8  000003c8  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 11 .plt          00000030  00000000004003f0  00000000004003f0  000003f0  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 12 .plt.got      00000008  0000000000400420  0000000000400420  00000420  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 13 .text         00000242  0000000000400430  0000000000400430  00000430  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 14 .fini         00000009  0000000000400674  0000000000400674  00000674  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 15 .rodata       00000044  0000000000400680  0000000000400680  00000680  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 16 .eh_frame_hdr 0000003c  00000000004006c4  00000000004006c4  000006c4  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 17 .eh_frame     00000114  0000000000400700  0000000000400700  00000700  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 18 .init_array   00000008  0000000000600e10  0000000000600e10  00000e10  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 19 .fini_array   00000008  0000000000600e18  0000000000600e18  00000e18  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 20 .jcr          00000008  0000000000600e20  0000000000600e20  00000e20  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 21 .dynamic      000001d0  0000000000600e28  0000000000600e28  00000e28  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 22 .got          00000008  0000000000600ff8  0000000000600ff8  00000ff8  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 23 .got.plt      00000028  0000000000601000  0000000000601000  00001000  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 24 .data         00000004  0000000000601028  0000000000601028  00001028  2**0
                  CONTENTS, ALLOC, LOAD, DATA
 25 .bss          00000004  000000000060102c  000000000060102c  0000102c  2**0
                  ALLOC
 26 .comment      0000002d  0000000000000000  0000000000000000  0000102c  2**0
                  CONTENTS, READONLY
 27 .debug_aranges 00000030  0000000000000000  0000000000000000  00001059  2**0
                  CONTENTS, READONLY, DEBUGGING
 28 .debug_info   000001ae  0000000000000000  0000000000000000  00001089  2**0
                  CONTENTS, READONLY, DEBUGGING
 29 .debug_abbrev 0000007c  0000000000000000  0000000000000000  00001237  2**0
                  CONTENTS, READONLY, DEBUGGING
 30 .debug_line   0000004c  0000000000000000  0000000000000000  000012b3  2**0
                  CONTENTS, READONLY, DEBUGGING
 31 .debug_str    000000d6  0000000000000000  0000000000000000  000012ff  2**0
                  CONTENTS, READONLY, DEBUGGING

posted @ 2020-02-19 07:09  ZhaoKevin  阅读(3678)  评论(0编辑  收藏  举报