10.1.6 Building the Output File

Finally, the linker builds the output file. Relocation entries in each section are patched using absolute addresses. If the address computed for a symbol does not fit in the relocation entry, a link error results. This can occur, for example, when one module references a variable which it thinks is in a “small data” section, while the other defines it in a non-small section.

A link map is also generated if requested with the -Map linker option. The link map includes a memory usage report, which shows the starting address and length of all sections in data memory and program memory. An additional memory-usage report by module is included, which shows the memory usage of each input object in the final ELF output. For more information about the link map, see 7.3.5 Map File.