Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

3 år sedan
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  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 Arm Embedded Toolchain 10-2020-q4-major)
  5. version 2.35.1.
  6. Copyright (C) 1991-2020 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 6.5, http://www.gnu.org/software/texinfo/ -->
  14. <head>
  15. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  16. <title>MRI (LD)</title>
  17. <meta name="description" content="MRI (LD)">
  18. <meta name="keywords" content="MRI (LD)">
  19. <meta name="resource-type" content="document">
  20. <meta name="distribution" content="global">
  21. <meta name="Generator" content="makeinfo">
  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.indentedblock {margin-right: 0em}
  32. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  33. blockquote.smallquotation {font-size: smaller}
  34. div.display {margin-left: 3.2em}
  35. div.example {margin-left: 3.2em}
  36. div.lisp {margin-left: 3.2em}
  37. div.smalldisplay {margin-left: 3.2em}
  38. div.smallexample {margin-left: 3.2em}
  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.nolinebreak {white-space: nowrap}
  50. span.roman {font-family: initial; font-weight: normal}
  51. span.sansserif {font-family: sans-serif; font-weight: normal}
  52. ul.no-bullet {list-style: none}
  53. -->
  54. </style>
  55. </head>
  56. <body lang="en">
  57. <a name="MRI"></a>
  58. <div class="header">
  59. <p>
  60. 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>
  61. </div>
  62. <hr>
  63. <a name="MRI-Compatible-Script-Files"></a>
  64. <h2 class="appendix">Appendix A MRI Compatible Script Files</h2>
  65. <a name="index-MRI-compatibility"></a>
  66. <p>To aid users making the transition to <small>GNU</small> <code>ld</code> from the MRI
  67. linker, <code>ld</code> can use MRI compatible linker scripts as an
  68. alternative to the more general-purpose linker scripting language
  69. described in <a href="Scripts.html#Scripts">Scripts</a>. MRI compatible linker scripts have a much
  70. simpler command set than the scripting language otherwise used with
  71. <code>ld</code>. <small>GNU</small> <code>ld</code> supports the most commonly used MRI
  72. linker commands; these commands are described here.
  73. </p>
  74. <p>In general, MRI scripts aren&rsquo;t of much use with the <code>a.out</code> object
  75. file format, since it only has three sections and MRI scripts lack some
  76. features to make use of them.
  77. </p>
  78. <p>You can specify a file containing an MRI-compatible script using the
  79. &lsquo;<samp>-c</samp>&rsquo; command-line option.
  80. </p>
  81. <p>Each command in an MRI-compatible script occupies its own line; each
  82. command line starts with the keyword that identifies the command (though
  83. blank lines are also allowed for punctuation). If a line of an
  84. MRI-compatible script begins with an unrecognized keyword, <code>ld</code>
  85. issues a warning message, but continues processing the script.
  86. </p>
  87. <p>Lines beginning with &lsquo;<samp>*</samp>&rsquo; are comments.
  88. </p>
  89. <p>You can write these commands using all upper-case letters, or all
  90. lower case; for example, &lsquo;<samp>chip</samp>&rsquo; is the same as &lsquo;<samp>CHIP</samp>&rsquo;.
  91. The following list shows only the upper-case form of each command.
  92. </p>
  93. <dl compact="compact">
  94. <dd><a name="index-ABSOLUTE-_0028MRI_0029"></a>
  95. </dd>
  96. <dt><code>ABSOLUTE <var>secname</var></code></dt>
  97. <dt><code>ABSOLUTE <var>secname</var>, <var>secname</var>, &hellip; <var>secname</var></code></dt>
  98. <dd><p>Normally, <code>ld</code> includes in the output file all sections from all
  99. the input files. However, in an MRI-compatible script, you can use the
  100. <code>ABSOLUTE</code> command to restrict the sections that will be present in
  101. your output program. If the <code>ABSOLUTE</code> command is used at all in a
  102. script, then only the sections named explicitly in <code>ABSOLUTE</code>
  103. commands will appear in the linker output. You can still use other
  104. input sections (whatever you select on the command line, or using
  105. <code>LOAD</code>) to resolve addresses in the output file.
  106. </p>
  107. <a name="index-ALIAS-_0028MRI_0029"></a>
  108. </dd>
  109. <dt><code>ALIAS <var>out-secname</var>, <var>in-secname</var></code></dt>
  110. <dd><p>Use this command to place the data from input section <var>in-secname</var>
  111. in a section called <var>out-secname</var> in the linker output file.
  112. </p>
  113. <p><var>in-secname</var> may be an integer.
  114. </p>
  115. <a name="index-ALIGN-_0028MRI_0029"></a>
  116. </dd>
  117. <dt><code>ALIGN <var>secname</var> = <var>expression</var></code></dt>
  118. <dd><p>Align the section called <var>secname</var> to <var>expression</var>. The
  119. <var>expression</var> should be a power of two.
  120. </p>
  121. <a name="index-BASE-_0028MRI_0029"></a>
  122. </dd>
  123. <dt><code>BASE <var>expression</var></code></dt>
  124. <dd><p>Use the value of <var>expression</var> as the lowest address (other than
  125. absolute addresses) in the output file.
  126. </p>
  127. <a name="index-CHIP-_0028MRI_0029"></a>
  128. </dd>
  129. <dt><code>CHIP <var>expression</var></code></dt>
  130. <dt><code>CHIP <var>expression</var>, <var>expression</var></code></dt>
  131. <dd><p>This command does nothing; it is accepted only for compatibility.
  132. </p>
  133. <a name="index-END-_0028MRI_0029"></a>
  134. </dd>
  135. <dt><code>END</code></dt>
  136. <dd><p>This command does nothing whatever; it&rsquo;s only accepted for compatibility.
  137. </p>
  138. <a name="index-FORMAT-_0028MRI_0029"></a>
  139. </dd>
  140. <dt><code>FORMAT <var>output-format</var></code></dt>
  141. <dd><p>Similar to the <code>OUTPUT_FORMAT</code> command in the more general linker
  142. language, but restricted to S-records, if <var>output-format</var> is &lsquo;<samp>S</samp>&rsquo;
  143. </p>
  144. <a name="index-LIST-_0028MRI_0029"></a>
  145. </dd>
  146. <dt><code>LIST <var>anything</var>&hellip;</code></dt>
  147. <dd><p>Print (to the standard output file) a link map, as produced by the
  148. <code>ld</code> command-line option &lsquo;<samp>-M</samp>&rsquo;.
  149. </p>
  150. <p>The keyword <code>LIST</code> may be followed by anything on the
  151. same line, with no change in its effect.
  152. </p>
  153. <a name="index-LOAD-_0028MRI_0029"></a>
  154. </dd>
  155. <dt><code>LOAD <var>filename</var></code></dt>
  156. <dt><code>LOAD <var>filename</var>, <var>filename</var>, &hellip; <var>filename</var></code></dt>
  157. <dd><p>Include one or more object file <var>filename</var> in the link; this has the
  158. same effect as specifying <var>filename</var> directly on the <code>ld</code>
  159. command line.
  160. </p>
  161. <a name="index-NAME-_0028MRI_0029"></a>
  162. </dd>
  163. <dt><code>NAME <var>output-name</var></code></dt>
  164. <dd><p><var>output-name</var> is the name for the program produced by <code>ld</code>; the
  165. MRI-compatible command <code>NAME</code> is equivalent to the command-line
  166. option &lsquo;<samp>-o</samp>&rsquo; or the general script language command <code>OUTPUT</code>.
  167. </p>
  168. <a name="index-ORDER-_0028MRI_0029"></a>
  169. </dd>
  170. <dt><code>ORDER <var>secname</var>, <var>secname</var>, &hellip; <var>secname</var></code></dt>
  171. <dt><code>ORDER <var>secname</var> <var>secname</var> <var>secname</var></code></dt>
  172. <dd><p>Normally, <code>ld</code> orders the sections in its output file in the
  173. order in which they first appear in the input files. In an MRI-compatible
  174. script, you can override this ordering with the <code>ORDER</code> command. The
  175. sections you list with <code>ORDER</code> will appear first in your output
  176. file, in the order specified.
  177. </p>
  178. <a name="index-PUBLIC-_0028MRI_0029"></a>
  179. </dd>
  180. <dt><code>PUBLIC <var>name</var>=<var>expression</var></code></dt>
  181. <dt><code>PUBLIC <var>name</var>,<var>expression</var></code></dt>
  182. <dt><code>PUBLIC <var>name</var> <var>expression</var></code></dt>
  183. <dd><p>Supply a value (<var>expression</var>) for external symbol
  184. <var>name</var> used in the linker input files.
  185. </p>
  186. <a name="index-SECT-_0028MRI_0029"></a>
  187. </dd>
  188. <dt><code>SECT <var>secname</var>, <var>expression</var></code></dt>
  189. <dt><code>SECT <var>secname</var>=<var>expression</var></code></dt>
  190. <dt><code>SECT <var>secname</var> <var>expression</var></code></dt>
  191. <dd><p>You can use any of these three forms of the <code>SECT</code> command to
  192. specify the start address (<var>expression</var>) for section <var>secname</var>.
  193. If you have more than one <code>SECT</code> statement for the same
  194. <var>secname</var>, only the <em>first</em> sets the start address.
  195. </p></dd>
  196. </dl>
  197. <hr>
  198. <div class="header">
  199. <p>
  200. 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>
  201. </div>
  202. </body>
  203. </html>