Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

161 lines
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>Xtensa (LD)</title>
  17. <meta name="description" content="Xtensa (LD)">
  18. <meta name="keywords" content="Xtensa (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="Machine-Dependent.html#Machine-Dependent" rel="up" title="Machine Dependent">
  26. <link href="BFD.html#BFD" rel="next" title="BFD">
  27. <link href="WIN32.html#WIN32" rel="prev" title="WIN32">
  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="Xtensa"></a>
  58. <div class="header">
  59. <p>
  60. Previous: <a href="WIN32.html#WIN32" accesskey="p" rel="prev">WIN32</a>, Up: <a href="Machine-Dependent.html#Machine-Dependent" accesskey="u" rel="up">Machine Dependent</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="ld-and-Xtensa-Processors"></a>
  64. <h3 class="section">4.17 <code>ld</code> and Xtensa Processors</h3>
  65. <a name="index-Xtensa-processors"></a>
  66. <p>The default <code>ld</code> behavior for Xtensa processors is to interpret
  67. <code>SECTIONS</code> commands so that lists of explicitly named sections in a
  68. specification with a wildcard file will be interleaved when necessary to
  69. keep literal pools within the range of PC-relative load offsets. For
  70. example, with the command:
  71. </p>
  72. <div class="smallexample">
  73. <pre class="smallexample">SECTIONS
  74. {
  75. .text : {
  76. *(.literal .text)
  77. }
  78. }
  79. </pre></div>
  80. <p><code>ld</code> may interleave some of the <code>.literal</code>
  81. and <code>.text</code> sections from different object files to ensure that the
  82. literal pools are within the range of PC-relative load offsets. A valid
  83. interleaving might place the <code>.literal</code> sections from an initial
  84. group of files followed by the <code>.text</code> sections of that group of
  85. files. Then, the <code>.literal</code> sections from the rest of the files
  86. and the <code>.text</code> sections from the rest of the files would follow.
  87. </p>
  88. <a name="index-_002d_002drelax-on-Xtensa"></a>
  89. <a name="index-relaxing-on-Xtensa"></a>
  90. <p>Relaxation is enabled by default for the Xtensa version of <code>ld</code> and
  91. provides two important link-time optimizations. The first optimization
  92. is to combine identical literal values to reduce code size. A redundant
  93. literal will be removed and all the <code>L32R</code> instructions that use it
  94. will be changed to reference an identical literal, as long as the
  95. location of the replacement literal is within the offset range of all
  96. the <code>L32R</code> instructions. The second optimization is to remove
  97. unnecessary overhead from assembler-generated &ldquo;longcall&rdquo; sequences of
  98. <code>L32R</code>/<code>CALLX<var>n</var></code> when the target functions are within
  99. range of direct <code>CALL<var>n</var></code> instructions.
  100. </p>
  101. <p>For each of these cases where an indirect call sequence can be optimized
  102. to a direct call, the linker will change the <code>CALLX<var>n</var></code>
  103. instruction to a <code>CALL<var>n</var></code> instruction, remove the <code>L32R</code>
  104. instruction, and remove the literal referenced by the <code>L32R</code>
  105. instruction if it is not used for anything else. Removing the
  106. <code>L32R</code> instruction always reduces code size but can potentially
  107. hurt performance by changing the alignment of subsequent branch targets.
  108. By default, the linker will always preserve alignments, either by
  109. switching some instructions between 24-bit encodings and the equivalent
  110. density instructions or by inserting a no-op in place of the <code>L32R</code>
  111. instruction that was removed. If code size is more important than
  112. performance, the <samp>--size-opt</samp> option can be used to prevent the
  113. linker from widening density instructions or inserting no-ops, except in
  114. a few cases where no-ops are required for correctness.
  115. </p>
  116. <p>The following Xtensa-specific command-line options can be used to
  117. control the linker:
  118. </p>
  119. <a name="index-Xtensa-options"></a>
  120. <dl compact="compact">
  121. <dt><samp>--size-opt</samp></dt>
  122. <dd><p>When optimizing indirect calls to direct calls, optimize for code size
  123. more than performance. With this option, the linker will not insert
  124. no-ops or widen density instructions to preserve branch target
  125. alignment. There may still be some cases where no-ops are required to
  126. preserve the correctness of the code.
  127. </p>
  128. </dd>
  129. <dt><samp>--abi-windowed</samp></dt>
  130. <dt><samp>--abi-call0</samp></dt>
  131. <dd><p>Choose ABI for the output object and for the generated PLT code.
  132. PLT code inserted by the linker must match ABI of the output object
  133. because windowed and call0 ABI use incompatible function call
  134. conventions.
  135. Default ABI is chosen by the ABI tag in the <code>.xtensa.info</code> section
  136. of the first input object.
  137. A warning is issued if ABI tags of input objects do not match each other
  138. or the chosen output object ABI.
  139. </p></dd>
  140. </dl>
  141. <hr>
  142. <div class="header">
  143. <p>
  144. Previous: <a href="WIN32.html#WIN32" accesskey="p" rel="prev">WIN32</a>, Up: <a href="Machine-Dependent.html#Machine-Dependent" accesskey="u" rel="up">Machine Dependent</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>
  145. </div>
  146. </body>
  147. </html>