ld.info: MRI

Go forward to GNU Free Documentation License
Go backward to Reporting Bugs
Go up to Top
Go to the top op ld

MRI Compatible Script Files

   To aid users making the transition to GNU `ld' from the MRI linker,
`ld' can use MRI compatible linker scripts as an alternative to the
more general-purpose linker scripting language described in *Note
Scripts::.  MRI compatible linker scripts have a much simpler command
set than the scripting language otherwise used with `ld'.  GNU `ld'
supports the most commonly used MRI linker commands; these commands are
described here.
   In general, MRI scripts aren't of much use with the `a.out' object
file format, since it only has three sections and MRI scripts lack some
features to make use of them.
   You can specify a file containing an MRI-compatible script using the
`-c' command-line option.
   Each command in an MRI-compatible script occupies its own line; each
command line starts with the keyword that identifies the command (though
blank lines are also allowed for punctuation).  If a line of an
MRI-compatible script begins with an unrecognized keyword, `ld' issues
a warning message, but continues processing the script.
   Lines beginning with `*' are comments.
   You can write these commands using all upper-case letters, or all
lower case; for example, `chip' is the same as `CHIP'.  The following
list shows only the upper-case form of each command.
`ABSOLUTE SECNAME'
`ABSOLUTE SECNAME, SECNAME, ... SECNAME'
     Normally, `ld' includes in the output file all sections from all
     the input files.  However, in an MRI-compatible script, you can
     use the `ABSOLUTE' command to restrict the sections that will be
     present in your output program.  If the `ABSOLUTE' command is used
     at all in a script, then only the sections named explicitly in
     `ABSOLUTE' commands will appear in the linker output.  You can
     still use other input sections (whatever you select on the command
     line, or using `LOAD') to resolve addresses in the output file.
`ALIAS OUT-SECNAME, IN-SECNAME'
     Use this command to place the data from input section IN-SECNAME
     in a section called OUT-SECNAME in the linker output file.
     IN-SECNAME may be an integer.
`ALIGN SECNAME = EXPRESSION'
     Align the section called SECNAME to EXPRESSION.  The EXPRESSION
     should be a power of two.
`BASE EXPRESSION'
     Use the value of EXPRESSION as the lowest address (other than
     absolute addresses) in the output file.
`CHIP EXPRESSION'
`CHIP EXPRESSION, EXPRESSION'
     This command does nothing; it is accepted only for compatibility.
`END'
     This command does nothing whatever; it's only accepted for
     compatibility.
`FORMAT OUTPUT-FORMAT'
     Similar to the `OUTPUT_FORMAT' command in the more general linker
     language, but restricted to one of these output formats:
       1. S-records, if OUTPUT-FORMAT is `S'
       2. IEEE, if OUTPUT-FORMAT is `IEEE'
       3. COFF (the `coff-m68k' variant in BFD), if OUTPUT-FORMAT is
          `COFF'
`LIST ANYTHING...'
     Print (to the standard output file) a link map, as produced by the
     `ld' command-line option `-M'.
     The keyword `LIST' may be followed by anything on the same line,
     with no change in its effect.
`LOAD FILENAME'
`LOAD FILENAME, FILENAME, ... FILENAME'
     Include one or more object file FILENAME in the link; this has the
     same effect as specifying FILENAME directly on the `ld' command
     line.
`NAME OUTPUT-NAME'
     OUTPUT-NAME is the name for the program produced by `ld'; the
     MRI-compatible command `NAME' is equivalent to the command-line
     option `-o' or the general script language command `OUTPUT'.
`ORDER SECNAME, SECNAME, ... SECNAME'
`ORDER SECNAME SECNAME SECNAME'
     Normally, `ld' orders the sections in its output file in the order
     in which they first appear in the input files.  In an
     MRI-compatible script, you can override this ordering with the
     `ORDER' command.  The sections you list with `ORDER' will appear
     first in your output file, in the order specified.
`PUBLIC NAME=EXPRESSION'
`PUBLIC NAME,EXPRESSION'
`PUBLIC NAME EXPRESSION'
     Supply a value (EXPRESSION) for external symbol NAME used in the
     linker input files.
`SECT SECNAME, EXPRESSION'
`SECT SECNAME=EXPRESSION'
`SECT SECNAME EXPRESSION'
     You can use any of these three forms of the `SECT' command to
     specify the start address (EXPRESSION) for section SECNAME.  If
     you have more than one `SECT' statement for the same SECNAME, only
     the _first_ sets the start address.