1 Intro
The smallest unit of an object file is a section. A section is a block of code or data that occupies contiguous space in the memory map.
.text section contains executable code
.data section usually contains initialized data
.bss section usually reserves space for uninitialized variables
There are two basic types of sections:
- Initialized sections: contain data or code. The .text and .data sections are initialized; user-named sections created with the .sect and .intvec assembler directives are also initialized.
- Uninitialized sections: reserve space in the memory map for uninitialized data. The .bss section is uninitialized; user-named sections created with the .usect assembler directive are also uninitialized.
2 Special sections
A few common special sections are:
• .text -- Used for program code.
• .bss -- Used for uninitialized objects (global variables).
• .data -- Used for initialized non-const objects (global variables).
• .const -- Used for initialized const objects (string constants, variables declared const).
• .cinit -- Used to initialize C global variables at startup.
• .stack -- Used for the function call stack.
• .sysmem - Used for the dynamic memory allocation pool.