Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

164 lines
6.5KB

  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 Assembler "as".
  4. Copyright (C) 1991-2020 Free Software Foundation, Inc.
  5. Permission is granted to copy, distribute and/or modify this document
  6. under the terms of the GNU Free Documentation License, Version 1.3
  7. or any later version published by the Free Software Foundation;
  8. with no Invariant Sections, with no Front-Cover Texts, and with no
  9. Back-Cover Texts. A copy of the license is included in the
  10. section entitled "GNU Free Documentation License".
  11. -->
  12. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  13. <head>
  14. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  15. <title>Nios II Relocations (Using as)</title>
  16. <meta name="description" content="Nios II Relocations (Using as)">
  17. <meta name="keywords" content="Nios II Relocations (Using as)">
  18. <meta name="resource-type" content="document">
  19. <meta name="distribution" content="global">
  20. <meta name="Generator" content="makeinfo">
  21. <link href="index.html#Top" rel="start" title="Top">
  22. <link href="AS-Index.html#AS-Index" rel="index" title="AS Index">
  23. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  24. <link href="NiosII_002dDependent.html#NiosII_002dDependent" rel="up" title="NiosII-Dependent">
  25. <link href="Nios-II-Directives.html#Nios-II-Directives" rel="next" title="Nios II Directives">
  26. <link href="Nios-II-Chars.html#Nios-II-Chars" rel="prev" title="Nios II Chars">
  27. <style type="text/css">
  28. <!--
  29. a.summary-letter {text-decoration: none}
  30. blockquote.indentedblock {margin-right: 0em}
  31. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  32. blockquote.smallquotation {font-size: smaller}
  33. div.display {margin-left: 3.2em}
  34. div.example {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.smalllisp {margin-left: 3.2em}
  39. kbd {font-style: oblique}
  40. pre.display {font-family: inherit}
  41. pre.format {font-family: inherit}
  42. pre.menu-comment {font-family: serif}
  43. pre.menu-preformatted {font-family: serif}
  44. pre.smalldisplay {font-family: inherit; font-size: smaller}
  45. pre.smallexample {font-size: smaller}
  46. pre.smallformat {font-family: inherit; font-size: smaller}
  47. pre.smalllisp {font-size: smaller}
  48. span.nolinebreak {white-space: nowrap}
  49. span.roman {font-family: initial; font-weight: normal}
  50. span.sansserif {font-family: sans-serif; font-weight: normal}
  51. ul.no-bullet {list-style: none}
  52. -->
  53. </style>
  54. </head>
  55. <body lang="en">
  56. <a name="Nios-II-Relocations"></a>
  57. <div class="header">
  58. <p>
  59. Next: <a href="Nios-II-Directives.html#Nios-II-Directives" accesskey="n" rel="next">Nios II Directives</a>, Previous: <a href="Nios-II-Syntax.html#Nios-II-Syntax" accesskey="p" rel="prev">Nios II Syntax</a>, Up: <a href="NiosII_002dDependent.html#NiosII_002dDependent" accesskey="u" rel="up">NiosII-Dependent</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="AS-Index.html#AS-Index" title="Index" rel="index">Index</a>]</p>
  60. </div>
  61. <hr>
  62. <a name="Nios-II-Machine-Relocations"></a>
  63. <h4 class="subsection">9.31.3 Nios II Machine Relocations</h4>
  64. <a name="index-machine-relocations_002c-Nios-II"></a>
  65. <a name="index-Nios-II-machine-relocations"></a>
  66. <dl compact="compact">
  67. <dd><a name="index-hiadj-directive_002c-Nios-II"></a>
  68. </dd>
  69. <dt><code>%hiadj(<var>expression</var>)</code></dt>
  70. <dd><p>Extract the upper 16 bits of <var>expression</var> and add
  71. one if the 15th bit is set.
  72. </p>
  73. <p>The value of <code>%hiadj(<var>expression</var>)</code> is:
  74. </p><div class="smallexample">
  75. <pre class="smallexample">((<var>expression</var> &gt;&gt; 16) &amp; 0xffff) + ((<var>expression</var> &gt;&gt; 15) &amp; 0x01)
  76. </pre></div>
  77. <p>The <code>%hiadj</code> relocation is intended to be used with
  78. the <code>addi</code>, <code>ld</code> or <code>st</code> instructions
  79. along with a <code>%lo</code>, in order to load a 32-bit constant.
  80. </p>
  81. <div class="smallexample">
  82. <pre class="smallexample">movhi r2, %hiadj(symbol)
  83. addi r2, r2, %lo(symbol)
  84. </pre></div>
  85. <a name="index-hi-directive_002c-Nios-II"></a>
  86. </dd>
  87. <dt><code>%hi(<var>expression</var>)</code></dt>
  88. <dd><p>Extract the upper 16 bits of <var>expression</var>.
  89. </p>
  90. <a name="index-lo-directive_002c-Nios-II"></a>
  91. </dd>
  92. <dt><code>%lo(<var>expression</var>)</code></dt>
  93. <dd><p>Extract the lower 16 bits of <var>expression</var>.
  94. </p>
  95. <a name="index-gprel-directive_002c-Nios-II"></a>
  96. </dd>
  97. <dt><code>%gprel(<var>expression</var>)</code></dt>
  98. <dd><p>Subtract the value of the symbol <code>_gp</code> from
  99. <var>expression</var>.
  100. </p>
  101. <p>The intention of the <code>%gprel</code> relocation is
  102. to have a fast small area of memory which only
  103. takes a 16-bit immediate to access.
  104. </p>
  105. <div class="smallexample">
  106. <pre class="smallexample"> .section .sdata
  107. fastint:
  108. .int 123
  109. .section .text
  110. ldw r4, %gprel(fastint)(gp)
  111. </pre></div>
  112. <a name="index-call-directive_002c-Nios-II"></a>
  113. <a name="index-call_005flo-directive_002c-Nios-II"></a>
  114. <a name="index-call_005fhiadj-directive_002c-Nios-II"></a>
  115. <a name="index-got-directive_002c-Nios-II"></a>
  116. <a name="index-got_005flo-directive_002c-Nios-II"></a>
  117. <a name="index-got_005fhiadj-directive_002c-Nios-II"></a>
  118. <a name="index-gotoff-directive_002c-Nios-II"></a>
  119. <a name="index-gotoff_005flo-directive_002c-Nios-II"></a>
  120. <a name="index-gotoff_005fhiadj-directive_002c-Nios-II"></a>
  121. <a name="index-tls_005fgd-directive_002c-Nios-II"></a>
  122. <a name="index-tls_005fie-directive_002c-Nios-II"></a>
  123. <a name="index-tls_005fle-directive_002c-Nios-II"></a>
  124. <a name="index-tls_005fldm-directive_002c-Nios-II"></a>
  125. <a name="index-tls_005fldo-directive_002c-Nios-II"></a>
  126. </dd>
  127. <dt><code>%call(<var>expression</var>)</code></dt>
  128. <dt><code>%call_lo(<var>expression</var>)</code></dt>
  129. <dt><code>%call_hiadj(<var>expression</var>)</code></dt>
  130. <dt><code>%got(<var>expression</var>)</code></dt>
  131. <dt><code>%got_lo(<var>expression</var>)</code></dt>
  132. <dt><code>%got_hiadj(<var>expression</var>)</code></dt>
  133. <dt><code>%gotoff(<var>expression</var>)</code></dt>
  134. <dt><code>%gotoff_lo(<var>expression</var>)</code></dt>
  135. <dt><code>%gotoff_hiadj(<var>expression</var>)</code></dt>
  136. <dt><code>%tls_gd(<var>expression</var>)</code></dt>
  137. <dt><code>%tls_ie(<var>expression</var>)</code></dt>
  138. <dt><code>%tls_le(<var>expression</var>)</code></dt>
  139. <dt><code>%tls_ldm(<var>expression</var>)</code></dt>
  140. <dt><code>%tls_ldo(<var>expression</var>)</code></dt>
  141. <dd>
  142. <p>These relocations support the ABI for Linux Systems documented in the
  143. <cite>Nios II Processor Reference Handbook</cite>.
  144. </p></dd>
  145. </dl>
  146. </body>
  147. </html>