SPRUIG8J January 2018 – March 2024
The MEMORY and SECTIONS directives provide flexible ways to build, combine, and allocate sections. However, any memory locations or sections you choose not to specify must still be handled by the linker. The linker uses algorithms to build and allocate sections in coordination with any specifications you do supply.
If you do not use the MEMORY and SECTIONS directives, the linker allocates sections starting at a memory address near zero. It begins by placing .text sections and then places the various data sections after that.
See Section 8.4.1 for information about default memory allocation.
All .text input sections are concatenated to form a .text output section in the executable output file, and all .data input sections are combined to form a .data output section.
If you use a SECTIONS directive, allocation is performed according to the rules specified by the SECTIONS directive and the general algorithm described next in Section 12.7.1.