10.4.1 Standard Data Section Names

Traditionally, linkers based on the GNU technology support three sections in the linked binary file:

Table 10-1. Traditional Section Names
Section Name Description Attribute
.text executable code code
.data data memory that receives initial values data
.bss data memory that is not initialized bss

The name “bss” dates back several decades, and means memory “Block Started by Symbol”. By convention, bss memory is filled with zeros during program start-up. The traditional section names are considered to have implied attributes as listed in the table above. The code section attribute indicates that the section contains executable code and should be loaded in program memory. The bss attribute indicates that the section contains data storage that is not initialized, but will be filled with zeros at program start-up. The data attribute indicates that the section contains data storage that receives initial values at start-up.

Assembly applications may define additional sections with explicit attributes using the section directive described in 5.1 Directives that Define Sections. For C applications, the XC32 compiler will automatically define sections to contain variables and functions as needed. For more information on the attributes of variables and functions that may result in automatic section definition, see the C compiler guide relevant for your target device.

Note: Whenever a section directive is used, all declarations that follow are assembled into the named section. This continues until another section directive appears, or the end of file. For more information on defining sections and section attributes, see 5.1 Directives that Define Sections.