The link-editor automatically and intelligently maps input sections from relocatable objects to segments within the output file object. The -M option with an associated mapfile allows you to change the default mapping provided by the link-editor.
In particular, this 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 link-editor) and that can be referenced from object files.
The mapfile option allows users of ifiles (an option previously available to the link-editor that used 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.
When using the mapfile option, be aware that you can easily create a.out files that do not execute. The link-editor knows how to 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.