MRI.html 10 KB

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