A segment declaration creates a new segment in the a.out
or changes the attribute values of an existing segment.
(An existing segment is one that you previously defined or one of the
three built-in segments described below.)
A segment declaration has the following
For each segment_name, you can specify any number
of segment_attribute_values in any order, each
separated by a space.
(Only one attribute value is allowed for each segment attribute.)
The segment attributes and their valid values are as follows:
There are three built-in segments with the following default attribute values:
ld behaves as if these segments had been declared before your
mapfile is read in.
``Mapfile option defaults''
for more information.
physical_address, length, and
alignment values set to defaults per CPU type)
?RWX, virtual_address, physical_address,
length, and alignment values set to defaults per
Note the following when entering segment declarations:
A number can be hexadecimal, decimal, or octal, following the same
rules as in the C language.
No space is allowed between the
and the number.
The segment_type value can be either
The segment_type value defaults to
The segment_flags values are
R for readable,
W for writable, and
X for executable.
No spaces are allowed between the question mark and the individual flags
that make up the segment_flags value.
The segment_flags value for a
LOAD segment defaults to
NOTE segments cannot be assigned any segment attribute value
other than a segment_type.
Implicitly declared segments default to segment_type value
physical_address, length, and alignment values
set to defaults per CPU type.
calculates the addresses and length of the current segment based on the
previous segment's attribute values.
Also, even though implicitly declared segments default to
``no length limit'', any machine memory limitations still apply.
LOAD segments can have an explicitly specified virtual_address
physical_address value, as well as a maximum segment length
If a segment has a segment_flags value of
? with nothing following,
the value defaults
to not readable, not writable and not executable.
The alignment value is used in calculating the virtual address of the
beginning of the segment.
This alignment only affects the segment for which it is specified;
other segments still have the default alignment unless their
alignments are also changed.
If any of the virtual_address, physical_address, or length
attribute values are not set,
ld calculates these values as it builds the a.out.
If an alignment value is not specified for a segment, it is set to
the built-in default.
(The default differs from one CPU to another and
may even differ between kernel versions.
You should check the appropriate
documentation for these numbers).
If both a virtual_address and an alignment value are specified for a
segment, the virtual_address value takes priority.
If a virtual_address value is specified for a segment, the alignment field
in the program header contains the default alignment value.
If a virtual_address value is specified, the segment is placed at that
For the UNIX system kernel this creates a correct result.
For files that start via exec, this method creates an incorrect
because the segments do not have correct offsets relative to their
Mapfile structure and syntax
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003