Mapfile Structure and Syntax

You can enter the following basic types of directives into a mapfile.

  • Segment declarations.

  • Mapping directives.

  • Section-to-segment ordering.

  • Size-symbol declarations.

  • File control directives.

Each directive can span more than one line and can have any amount of white space, including new lines, as long as that white space is followed by a semicolon.

Typically, segment declarations are followed by mapping directives. You declare a segment and then define the criteria by which a section becomes part of that segment. If you enter a mapping directive or size-symbol declaration without first declaring the segment to which you are mapping, except for built-in segments, the segment is given default attributes. Such segment is an implicitly declared segment.

Size-symbol declarations and file control directives can appear anywhere in a mapfile.

The following sections describe each directive type. For all syntax discussions, the following notations apply.

  • All entries in constant width, all colons, semicolons, equal signs, and at (@) signs are typed in literally.

  • All entries in italics are substitutable.

  • { .... }* means "zero or more".

  • { .... }+ means "one or more".

  • [ .... ]  means "optional".

  • section_names and segment_names follow the same rules as C identifiers, where a period (.) is treated as a letter. For example, .bss is a legal name.

  • section_names, segment_names, file_names, and symbol_names are case sensitive. Everything else is not case sensitive.

  • Spaces, or new-lines, can appear anywhere except before a number or in the middle of a name or value.

  • Comments beginning with # and ending at a newline can appear anywhere that a space can appear.