You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
145 lines
9.5 KiB
HTML
145 lines
9.5 KiB
HTML
4 years ago
|
<html lang="en">
|
||
|
<head>
|
||
|
<title>MRI - Untitled</title>
|
||
|
<meta http-equiv="Content-Type" content="text/html">
|
||
|
<meta name="description" content="Untitled">
|
||
|
<meta name="generator" content="makeinfo 4.13">
|
||
|
<link title="Top" rel="start" href="index.html#Top">
|
||
|
<link rel="prev" href="Reporting-Bugs.html#Reporting-Bugs" title="Reporting Bugs">
|
||
|
<link rel="next" href="GNU-Free-Documentation-License.html#GNU-Free-Documentation-License" title="GNU Free Documentation License">
|
||
|
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
||
|
<!--
|
||
|
This file documents the GNU linker LD
|
||
|
(GNU Binutils)
|
||
|
version 2.26.
|
||
|
|
||
|
Copyright (C) 1991-2015 Free Software Foundation, Inc.
|
||
|
|
||
|
Permission is granted to copy, distribute and/or modify this document
|
||
|
under the terms of the GNU Free Documentation License, Version 1.3
|
||
|
or any later version published by the Free Software Foundation;
|
||
|
with no Invariant Sections, with no Front-Cover Texts, and with no
|
||
|
Back-Cover Texts. A copy of the license is included in the
|
||
|
section entitled ``GNU Free Documentation License''.-->
|
||
|
<meta http-equiv="Content-Style-Type" content="text/css">
|
||
|
<style type="text/css"><!--
|
||
|
pre.display { font-family:inherit }
|
||
|
pre.format { font-family:inherit }
|
||
|
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
||
|
pre.smallformat { font-family:inherit; font-size:smaller }
|
||
|
pre.smallexample { font-size:smaller }
|
||
|
pre.smalllisp { font-size:smaller }
|
||
|
span.sc { font-variant:small-caps }
|
||
|
span.roman { font-family:serif; font-weight:normal; }
|
||
|
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
||
|
--></style>
|
||
|
</head>
|
||
|
<body>
|
||
|
<div class="node">
|
||
|
<a name="MRI"></a>
|
||
|
<p>
|
||
|
Next: <a rel="next" accesskey="n" href="GNU-Free-Documentation-License.html#GNU-Free-Documentation-License">GNU Free Documentation License</a>,
|
||
|
Previous: <a rel="previous" accesskey="p" href="Reporting-Bugs.html#Reporting-Bugs">Reporting Bugs</a>,
|
||
|
Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a>
|
||
|
<hr>
|
||
|
</div>
|
||
|
|
||
|
<h2 class="appendix">Appendix A MRI Compatible Script Files</h2>
|
||
|
|
||
|
<p><a name="index-MRI-compatibility-761"></a>To aid users making the transition to <span class="sc">gnu</span> <samp><span class="command">ld</span></samp> from the MRI
|
||
|
linker, <samp><span class="command">ld</span></samp> can use MRI compatible linker scripts as an
|
||
|
alternative to the more general-purpose linker scripting language
|
||
|
described in <a href="Scripts.html#Scripts">Scripts</a>. MRI compatible linker scripts have a much
|
||
|
simpler command set than the scripting language otherwise used with
|
||
|
<samp><span class="command">ld</span></samp>. <span class="sc">gnu</span> <samp><span class="command">ld</span></samp> supports the most commonly used MRI
|
||
|
linker commands; these commands are described here.
|
||
|
|
||
|
<p>In general, MRI scripts aren't of much use with the <code>a.out</code> object
|
||
|
file format, since it only has three sections and MRI scripts lack some
|
||
|
features to make use of them.
|
||
|
|
||
|
<p>You can specify a file containing an MRI-compatible script using the
|
||
|
‘<samp><span class="samp">-c</span></samp>’ command-line option.
|
||
|
|
||
|
<p>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, <samp><span class="command">ld</span></samp>
|
||
|
issues a warning message, but continues processing the script.
|
||
|
|
||
|
<p>Lines beginning with ‘<samp><span class="samp">*</span></samp>’ are comments.
|
||
|
|
||
|
<p>You can write these commands using all upper-case letters, or all
|
||
|
lower case; for example, ‘<samp><span class="samp">chip</span></samp>’ is the same as ‘<samp><span class="samp">CHIP</span></samp>’.
|
||
|
The following list shows only the upper-case form of each command.
|
||
|
|
||
|
|
||
|
<a name="index-g_t_0040code_007bABSOLUTE_007d-_0028MRI_0029-762"></a>
|
||
|
<dl><dt><code>ABSOLUTE </code><var>secname</var><dt><code>ABSOLUTE </code><var>secname</var><code>, </code><var>secname</var><code>, ... </code><var>secname</var><dd>Normally, <samp><span class="command">ld</span></samp> includes in the output file all sections from all
|
||
|
the input files. However, in an MRI-compatible script, you can use the
|
||
|
<code>ABSOLUTE</code> command to restrict the sections that will be present in
|
||
|
your output program. If the <code>ABSOLUTE</code> command is used at all in a
|
||
|
script, then only the sections named explicitly in <code>ABSOLUTE</code>
|
||
|
commands will appear in the linker output. You can still use other
|
||
|
input sections (whatever you select on the command line, or using
|
||
|
<code>LOAD</code>) to resolve addresses in the output file.
|
||
|
|
||
|
<p><a name="index-g_t_0040code_007bALIAS_007d-_0028MRI_0029-763"></a><br><dt><code>ALIAS </code><var>out-secname</var><code>, </code><var>in-secname</var><dd>Use this command to place the data from input section <var>in-secname</var>
|
||
|
in a section called <var>out-secname</var> in the linker output file.
|
||
|
|
||
|
<p><var>in-secname</var> may be an integer.
|
||
|
|
||
|
<p><a name="index-g_t_0040code_007bALIGN_007d-_0028MRI_0029-764"></a><br><dt><code>ALIGN </code><var>secname</var><code> = </code><var>expression</var><dd>Align the section called <var>secname</var> to <var>expression</var>. The
|
||
|
<var>expression</var> should be a power of two.
|
||
|
|
||
|
<p><a name="index-g_t_0040code_007bBASE_007d-_0028MRI_0029-765"></a><br><dt><code>BASE </code><var>expression</var><dd>Use the value of <var>expression</var> as the lowest address (other than
|
||
|
absolute addresses) in the output file.
|
||
|
|
||
|
<p><a name="index-g_t_0040code_007bCHIP_007d-_0028MRI_0029-766"></a><br><dt><code>CHIP </code><var>expression</var><dt><code>CHIP </code><var>expression</var><code>, </code><var>expression</var><dd>This command does nothing; it is accepted only for compatibility.
|
||
|
|
||
|
<p><a name="index-g_t_0040code_007bEND_007d-_0028MRI_0029-767"></a><br><dt><code>END</code><dd>This command does nothing whatever; it's only accepted for compatibility.
|
||
|
|
||
|
<p><a name="index-g_t_0040code_007bFORMAT_007d-_0028MRI_0029-768"></a><br><dt><code>FORMAT </code><var>output-format</var><dd>Similar to the <code>OUTPUT_FORMAT</code> command in the more general linker
|
||
|
language, but restricted to one of these output formats:
|
||
|
|
||
|
<ol type=1 start=1>
|
||
|
<li>S-records, if <var>output-format</var> is ‘<samp><span class="samp">S</span></samp>’
|
||
|
|
||
|
<li>IEEE, if <var>output-format</var> is ‘<samp><span class="samp">IEEE</span></samp>’
|
||
|
|
||
|
<li>COFF (the ‘<samp><span class="samp">coff-m68k</span></samp>’ variant in BFD), if <var>output-format</var> is
|
||
|
‘<samp><span class="samp">COFF</span></samp>’
|
||
|
</ol>
|
||
|
|
||
|
<p><a name="index-g_t_0040code_007bLIST_007d-_0028MRI_0029-769"></a><br><dt><code>LIST </code><var>anything</var><code>...</code><dd>Print (to the standard output file) a link map, as produced by the
|
||
|
<samp><span class="command">ld</span></samp> command-line option ‘<samp><span class="samp">-M</span></samp>’.
|
||
|
|
||
|
<p>The keyword <code>LIST</code> may be followed by anything on the
|
||
|
same line, with no change in its effect.
|
||
|
|
||
|
<p><a name="index-g_t_0040code_007bLOAD_007d-_0028MRI_0029-770"></a><br><dt><code>LOAD </code><var>filename</var><dt><code>LOAD </code><var>filename</var><code>, </code><var>filename</var><code>, ... </code><var>filename</var><dd>Include one or more object file <var>filename</var> in the link; this has the
|
||
|
same effect as specifying <var>filename</var> directly on the <samp><span class="command">ld</span></samp>
|
||
|
command line.
|
||
|
|
||
|
<p><a name="index-g_t_0040code_007bNAME_007d-_0028MRI_0029-771"></a><br><dt><code>NAME </code><var>output-name</var><dd><var>output-name</var> is the name for the program produced by <samp><span class="command">ld</span></samp>; the
|
||
|
MRI-compatible command <code>NAME</code> is equivalent to the command-line
|
||
|
option ‘<samp><span class="samp">-o</span></samp>’ or the general script language command <code>OUTPUT</code>.
|
||
|
|
||
|
<p><a name="index-g_t_0040code_007bORDER_007d-_0028MRI_0029-772"></a><br><dt><code>ORDER </code><var>secname</var><code>, </code><var>secname</var><code>, ... </code><var>secname</var><dt><code>ORDER </code><var>secname</var> <var>secname</var> <var>secname</var><dd>Normally, <samp><span class="command">ld</span></samp> 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 <code>ORDER</code> command. The
|
||
|
sections you list with <code>ORDER</code> will appear first in your output
|
||
|
file, in the order specified.
|
||
|
|
||
|
<p><a name="index-g_t_0040code_007bPUBLIC_007d-_0028MRI_0029-773"></a><br><dt><code>PUBLIC </code><var>name</var><code>=</code><var>expression</var><dt><code>PUBLIC </code><var>name</var><code>,</code><var>expression</var><dt><code>PUBLIC </code><var>name</var> <var>expression</var><dd>Supply a value (<var>expression</var>) for external symbol
|
||
|
<var>name</var> used in the linker input files.
|
||
|
|
||
|
<p><a name="index-g_t_0040code_007bSECT_007d-_0028MRI_0029-774"></a><br><dt><code>SECT </code><var>secname</var><code>, </code><var>expression</var><dt><code>SECT </code><var>secname</var><code>=</code><var>expression</var><dt><code>SECT </code><var>secname</var> <var>expression</var><dd>You can use any of these three forms of the <code>SECT</code> command to
|
||
|
specify the start address (<var>expression</var>) for section <var>secname</var>.
|
||
|
If you have more than one <code>SECT</code> statement for the same
|
||
|
<var>secname</var>, only the <em>first</em> sets the start address.
|
||
|
</dl>
|
||
|
|
||
|
</body></html>
|
||
|
|