10.2.3 Allocating Unmapped Sections
After all sections that appear in the section map are allocated, any
remaining sections are considered to be unmapped. Unmapped sections are allocated according
to section attributes. The linker uses a best-fit memory allocator to determine the most
efficient arrangement in memory. The primary emphasis of the best-fit allocator is the
reduction or elimination of memory gaps due to address alignment restrictions. By
convention, most standard sections such as the .text
,
.data
, .bss
, or
.ramfunc
section are not explicitly mapped in linker
scripts, thus providing maximum flexibility for the best-fit memory allocator. The
exception is the “small” data sections used for gp-
relative addressing. Because these
sections must be grouped together, they are mapped in the linker script.
Section attributes affect memory allocation as described below. For a general discussion of section attributes, see 16.1 Assembler Directives that Define Sections.