Linker and Libraries Guide

Directive Syntax

Mapfile directives exist to specify many aspects of the output object. These directives share a common syntax, using name value pairs for attributes, and {...} constructs to represent hierarchy and grouping.

The syntax of mapfile directives is based on the following generic forms.

The simplest form is a directive name without a value.

        
directive;

The next form is a directive name with a value, or a white space separated list of values.

        
directive = value...;

In addition to the “=” assignment operator shown, the “+=” and “-=” forms of assignment are allowed. The “=” operator sets the given directive to the given value, or value list. The “+=” operator is used to add the value on the right hand side to the current value, and the “-=” operator is used to remove values.

More complex directives manipulate items that take multiple attributes enclosed within {...} brackets to group the attributes together as a unit.

        
directive [name] {
                attribute [directive = value];
                ...
        } [name];

There can be a name before the opening brace ({), which is used to name the result of the given statement. Similarly, one or more optional names can follow the closing brace (}), prior to the terminating semicolon (;). These names are used to express that the defined item has a relationship with other named items.

Note that the format for attributes within a grouping use the same syntax described above for simple directives with a value, with an assignment operator (=, +=, -=) followed by a value, or white space separated list of values, terminated with a semicolon (;).

A directive can have attributes that in turn have sub-attributes. In such cases, the sub-attributes are also grouped within nested {...} brackets to reflect this hierarchy.

        
directive [name] {
                attribute {
                        subatribute [= value];
                        ...
                };
        } [name...];

The mapfile syntax grammar puts no limit on the depth to which such nesting is allowed. The depth of nesting depends solely on the requirements of the directive.