8.1.1 Sections
The compiler produces relocatable blocks of code and data called sections. The sections are allocated into memory in a variety of ways to conform to a variety of system configurations. For more information about sections and allocating them, see the introductory object file information in the TMS320C6000 Assembly Language Tools User's Guide.
There are two basic types of sections:
- Initialized sections contain data or executable code. Initialized sections are usually, but not always, read-only. The C/C++ compiler creates the following initialized sections:
- The .args section contains the command argument for a host-based loader. This section is read-only. See the --arg_size option for details.
- The .binit section contains boot time copy tables. This is a read-only section. For details on BINIT, see the TMS320C6000 Assembly Language Tools User's Guide.
- The .cinit section is created only if you are using the --rom_model option. It contains tables for explicitly initialized global and static variables.
- The .init_array section contains the table for calling global constructors.
- The .ovly section contains copy tables other than boot time (.binit) copy tables. This is a read-only section.
- The .c6xabi.exidx section contains the index table for exception handling. The .c6xabi.extab section contains stack unwinding instructions for exception handling. These sections are read-only. See the --exceptions option for details.
- The .name.load section contains the compressed image of section name. This section is read-only. See the TMS320C6000 Assembly Language Tools User's Guide for information on copy tables.
- The .ppinfo section contains correlation tables and the .ppdata section contains data tables for compiler-based profiling. See the --gen_profile_info option for details.
- The .const section contains string literals, floating-point constants, and data defined with the C/C++ qualifiers far and const (provided the constant is not also defined as volatile or one of the exceptions described in Section 7.5.2). This is a read-only section. String literals are placed in the .const:.string subsection to enable greater link-time placement control.
- The .fardata section reserves space for non-const, initialized far global and static variables.
- The .neardata section reserves space for non-const, initialized near global and static variables.
- The .rodata section reserves space for const near global and static variables.
- The .switch section contains jump tables for large switch statements.
- The .text section contains all the executable code and compiler-generated constants. This section is usually read-only.
- The .TI.crctab section contains CRC checking tables. This is a read-only section.
- Uninitialized sections reserve space in memory (usually RAM). A program can use this space at run time to create and store variables. The compiler creates the following uninitialized sections:
- The .bss section reserves space for uninitialized global and static variables. Uninitialized variables that are also unused are usually created as common symbols (unless you specify --common=off) instead of being placed in .bss so that they can be excluded from the resulting application.
- The .far section reserves space for global and static variables that are declared far.
- The .stack section reserves memory for the system stack.
- The .sysmem section reserves space for dynamic memory allocation. The reserved space is used by dynamic memory allocation routines, such as malloc(), calloc(), realloc(), or new(). If a C/C++ program does not use these functions, the compiler does not create the .sysmem section.
NOTE
Use Only Code in Program Memory
With the exception of code sections, the initialized and uninitialized sections cannot be allocated into internal program memory.
The assembler creates the default sections .text, .bss, and .data. You can instruct the compiler to create additional sections by using the CODE_SECTION and DATA_SECTION pragmas (see Section 7.9.4 and Section 7.9.7).