GNU汇编程序中的分段
2012-06-18 13:36
381 查看
GNU汇编程序中的分段
<1> .section伪操作
.section <section_name> {,”<flags>”}
Starts a new code or data section. Sections in GNU are called .text, a code section, .data, an initialized data section, and .bss, an uninitialized data section.
These sections have default flags, and the linker understands the default names(similar directive to the armasm directive AREA).The following are allowable .section flags for ELF format files:
<Flag> Meaning
a allowable section
w writable section
x executable section
中文解释:
用户可以通过.section伪操作来自定义一个段,格式如下:.section section_name [, "flags"[, %type[,flag_specific_arguments]]]
每一个段以段名为开始, 以下一个段名或者文件结尾为结束。这些段都有缺省的标志(flags),连接器可以识别这些标志。(与arm asm中的AREA相同)。下面是ELF格式允许的段标志flags:
<标志> 含义
a 允许段
w 可写段
x 执行段
例:定义一个“段”
.section .mysection @自定义数据段,段名为 “.mysection”
.align 2
strtemp:
.ascii "Temp string \n\0" @对这一句的理解,我觉得应该是:将"Temp string \n\0"这个字符串存储在以标号strtemp:
@为起始地址的一段内存空间里
<2> 汇编系统预定义的段名
l .text @代码段
l .data @初始化数据段 .data Read-write initialized long data.
l .bss @未初始化数据段
l .sdata @ .sdata Read-write initialized short data.
l .sbss @
注意:源程序中.bss段应该在.text段之前。
<1> .section伪操作
.section <section_name> {,”<flags>”}
Starts a new code or data section. Sections in GNU are called .text, a code section, .data, an initialized data section, and .bss, an uninitialized data section.
These sections have default flags, and the linker understands the default names(similar directive to the armasm directive AREA).The following are allowable .section flags for ELF format files:
<Flag> Meaning
a allowable section
w writable section
x executable section
中文解释:
用户可以通过.section伪操作来自定义一个段,格式如下:.section section_name [, "flags"[, %type[,flag_specific_arguments]]]
每一个段以段名为开始, 以下一个段名或者文件结尾为结束。这些段都有缺省的标志(flags),连接器可以识别这些标志。(与arm asm中的AREA相同)。下面是ELF格式允许的段标志flags:
<标志> 含义
a 允许段
w 可写段
x 执行段
例:定义一个“段”
.section .mysection @自定义数据段,段名为 “.mysection”
.align 2
strtemp:
.ascii "Temp string \n\0" @对这一句的理解,我觉得应该是:将"Temp string \n\0"这个字符串存储在以标号strtemp:
@为起始地址的一段内存空间里
<2> 汇编系统预定义的段名
l .text @代码段
l .data @初始化数据段 .data Read-write initialized long data.
l .bss @未初始化数据段
l .sdata @ .sdata Read-write initialized short data.
l .sbss @
注意:源程序中.bss段应该在.text段之前。
相关文章推荐
- GNU汇编程序中的分段
- GNU汇编程序中的分段(.section伪操作)
- GNU汇编程序中的分段
- 汇编程序:成绩分段统计
- [中级教程]GNU ARM汇编程序开发之----几个常用的指令
- ARM学习笔记11——GNU ARM汇编程序设计
- [Intel汇编-MASM]数据定义与分段程序
- 用汇编写的计算阶乘N!的程序
- 8086汇编 开机启动程序(裸机运行)
- 一个简单的汇编程序
- 从汇编看一个小程序的完整执行过程
- 没事情。。把今天实验搞定的冒泡法排序汇编程序晒晒好了
- 汇编学习--7.10--程序编写
- 汇编中数据,代码,栈放入不同段程序代码测试
- 怎么用汇编编一个1+1=2的程序
- 我的第一个汇编程序-Hello,World!
- 汇编语言32位控制台读取用户输入字符程序代码分析(17)
- 汇编程序:查表法找ASCII
- 使用Gnu gprof进行Linux平台下的程序分析
- 汇编实验:屏幕窗口程序