Mapfile option

Mapfile option defaults

The ld command has three built-in segments (text, data, and note) with default segment_attribute_values and corresponding default mapping directives as described under ``Segment declarations''. Even though the ld command does not use an actual ``mapfile'' to store the defaults, the model of a ``default mapfile'' helps to illustrate what happens when the ld command encounters your mapfile.

``Default mapfile'' shows how a mapfile would appear for the ld command defaults. The ld command begins execution behaving as if the mapfile in ``Default mapfile'' has already been read in. Then ld reads your mapfile and either augments or makes changes to the defaults.

CAUTION: The interp segment, which precedes all others, and the dynamic segment, which follows the data segment, are not shown in ``Default mapfile'' and ``Simple map structure'' because you cannot manipulate them.

Default mapfile

text = LOAD ?RX;
text : $PROGBITS ?A!W;

data = LOAD ?RWX; data : $PROGBITS ?AW; data : $NOBITS ?AW;

note = NOTE; note : $NOTE;

As each segment declaration in your mapfile is read in, it is compared to the existing list of segment declarations as follows:

  1. If the segment does not already exist in the mapfile, but another with the same segment-type value exists, the segment is added before all of the existing segments of the same segment_type.

  2. If none of the segments in the existing mapfile has the same segment_type value as the segment just read in, then the segment is added by segment_type value to maintain the following order:

    1. INTERP
    2. LOAD
    3. DYNAMIC
    4. NOTE

  3. If the segment is of segment_type LOAD and you have defined a virtual_address value for this LOADable segment, the segment is placed before any LOADable segments without a defined virtual_address value or with a higher virtual_address value, but after any segments with a virtual_address value that is lower.
As each mapping directive in your mapfile is read in, the directive is added after any other mapping directives that you already specified for the same segment but before the default mapping directives for that segment.

Next topic: Internal map structure
Previous topic: Clean user-defined mapfile

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