16.1.1 Section Directive (Deprecated Form)

The .section name [, flags] [, @type] directive assembles the following code into a section named name. This form of the directive should not be used in new code. Use the alternate form, discussed in 5.1.5  Section Directive. The optional flags argument is a quoted string which may contain any combination of the following characters:

a section is allocatable

w section is writable

x section is executable

The @type argument may be one of:

@progbits Normal section with contents

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

The following section names are recognized:

Table 16-1. Section Names
Section Name Default Flag
.text x
.data d
.bss b
Note: Ensure that double quotes are used around flags. If the optional argument to the .section directive is not quoted, it is taken as a sub-section number. Remember, a single character in single quotes (i.e., ‘b’) is converted by the preprocessor to a number.

Section Directive Examples

.section foo,"aw",@progbits #foo is initialized
#data memory.
.section fob,"aw",@nobits #fob is uninitialized
#(but also not zeroed)
#data memory.
.section bar,"ax",@progbits #bar is in program memory