(转)ELF文件格式 程序加载 执行 图示 OBJDUMP

news/2024/11/10 3:41:52

<!-- /* Font Definitions */ @font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:SimSun; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-charset:0; mso-generic-font-family:roman; mso-font-pitch:variable; mso-font-signature:-1610611985 1107304683 0 0 159 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-1610611985 1073750139 0 0 159 0;} @font-face {font-family:Verdana; panose-1:2 11 6 4 3 5 4 4 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:536871559 0 0 0 415 0;} @font-face {font-family:"/@宋体"; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-priority:1; mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:""; margin-top:0cm; margin-right:0cm; margin-bottom:10.0pt; margin-left:0cm; mso-pagination:widow-orphan; font-size:11.0pt; mso-bidi-font-size:10.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:宋体; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} span.MsoPlaceholderText {mso-style-noshow:yes; mso-style-priority:99; mso-style-unhide:no; color:gray;} p.Publishwithline, li.Publishwithline, div.Publishwithline {mso-style-name:"Publish with line"; mso-style-noshow:yes; mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:16.0pt; mso-bidi-font-size:19.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:major-latin; mso-fareast-font-family:宋体; mso-fareast-theme-font:major-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:major-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:major-bidi; color:#17365D; mso-themecolor:text2; mso-themeshade:191; font-weight:bold;} p.PadderBetweenControlandBody, li.PadderBetweenControlandBody, div.PadderBetweenControlandBody {mso-style-name:"Padder Between Control and Body"; mso-style-noshow:yes; mso-style-unhide:no; mso-style-next:正文; margin-top:0cm; margin-right:0cm; margin-bottom:6.0pt; margin-left:0cm; mso-pagination:widow-orphan; font-size:1.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:宋体; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} p.underline, li.underline, div.underline {mso-style-name:underline; mso-style-noshow:yes; mso-style-unhide:no; mso-style-parent:""; margin-top:2.0pt; margin-right:0cm; margin-bottom:0cm; margin-left:0cm; margin-bottom:.0001pt; mso-pagination:widow-orphan; border:none; mso-border-bottom-alt:solid #4F81BD 1.0pt; mso-border-bottom-themecolor:accent1; padding:0cm; mso-padding-alt:0cm 0cm 2.0pt 0cm; font-size:1.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:宋体; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; font-size:11.0pt; mso-ansi-font-size:11.0pt; mso-bidi-font-size:10.0pt; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-font-kerning:0pt;} .MsoPapDefault {mso-style-type:export-only; margin-bottom:10.0pt;} /* Page Definitions */ @page {mso-page-border-surround-header:no; mso-page-border-surround-footer:no;} @page Section1 {size:595.3pt 841.9pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:36.0pt; mso-footer-margin:36.0pt; mso-paper-source:0;} div.Section1 {page:Section1;} -->

 

 

ELF header(ELF 头部)

Program header table(
程序头表)

Segment1
(段1

Segment2
(段2

………

Sengmentn
(段n

Setion header table(
节头表,可选)// 描述了映射加载关系,可由OBJDUMP 查看objdump -h 我的程序

Unix 系统在可执行文件的加载过程中,除了读取必要的头部信息,并没有任何从磁盘到存储器的数据拷贝,只是简单进行映射,知道 CPU 访问一个被映射的虚拟页产生缺页异常后,才进行拷贝。   

地址

作用

说明

>=0xc000 0000

内核虚拟存储器

系统保留区

<0xc000 0000

Stack (用户栈)

%EBP,%ESP

 

 

 

空闲/ 动态库也放在此

>=0x4000 0000

文件映射区

  只映射,page fault 后加载

<0x4000 0000

 

 

 

空闲

 

 

Heap( 运行时堆)

通过brk/sbrk 系统调用扩大堆,向上增长(malloc)

 

.data .bss( 读写段)

可执行文件中获取,重定位

>=0x0804 8000

.init .text.rodata( 只读段)

可执行文件中获取,重定位

<0x0804 8000

保留区域

 

C 程序的入口点是 _start ,这段启动代码是在目标文件 ctrl.o 中定义的。启动代码中首先调用初始化函数,然后调用 atexit 函数,用于注册在 exit 函数被调用 ( 程序退出 ) 时应该被调用的函数。最后,启动代码调用 main 函数,在 main 函数返回后,调用系统调用 _exit() ,将控制返回给操作系统。

 


http://www.niftyadmin.cn/n/4464093.html

相关文章

redis集群自动配置脚本

自动安装脚本&#xff1a; #!/bin/bash # if [[ $1 "" ]];then echo "Usage: $0 ipaddr***" exit 0 fi masterIp$1 cd /usr/local/src/ tar -zxvf redis-2.6.12.tar.gz cd /usr/local/src/redis-2.6.12 make && make install mkdir -p /etc/redis…

(转)need_resched 是怎么使用的(ZT)

终于在《情景》&think hard地情况下,想明白了&#xff01; 一 系统调用do_fork() 1 当前进程调用fork&#xff08;&#xff09;创建子进程&#xff0c;进入kernel 2 当前进程分一半多时间片给子进程&#xff0c; 3 如果当前进程时间片剩余为0&#xff0c;设定当前进程…

nginx环境下配置nagios-关于nginx.conf

nginx.conf配置 user nagios nagios; worker_processes 4; worker_cpu_affinity 00000001 00000010 00000100 00001000; error_log /export/servers/nginx/logs/nginx_error.log notice; pid /export/servers/nginx/l…

need_sched 一些讨论

我想写一个简单的设备驱动, 但对驱动模块的可重入方面不甚了解. 有的书说驱动模块不会被中断, 除非主动地调用schedule()(或是隐式 地调用, 如vmalloc()); 有的书则说即使schedule()被调用, 它也不会 去作进程切换, 因为schedule()不对内核态进程切换. 不知谁对? 望高人指…

nginx环境下配置nagios-关于nagios配置文件

接上文&#xff1a;nginx环境下配置nagios-关于nginx.conf nagios文件应该处于conf/domain/目录下 nagios配置如下&#xff1a; server {listen 80;server_name 192.168.44.44;index index.html index.htm index.php;root /usr/local/nagios/share;auth_basic "…

操作系统多级页表计算问题

某计算机有64位虚地址空间&#xff0c;页大小是2048B.每个页表项长为4B。因为所有页表都必须包含在一页中&#xff0c;故使用多级页表&#xff0c;问一共需要多少级&#xff1f; 最佳答案2048B2^11 64-1153&#xff08;地址中扣除页内地址位数&#xff09; 共有2^53页一页中可…

nginx环境下配置nagiosQL-关于nagiosql配置文件

接上文&#xff1a;nginx环境下配置nagios-关于nginx.conf nagiosql文件应该处于conf/domain/目录下 nagiosql配置如下&#xff1a; server {listen 8088;server_name 192.168.44.44;index index.html index.htm index.php;root /usr/local/nagios/nagiosql/;locatio…

函数ERR_PTR,PTR_ERR还有IS_ERR理解

ERR_PTR()和PTR_ERR()都是很简单的类型转换&#xff0c;没有什么可说的。 IS_ERR()有一些妙处。 内核中的函数常常返回指针&#xff0c;问题是如果出错&#xff0c;也希望能够通过返回的指针体现出来。 所幸的是&#xff0c;内核返回的指针一般是指向页面的边界(4K边界)&#x…