Mapfile Structure and Syntax
Mapfile
directives can span more than one line, and can
have any amount of white space, including new lines.
For all syntax discussions, the following notations apply.
-
Spaces, or newlines, can appear anywhere except in the middle of a name or value.
-
Comments beginning with a hash character (
#
) and ending at a newline can appear anywhere that a space can appear. Comments are not interpreted by the link-editor, and exist solely for documentation purposes. -
All directives are terminated by a semicolon (
;
). The final semicolon within a{....}
section can be omitted. -
All entries in constant width, all colons (
:
), semicolons (;
), assignment (=, +=, -=
), and{....}
brackets are typed in literally. -
All entries in italics are substitutable.
-
[ .... ]
brackets are used to delineate optional syntax. The brackets are not literal, and do not appear in the actual directives. -
Names are case sensitive strings. Table 10-2 contains a list of names and other strings commonly found in
mapfiles
. Names can be specified in three different forms.-
Unquoted
An unquoted name is a sequence of letters and digits. The first character must be a letter, followed by zero or more letters or digits. The characters percent (
%
), slash (/
), period (.
), and underscore (_
) count as a letter. The characters dollar ($
), and hyphen (-
) count as a digit. -
Single Quotes
Within single quotes (
'
), a name can contain any character other than a single quote, or newline. All characters are interpreted as literal characters. This form of quoting is convenient when specifying file paths, or other names that contain normal printable characters that are not allowed in an unquoted name. -
Double Quotes
Within double quotes (
"
), a name can contain any character other than a double quote, or newline. Backslash(\
) is an escape character which operates similarly to the way it is used in the C programming language within a string literal. Characters prefixed by a backslash are replaced by the character they represent, as shown in Table 10-1. Any character following a backslash, other than the ones shown in Table 10-1 is an error.
-
-
value represents a numeric value, and can be hexadecimal, decimal, or octal, following the rules used by the C language for integer constants. All values are unsigned integer values, and are 32-bit for 32-bit output objects, and 64-bit for 64-bit output objects.
-
segment_flags specify memory access permissions as a space separated list of one or more of the values given in Table 10-3, which correspond to the
PF_
values defined in<sys/elf.h>
.
Table 10-1 Double Quoted Text Escape Sequences
Escape Sequence | Meaning |
---|---|
|
alert (bell) |
|
backspace |
|
formfeed |
|
newline |
|
return |
|
horizontal tab |
|
vertical tab |
\\ |
backslash |
\' |
single quote |
\" |
double quote |
\ooo |
An octal constant, where ooo is one to three octal digits (0....7) |
Table 10-2 Names And Other Widely Used Strings Found In Mapfiles
Name | Purpose |
---|---|
segment_name |
Name of ELF segment |
section_name |
Name of ELF section |
symbol_name |
Name of ELF symbol |
file_path |
A UNIX file path of slash (/) delimited names used to reference an ELF object, or an archive that contains ELF objects |
file_basename |
Final component (basename(1)) of a file_path |
objname |
Either a file_basename or the name of an object contained within an archive |
soname |
Sharable object name, as used for the |
version_name |
Name of a symbol version, as used within an ELF versioning section |
inherited_version_name |
Name of a symbol version inherited by another symbol version |
Table 10-3 Segment Flags
Flag Value | Meaning |
---|---|
|
Segment is readable |
|
Segment is writable |
|
Segment is executable |
|
All permission flags are cleared |
|
The combination of |
|
The combination of |