5.1.5 Section Directive

The .section assembler directive is used to define a new section or switch to an existing section in the output file. The general form of the .section directive is as follows:
.section name[, "flags"[, %type]]
where the components are as follows:
name
This is the name of the section you want to create or switch to. Section names are typically strings and can be user-defined or standard names like .text, .data, .bss, etc.
flags
This is an optional string that specifies the attributes of the section.
type
This is an optional argument that specifies the section type. It is preceded by the % symbol.
The section flags are enclosed in double quotes and can include one or more of the following characters:
a
Is allocatable—the section will be loaded into memory during execution.
w
Is writable—the section can be written to during execution.
x
Is executable—the section contains executable code.
T
TLS (Thread-Local Storage)—the section contains thread-local storage data.
The commonly used section types include:
progbits
The section contains data or code.
nobits
The section does not occupy space in the file but is allocated in memory (e.g., .bss).
note
The section contains note information.
init_array
The section contains pointers to initialization functions.

If the optional arguments are not present, the section attributes depend on the section name. A table of reserved section names is given in Section Mapping. If the section name is not recognized as a reserved name, the section counts as an "info" section and is ignored for the purposes of allocation and initialization.

If the first optional argument is quoted, it is taken as one or more flags that describe the section attributes, as detailed above. If the first optional argument is not quoted, it is taken as the first element of a extended attribute list, whose meaning is described in the next section.