Specifying Where to Allocate Sections in Memory

The compiler produces relocatable blocks of code and data. These blocks, called sections, are allocated in memory in a variety of ways to conform to a variety of system configurations. See Section 6.1.1 for a complete description of how the compiler uses these sections.

The compiler creates two basic kinds of sections: initialized and uninitialized. Table 11-1 summarizes the initialized sections. Table 11-2 summarizes the uninitialized sections.

Table 11-1 Initialized Sections Created by the Compiler

Name Contents
.args Reserved space for copying command line arguments before the main() function is called by the boot routine. See Section 3.6.
.binit Boot time copy tables (See Section 12.8.4.2 for information on BINIT in linker command files.)
.c7xabi.exidx Index table for exception handling; read-only (see --exceptions option).
.c7xabi.extab Unwinding instructions for exception handling; read-only (see --exceptions option).
.cinit The compiler does not generate a .cinit section unless the --rom_mode linker option is specified. If --rom_mode is specified, the linker creates this section, which contains tables for explicitly initialized global and static variables.
.const Global and static const variables, including string constants and initializers for local variables.
.data Global and static non-const variables that are explicitly initialized.
.got Global offset table.
.init_array Table of constructors to be called at startup.
.name.load Compressed image of section name; read-only (See Section 12.8 for information on copy tables.)
.ovly Copy tables other than boot time (.binit) copy tables. Read-only data.
.TI.crctab Generated CRC checking tables. Read-only data.

Table 11-2 Uninitialized Sections Created by the Compiler

Name Contents
.bss Uninitialized global and static variables
.cio Buffers for stdio functions from the run-time support library
.stack
.sysmem Memory pool (heap) for dynamic memory allocation (malloc, etc)

When you link your program, you must specify where to allocate the sections in memory. In general, initialized sections are linked into ROM or RAM; uninitialized sections are linked into RAM.

The linker provides MEMORY and SECTIONS directives for allocating sections. For more information about allocating sections into memory, see Section 12.5.