什么是" AW"在部分标志属性是什么意思? [英] What does the "aw" flag in the section attribute mean?

查看:31025
本文介绍了什么是" AW"在部分标志属性是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在code的下面一行(这里声明了一个全局变量),

In the following line of code (which declares a global variable),

unsigned int __attribute__((section(".myVarSection,\"aw\",@nobits#"))) myVar;

什么是仙的标志呢?

what does the "aw" flag mean?

我的理解是,NOBITS标志将prevent变量被初始化为零,但我在努力寻找有关AW标志的信息。

My understanding is that the nobits flag will prevent the variable from being initialised to zero, but I am struggling to find info about the "aw" flag.

此外,什么意思做@#和周围有NOBITS标志?

Also, what meaning do the @ and # have around the nobits flag?

推荐答案

的<一个href=\"http://gcc.gnu.org/onlinedocs/gcc/Variable-Attributes.html#index-g_t_0040$c$c_007bsection_007d-variable-attribute-2696\"><$c$c>section(\"section-name\")属性通过产生以下汇编行放置一个变量在一个特定的部分:

The section("section-name") attribute places a variable in a specific section by producing the following assembler line:

.section    section-name,"aw",@progbits

当您设置版块名称。myVarSection,\\仙\\,@ NOBITS#您在GCC开发一种 code注射液制作:

When you set section-name to ".myVarSection,\"aw\",@nobits#" you exploit a kind of "code injection" in GCC to produce:

.section    .myVarSection,"aw",@nobits#,"aw",@progbits

注意号开始单行注释。

请参阅 GNU汇编手册的.section伪指令。一般的语法为

See GNU Assembler manual for the full description of .section directive. A general syntax is

.section name [, "flags"[, @type[,flag_specific_arguments]]]

所以AW的标志:


  • :部分可分配

  • 是W :部分是可写的

  • a: section is allocatable
  • w: section is writable

@nobits 是一种类型:


  • @nobits :部分不包含数据(即,部分只占用空间)

  • @nobits: section does not contain data (i.e., section only occupies space)

所有上述也适用于<一href=\"http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html#index-g_t_0040$c$c_007bsection_007d-function-attribute-2607\">functions,不只是变量。

All the above is also applicable to functions, not just variables.

这篇关于什么是&QUOT; AW&QUOT;在部分标志属性是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆