in which they are specified in the mapfile. The linker maps out the input sections in the same order as their matching entrance criteria.

Figure 31 Map Structure

Figure 31 (page 199) shows the map structure. The entrance criteria boxes correspond to the information from the section mapping directives and the segment attribute descriptors correspond to the information from the segment declarations. The output section descriptors boxes group the sections that fall under each segment based on their section attributes. The linker associates each entrance criteria with a list of "output section descriptors".Figure 31 (page 199) , the entrance criteria are labeled with numbers to illustrate their associated output section descriptors.

The linker performs the following steps when mapping sections to segments:

1.When a section is read in, the linker checks the list of entrance criteria looking for a match. All specified criteria must be matched. When an entrance criteria matches, the linker traverses its associated "output section descriptor" list.

2.If the section attribute values match those of an existing output section descriptor exactly, the linker places the section at the end of the list of sections associated with that output section descriptor.

3.If no matching output section descriptor is found, but output section descriptors of the same section_type exists, the linker creates a new output section descriptor with the same attribute values as the section and adds that section to the new output section descriptor. It places the new output section descriptor after the last output section descriptor with the same section type.

4.If no other output section descriptor of the indicated section_type exists, the linker creates a new output section descriptor and associates the section with the new output section descriptor.

Internal Map Structure 199