“aw"是什么意思?部分属性中的标志是什么意思? [英] What does the "aw" flag in the section attribute mean?
问题描述
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?
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.
Also, what meaning do the @ and # have around the nobits flag?
The section("section-name")
attribute places a variable in a specific section by producing the following assembler line:
.section section-name,"aw",@progbits
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
Note that #
sign starts a one-line comment.
See GNU Assembler manual for the full description of .section
directive. A general syntax is
.section name [, "flags"[, @type[,flag_specific_arguments]]]
so "aw"
are flags:
- a: section is allocatable
- w: section is writable
and @nobits
is a type:
- @nobits: section does not contain data (i.e., section only occupies space)
All the above is also applicable to functions, not just variables.
这篇关于“aw"是什么意思?部分属性中的标志是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!