GNU风格 ARM汇编语法3

3、 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>汇编系统预定义的段名 .text @代码段 .data @初始化数据段 .data Read-write initialized long data. .bss @未初始化数据段 .sdata @ .sdata Read-write initialized short data. .sbss @     注意:源程序中.bss段应该在.text段之前。

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值