Mapfile Option Defaults
The link-editor defines four built-in segments (text, data, bss and note) with default segment_attribute_values and corresponding default mapping directives. Even though the link-editor does not use an actual mapfile to provide the defaults, the model of a default mapfile helps illustrate what happens when the link-editor encounters your mapfile.
The following example shows how a mapfile would appear for the link-editor defaults. The link-editor begins execution behaving as if the mapfile has already been read in. Then the link-editor reads your mapfile and either augments or makes changes to the defaults.
text = LOAD ?RX;
text : ?A!W;
data = LOAD ?RWX;
data : ?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.
-
If the segment does not already exist in the
mapfilebut another with the same segment-type value exists, the segment is added before all of the existing segments of the samesegment_type. -
If none of the segments in the existing
mapfilehas the samesegment_typevalue as the segment just read in, then the segment is added bysegment_typevalue to maintain the following order.INTERPLOADDYNAMICNOTE -
If the segment is of
segment_typeLOADand you have defined avirtual_addressvalue for thisLOADable segment, the segment is placed before anyLOADable segments without a definedvirtual_addressvalue or with a highervirtual_addressvalue, but after any segments with avirtual_addressvalue that is lower.
As each mapping directive in a 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.