Linking with the mapfile option
The ELF linker
(ld)
automatically
maps input sections from object files (.o files)
to output segments in executable files (a.out files).
The mapfile option to the
ld
command
allows you to change the default mapping
provided by
the
ELF linker.
In particular, the mapfile option
allows you to:
-
declare segments and specify values for segment attributes
such as segment type, permissions,
addresses, length, and alignment
-
control mapping of input sections to segments by specifying the attribute values
necessary in a section to map to a specific segment
(the attributes are section name, section
type, and permissions)
and by specifying which object file(s) the input sections should be taken
from, if necessary
-
declare a global-absolute symbol that is assigned
a value equal to the size of a
specified segment (by the linker)
and that can be referenced from object files
NOTE:
The major purpose of the mapfile option is to allow users of ifiles
(an option previously available to
ld
that used link editor command language directives)
to convert to mapfiles.
All other facilities previously available for ifiles,
other than those mentioned above, are not available with the mapfile
option.
CAUTION:
When using the mapfile option,
be aware that you can easily create
a.out
files that do not execute.
Therefore, the use of the mapfile option is strongly discouraged.
ld
can produce a correct
a.out
without the use of the mapfile option.
The mapfile option is intended for system programming use,
not application programming use.
This appendix describes the structure and syntax of a mapfile and the
use of the -M option to the
ld
command.
Next topic:
Using the mapfile option
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004