什么是" AW"在部分标志属性是什么意思?

什么是" 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?

的section(\"section-name\")$c$c>属性通过产生以下汇编行放置一个变量在一个特定的部分:

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伪充分说明code>指令。一般的语法为

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)

所有上述也适用于functions,不只是变量。

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