Mapfile option

Internal map structure

One of the most important data structures in the ELF-based ld is the map structure. A default map structure, corresponding to the model default mapfile mentioned above, is used by ld when the command is executed. Then, if the mapfile option is used, ld parses the mapfile to augment and/or override certain values in the default map structure.

A typical (although somewhat simplified) map structure is illustrated in ``Simple map structure''. The ``Entrance Criteria'' boxes correspond to the information in the default mapping directives and the ``Segment Attribute Descriptors'' boxes correspond to the information in the default segment declarations. The ``Output Section Descriptors'' boxes give the detailed attributes of the sections that fall under each segment. The sections themselves are in circles.

Simple map structure

ld performs the following steps when mapping sections to segments:

  1. When a section is read in, ld checks the list of Entrance Criteria looking for a match. (All specified criteria must match):

  2. When the section falls into a segment, ld checks the list of existing Output Section Descriptors in that segment as follows:

  3. If a segment contains no sections after all of the command line object files and libraries have been read in, no program header entry is produced for that segment.

NOTE: Note that input sections of type $SYMTAB, $STRTAB, $REL, and $RELA are used internally by ld. Directives that refer to these section_types can only map output sections produced by ld to segments.

Next topic: Error messages
Previous topic: Default mapfile

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003