1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<html>
3<!-- This file documents the GNU linker LD
4(GNU Toolchain for the A-profile Architecture 10.3-2021.07 (arm-10.29))
5version 2.36.1.
6
7Copyright (C) 1991-2021 Free Software Foundation, Inc.
8
9Permission is granted to copy, distribute and/or modify this document
10under the terms of the GNU Free Documentation License, Version 1.3
11or any later version published by the Free Software Foundation;
12with no Invariant Sections, with no Front-Cover Texts, and with no
13Back-Cover Texts.  A copy of the license is included in the
14section entitled "GNU Free Documentation License". -->
15<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ -->
16<head>
17<title>LD: MRI</title>
18
19<meta name="description" content="LD: MRI">
20<meta name="keywords" content="LD: MRI">
21<meta name="resource-type" content="document">
22<meta name="distribution" content="global">
23<meta name="Generator" content="makeinfo">
24<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
25<link href="index.html#Top" rel="start" title="Top">
26<link href="LD-Index.html#LD-Index" rel="index" title="LD Index">
27<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
28<link href="index.html#Top" rel="up" title="Top">
29<link href="GNU-Free-Documentation-License.html#GNU-Free-Documentation-License" rel="next" title="GNU Free Documentation License">
30<link href="Bug-Reporting.html#Bug-Reporting" rel="previous" title="Bug Reporting">
31<style type="text/css">
32<!--
33a.summary-letter {text-decoration: none}
34blockquote.smallquotation {font-size: smaller}
35div.display {margin-left: 3.2em}
36div.example {margin-left: 3.2em}
37div.indentedblock {margin-left: 3.2em}
38div.lisp {margin-left: 3.2em}
39div.smalldisplay {margin-left: 3.2em}
40div.smallexample {margin-left: 3.2em}
41div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
42div.smalllisp {margin-left: 3.2em}
43kbd {font-style:oblique}
44pre.display {font-family: inherit}
45pre.format {font-family: inherit}
46pre.menu-comment {font-family: serif}
47pre.menu-preformatted {font-family: serif}
48pre.smalldisplay {font-family: inherit; font-size: smaller}
49pre.smallexample {font-size: smaller}
50pre.smallformat {font-family: inherit; font-size: smaller}
51pre.smalllisp {font-size: smaller}
52span.nocodebreak {white-space:nowrap}
53span.nolinebreak {white-space:nowrap}
54span.roman {font-family:serif; font-weight:normal}
55span.sansserif {font-family:sans-serif; font-weight:normal}
56ul.no-bullet {list-style: none}
57-->
58</style>
59
60
61</head>
62
63<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
64<a name="MRI"></a>
65<div class="header">
66<p>
67Next: <a href="GNU-Free-Documentation-License.html#GNU-Free-Documentation-License" accesskey="n" rel="next">GNU Free Documentation License</a>, Previous: <a href="Reporting-Bugs.html#Reporting-Bugs" accesskey="p" rel="previous">Reporting Bugs</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="LD-Index.html#LD-Index" title="Index" rel="index">Index</a>]</p>
68</div>
69<hr>
70<a name="MRI-Compatible-Script-Files"></a>
71<h2 class="appendix">Appendix A MRI Compatible Script Files</h2>
72<a name="index-MRI-compatibility"></a>
73<p>To aid users making the transition to <small>GNU</small> <code>ld</code> from the MRI
74linker, <code>ld</code> can use MRI compatible linker scripts as an
75alternative to the more general-purpose linker scripting language
76described in <a href="Scripts.html#Scripts">Scripts</a>.  MRI compatible linker scripts have a much
77simpler command set than the scripting language otherwise used with
78<code>ld</code>.  <small>GNU</small> <code>ld</code> supports the most commonly used MRI
79linker commands; these commands are described here.
80</p>
81<p>In general, MRI scripts aren&rsquo;t of much use with the <code>a.out</code> object
82file format, since it only has three sections and MRI scripts lack some
83features to make use of them.
84</p>
85<p>You can specify a file containing an MRI-compatible script using the
86&lsquo;<samp>-c</samp>&rsquo; command-line option.
87</p>
88<p>Each command in an MRI-compatible script occupies its own line; each
89command line starts with the keyword that identifies the command (though
90blank lines are also allowed for punctuation).  If a line of an
91MRI-compatible script begins with an unrecognized keyword, <code>ld</code>
92issues a warning message, but continues processing the script.
93</p>
94<p>Lines beginning with &lsquo;<samp>*</samp>&rsquo; are comments.
95</p>
96<p>You can write these commands using all upper-case letters, or all
97lower case; for example, &lsquo;<samp>chip</samp>&rsquo; is the same as &lsquo;<samp>CHIP</samp>&rsquo;.
98The following list shows only the upper-case form of each command.
99</p>
100<dl compact="compact">
101<dd><a name="index-ABSOLUTE-_0028MRI_0029"></a>
102</dd>
103<dt><code>ABSOLUTE <var>secname</var></code></dt>
104<dt><code>ABSOLUTE <var>secname</var>, <var>secname</var>, &hellip; <var>secname</var></code></dt>
105<dd><p>Normally, <code>ld</code> includes in the output file all sections from all
106the input files.  However, in an MRI-compatible script, you can use the
107<code>ABSOLUTE</code> command to restrict the sections that will be present in
108your output program.  If the <code>ABSOLUTE</code> command is used at all in a
109script, then only the sections named explicitly in <code>ABSOLUTE</code>
110commands will appear in the linker output.  You can still use other
111input sections (whatever you select on the command line, or using
112<code>LOAD</code>) to resolve addresses in the output file.
113</p>
114<a name="index-ALIAS-_0028MRI_0029"></a>
115</dd>
116<dt><code>ALIAS <var>out-secname</var>, <var>in-secname</var></code></dt>
117<dd><p>Use this command to place the data from input section <var>in-secname</var>
118in a section called <var>out-secname</var> in the linker output file.
119</p>
120<p><var>in-secname</var> may be an integer.
121</p>
122<a name="index-ALIGN-_0028MRI_0029"></a>
123</dd>
124<dt><code>ALIGN <var>secname</var> = <var>expression</var></code></dt>
125<dd><p>Align the section called <var>secname</var> to <var>expression</var>.  The
126<var>expression</var> should be a power of two.
127</p>
128<a name="index-BASE-_0028MRI_0029"></a>
129</dd>
130<dt><code>BASE <var>expression</var></code></dt>
131<dd><p>Use the value of <var>expression</var> as the lowest address (other than
132absolute addresses) in the output file.
133</p>
134<a name="index-CHIP-_0028MRI_0029"></a>
135</dd>
136<dt><code>CHIP <var>expression</var></code></dt>
137<dt><code>CHIP <var>expression</var>, <var>expression</var></code></dt>
138<dd><p>This command does nothing; it is accepted only for compatibility.
139</p>
140<a name="index-END-_0028MRI_0029"></a>
141</dd>
142<dt><code>END</code></dt>
143<dd><p>This command does nothing whatever; it&rsquo;s only accepted for compatibility.
144</p>
145<a name="index-FORMAT-_0028MRI_0029"></a>
146</dd>
147<dt><code>FORMAT <var>output-format</var></code></dt>
148<dd><p>Similar to the <code>OUTPUT_FORMAT</code> command in the more general linker
149language, but restricted to S-records, if <var>output-format</var> is &lsquo;<samp>S</samp>&rsquo;
150</p>
151<a name="index-LIST-_0028MRI_0029"></a>
152</dd>
153<dt><code>LIST <var>anything</var>&hellip;</code></dt>
154<dd><p>Print (to the standard output file) a link map, as produced by the
155<code>ld</code> command-line option &lsquo;<samp>-M</samp>&rsquo;.
156</p>
157<p>The keyword <code>LIST</code> may be followed by anything on the
158same line, with no change in its effect.
159</p>
160<a name="index-LOAD-_0028MRI_0029"></a>
161</dd>
162<dt><code>LOAD <var>filename</var></code></dt>
163<dt><code>LOAD <var>filename</var>, <var>filename</var>, &hellip; <var>filename</var></code></dt>
164<dd><p>Include one or more object file <var>filename</var> in the link; this has the
165same effect as specifying <var>filename</var> directly on the <code>ld</code>
166command line.
167</p>
168<a name="index-NAME-_0028MRI_0029"></a>
169</dd>
170<dt><code>NAME <var>output-name</var></code></dt>
171<dd><p><var>output-name</var> is the name for the program produced by <code>ld</code>; the
172MRI-compatible command <code>NAME</code> is equivalent to the command-line
173option &lsquo;<samp>-o</samp>&rsquo; or the general script language command <code>OUTPUT</code>.
174</p>
175<a name="index-ORDER-_0028MRI_0029"></a>
176</dd>
177<dt><code>ORDER <var>secname</var>, <var>secname</var>, &hellip; <var>secname</var></code></dt>
178<dt><code>ORDER <var>secname</var> <var>secname</var> <var>secname</var></code></dt>
179<dd><p>Normally, <code>ld</code> orders the sections in its output file in the
180order in which they first appear in the input files.  In an MRI-compatible
181script, you can override this ordering with the <code>ORDER</code> command.  The
182sections you list with <code>ORDER</code> will appear first in your output
183file, in the order specified.
184</p>
185<a name="index-PUBLIC-_0028MRI_0029"></a>
186</dd>
187<dt><code>PUBLIC <var>name</var>=<var>expression</var></code></dt>
188<dt><code>PUBLIC <var>name</var>,<var>expression</var></code></dt>
189<dt><code>PUBLIC <var>name</var> <var>expression</var></code></dt>
190<dd><p>Supply a value (<var>expression</var>) for external symbol
191<var>name</var> used in the linker input files.
192</p>
193<a name="index-SECT-_0028MRI_0029"></a>
194</dd>
195<dt><code>SECT <var>secname</var>, <var>expression</var></code></dt>
196<dt><code>SECT <var>secname</var>=<var>expression</var></code></dt>
197<dt><code>SECT <var>secname</var> <var>expression</var></code></dt>
198<dd><p>You can use any of these three forms of the <code>SECT</code> command to
199specify the start address (<var>expression</var>) for section <var>secname</var>.
200If you have more than one <code>SECT</code> statement for the same
201<var>secname</var>, only the <em>first</em> sets the start address.
202</p></dd>
203</dl>
204
205<hr>
206<div class="header">
207<p>
208Next: <a href="GNU-Free-Documentation-License.html#GNU-Free-Documentation-License" accesskey="n" rel="next">GNU Free Documentation License</a>, Previous: <a href="Reporting-Bugs.html#Reporting-Bugs" accesskey="p" rel="previous">Reporting Bugs</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="LD-Index.html#LD-Index" title="Index" rel="index">Index</a>]</p>
209</div>
210
211
212
213</body>
214</html>
215