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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…