📄 mri.html
字号:
<html lang="en">
<head>
<title>Untitled</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Untitled">
<meta name="generator" content="makeinfo 4.3">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home">
</head>
<body>
<div class="node">
<p>
Node:<a name="MRI">MRI</a>,
Next:<a rel="next" accesskey="n" href="GNU-Free-Documentation-License.html#GNU%20Free%20Documentation%20License">GNU Free Documentation License</a>,
Previous:<a rel="previous" accesskey="p" href="Reporting-Bugs.html#Reporting%20Bugs">Reporting Bugs</a>,
Up:<a rel="up" accesskey="u" href="index.html#Top">Top</a>
<hr><br>
</div>
<h2 class="appendix">MRI Compatible Script Files</h2>
<p>To aid users making the transition to <small>GNU</small> <code>ld</code> from the MRI
linker, <code>ld</code> 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
<code>ld</code>. <small>GNU</small> <code>ld</code> 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
<code>-c</code> 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, <code>ld</code>
issues a warning message, but continues processing the script.
<p>Lines beginning with <code>*</code> are comments.
<p>You can write these commands using all upper-case letters, or all
lower case; for example, <code>chip</code> is the same as <code>CHIP</code>.
The following list shows only the upper-case form of each command.
<dl>
<dt><code>ABSOLUTE </code><var>secname</var><code></code>
<dd><dt><code>ABSOLUTE </code><var>secname</var><code>, </code><var>secname</var><code>, ... </code><var>secname</var><code></code>
<dd>Normally, <code>ld</code> 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.
<br><dt><code>ALIAS </code><var>out-secname</var><code>, </code><var>in-secname</var><code></code>
<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.
<br><dt><code>ALIGN </code><var>secname</var><code> = </code><var>expression</var><code></code>
<dd>Align the section called <var>secname</var> to <var>expression</var>. The
<var>expression</var> should be a power of two.
<br><dt><code>BASE </code><var>expression</var><code></code>
<dd>Use the value of <var>expression</var> as the lowest address (other than
absolute addresses) in the output file.
<br><dt><code>CHIP </code><var>expression</var><code></code>
<dd><dt><code>CHIP </code><var>expression</var><code>, </code><var>expression</var><code></code>
<dd>This command does nothing; it is accepted only for compatibility.
<br><dt><code>END</code>
<dd>This command does nothing whatever; it's only accepted for compatibility.
<br><dt><code>FORMAT </code><var>output-format</var><code></code>
<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 <code>S</code>
<li>IEEE, if <var>output-format</var> is <code>IEEE</code>
<li>COFF (the <code>coff-m68k</code> variant in BFD), if <var>output-format</var> is
<code>COFF</code>
</ol>
<br><dt><code>LIST </code><var>anything</var><code>...</code>
<dd>Print (to the standard output file) a link map, as produced by the
<code>ld</code> command-line option <code>-M</code>.
<p>The keyword <code>LIST</code> may be followed by anything on the
same line, with no change in its effect.
<br><dt><code>LOAD </code><var>filename</var><code></code>
<dd><dt><code>LOAD </code><var>filename</var><code>, </code><var>filename</var><code>, ... </code><var>filename</var><code></code>
<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 <code>ld</code>
command line.
<br><dt><code>NAME </code><var>output-name</var><code></code>
<dd><var>output-name</var> is the name for the program produced by <code>ld</code>; the
MRI-compatible command <code>NAME</code> is equivalent to the command-line
option <code>-o</code> or the general script language command <code>OUTPUT</code>.
<br><dt><code>ORDER </code><var>secname</var><code>, </code><var>secname</var><code>, ... </code><var>secname</var><code></code>
<dd><dt><code>ORDER </code><var>secname</var><code> </code><var>secname</var><code> </code><var>secname</var><code></code>
<dd>Normally, <code>ld</code> 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.
<br><dt><code>PUBLIC </code><var>name</var><code>=</code><var>expression</var><code></code>
<dd><dt><code>PUBLIC </code><var>name</var><code>,</code><var>expression</var><code></code>
<dd><dt><code>PUBLIC </code><var>name</var><code> </code><var>expression</var><code></code>
<dd>Supply a value (<var>expression</var>) for external symbol
<var>name</var> used in the linker input files.
<br><dt><code>SECT </code><var>secname</var><code>, </code><var>expression</var><code></code>
<dd><dt><code>SECT </code><var>secname</var><code>=</code><var>expression</var><code></code>
<dd><dt><code>SECT </code><var>secname</var><code> </code><var>expression</var><code></code>
<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>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -