您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

133 行
7.1KB

  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>Scripts (LD)</title>
  17. <meta name="description" content="Scripts (LD)">
  18. <meta name="keywords" content="Scripts (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="Basic-Script-Concepts.html#Basic-Script-Concepts" rel="next" title="Basic Script Concepts">
  27. <link href="Environment.html#Environment" rel="prev" title="Environment">
  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="Scripts"></a>
  58. <div class="header">
  59. <p>
  60. Next: <a href="Machine-Dependent.html#Machine-Dependent" accesskey="n" rel="next">Machine Dependent</a>, Previous: <a href="Invocation.html#Invocation" accesskey="p" rel="prev">Invocation</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="Linker-Scripts"></a>
  64. <h2 class="chapter">3 Linker Scripts</h2>
  65. <a name="index-scripts"></a>
  66. <a name="index-linker-scripts"></a>
  67. <a name="index-command-files"></a>
  68. <p>Every link is controlled by a <em>linker script</em>. This script is
  69. written in the linker command language.
  70. </p>
  71. <p>The main purpose of the linker script is to describe how the sections in
  72. the input files should be mapped into the output file, and to control
  73. the memory layout of the output file. Most linker scripts do nothing
  74. more than this. However, when necessary, the linker script can also
  75. direct the linker to perform many other operations, using the commands
  76. described below.
  77. </p>
  78. <p>The linker always uses a linker script. If you do not supply one
  79. yourself, the linker will use a default script that is compiled into the
  80. linker executable. You can use the &lsquo;<samp>--verbose</samp>&rsquo; command-line option
  81. to display the default linker script. Certain command-line options,
  82. such as &lsquo;<samp>-r</samp>&rsquo; or &lsquo;<samp>-N</samp>&rsquo;, will affect the default linker script.
  83. </p>
  84. <p>You may supply your own linker script by using the &lsquo;<samp>-T</samp>&rsquo; command
  85. line option. When you do this, your linker script will replace the
  86. default linker script.
  87. </p>
  88. <p>You may also use linker scripts implicitly by naming them as input files
  89. to the linker, as though they were files to be linked. See <a href="Implicit-Linker-Scripts.html#Implicit-Linker-Scripts">Implicit Linker Scripts</a>.
  90. </p>
  91. <table class="menu" border="0" cellspacing="0">
  92. <tr><td align="left" valign="top">&bull; <a href="Basic-Script-Concepts.html#Basic-Script-Concepts" accesskey="1">Basic Script Concepts</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Basic Linker Script Concepts
  93. </td></tr>
  94. <tr><td align="left" valign="top">&bull; <a href="Script-Format.html#Script-Format" accesskey="2">Script Format</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Linker Script Format
  95. </td></tr>
  96. <tr><td align="left" valign="top">&bull; <a href="Simple-Example.html#Simple-Example" accesskey="3">Simple Example</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Simple Linker Script Example
  97. </td></tr>
  98. <tr><td align="left" valign="top">&bull; <a href="Simple-Commands.html#Simple-Commands" accesskey="4">Simple Commands</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Simple Linker Script Commands
  99. </td></tr>
  100. <tr><td align="left" valign="top">&bull; <a href="Assignments.html#Assignments" accesskey="5">Assignments</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Assigning Values to Symbols
  101. </td></tr>
  102. <tr><td align="left" valign="top">&bull; <a href="SECTIONS.html#SECTIONS" accesskey="6">SECTIONS</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">SECTIONS Command
  103. </td></tr>
  104. <tr><td align="left" valign="top">&bull; <a href="MEMORY.html#MEMORY" accesskey="7">MEMORY</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">MEMORY Command
  105. </td></tr>
  106. <tr><td align="left" valign="top">&bull; <a href="PHDRS.html#PHDRS" accesskey="8">PHDRS</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">PHDRS Command
  107. </td></tr>
  108. <tr><td align="left" valign="top">&bull; <a href="VERSION.html#VERSION" accesskey="9">VERSION</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">VERSION Command
  109. </td></tr>
  110. <tr><td align="left" valign="top">&bull; <a href="Expressions.html#Expressions">Expressions</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Expressions in Linker Scripts
  111. </td></tr>
  112. <tr><td align="left" valign="top">&bull; <a href="Implicit-Linker-Scripts.html#Implicit-Linker-Scripts">Implicit Linker Scripts</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Implicit Linker Scripts
  113. </td></tr>
  114. </table>
  115. <hr>
  116. <div class="header">
  117. <p>
  118. Next: <a href="Machine-Dependent.html#Machine-Dependent" accesskey="n" rel="next">Machine Dependent</a>, Previous: <a href="Invocation.html#Invocation" accesskey="p" rel="prev">Invocation</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>
  119. </div>
  120. </body>
  121. </html>