Go to main content

Oracle® Solaris 11.3 Linkers and Libraries Guide

Exit Print View

Updated: March 2018
Chapter 10

Mapfiles in the Link-Editor

Mapfiles provide a large degree of control over the operation of the link-editor, and the resulting output object.

  • Create and/or modify output segments.

  • Define how input sections are assigned to segments, and the relative order of those sections.

  • Specify symbol scope and/or versioning, creating stable backward compatible interfaces for sharable objects.

  • Define the versions to use from sharable object dependencies.

  • Set header options in the output object.

  • Set process stack attributes for an executable.

  • Set or override hardware and software capabilities.

Note -  The link-editor used without a mapfile will always produce a valid ELF output file. The mapfile option provides the user with a great deal of flexibility and control over the output object, some of which has the potential to produce an invalid or unusable object. The user is expected to have knowledge of the rules and conventions that govern the ELF format.

The –M command line option is used to specify the mapfile to be used. Multiple mapfiles can be used in a single link operation. When more than one mapfile is specified, the link-editor processes each one in the order given, as if they represented a single logical mapfile. This occurs before any input objects are processed.

The system provides sample mapfiles for solving common problems in the /usr/lib/ld directory.