Allocation algorithm
An output section is formed as a result of a
SECTIONS directive, by combining input sections of
the same name, or by combining .text and .init
into .text.
An output section can consist of zero or more input sections.
After the composition of an output section is determined, it must
then be allocated into configured virtual memory.
The COFF link editor uses an algorithm that attempts to minimize
fragmentation of memory, and hence increase the possibility that a
link edit run will be able to allocate all output sections within
the specified virtual memory configuration.
The algorithm proceeds as follows:
If all memory is contiguous and configured (the default case),
and no SECTIONS directives are given, then output
sections are allocated in the order they appear to ld.