No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

Alpha_002dRelocs.html 11KB

hace 3 años
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  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>Alpha-Relocs (Using as)</title>
  16. <meta name="description" content="Alpha-Relocs (Using as)">
  17. <meta name="keywords" content="Alpha-Relocs (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="Alpha-Syntax.html#Alpha-Syntax" rel="up" title="Alpha Syntax">
  25. <link href="Alpha-Floating-Point.html#Alpha-Floating-Point" rel="next" title="Alpha Floating Point">
  26. <link href="Alpha_002dRegs.html#Alpha_002dRegs" rel="prev" title="Alpha-Regs">
  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="Alpha_002dRelocs"></a>
  57. <div class="header">
  58. <p>
  59. Previous: <a href="Alpha_002dRegs.html#Alpha_002dRegs" accesskey="p" rel="prev">Alpha-Regs</a>, Up: <a href="Alpha-Syntax.html#Alpha-Syntax" accesskey="u" rel="up">Alpha Syntax</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="Relocations-1"></a>
  63. <h4 class="subsubsection">9.2.3.3 Relocations</h4>
  64. <a name="index-Alpha-relocations"></a>
  65. <a name="index-relocations_002c-Alpha"></a>
  66. <p>Some of these relocations are available for ECOFF, but mostly
  67. only for ELF. They are modeled after the relocation format
  68. introduced in Digital Unix 4.0, but there are additions.
  69. </p>
  70. <p>The format is &lsquo;<samp>!<var>tag</var></samp>&rsquo; or &lsquo;<samp>!<var>tag</var>!<var>number</var></samp>&rsquo;
  71. where <var>tag</var> is the name of the relocation. In some cases
  72. <var>number</var> is used to relate specific instructions.
  73. </p>
  74. <p>The relocation is placed at the end of the instruction like so:
  75. </p>
  76. <div class="example">
  77. <pre class="example">ldah $0,a($29) !gprelhigh
  78. lda $0,a($0) !gprellow
  79. ldq $1,b($29) !literal!100
  80. ldl $2,0($1) !lituse_base!100
  81. </pre></div>
  82. <dl compact="compact">
  83. <dt><code>!literal</code></dt>
  84. <dt><code>!literal!<var>N</var></code></dt>
  85. <dd><p>Used with an <code>ldq</code> instruction to load the address of a symbol
  86. from the GOT.
  87. </p>
  88. <p>A sequence number <var>N</var> is optional, and if present is used to pair
  89. <code>lituse</code> relocations with this <code>literal</code> relocation. The
  90. <code>lituse</code> relocations are used by the linker to optimize the code
  91. based on the final location of the symbol.
  92. </p>
  93. <p>Note that these optimizations are dependent on the data flow of the
  94. program. Therefore, if <em>any</em> <code>lituse</code> is paired with a
  95. <code>literal</code> relocation, then <em>all</em> uses of the register set by
  96. the <code>literal</code> instruction must also be marked with <code>lituse</code>
  97. relocations. This is because the original <code>literal</code> instruction
  98. may be deleted or transformed into another instruction.
  99. </p>
  100. <p>Also note that there may be a one-to-many relationship between
  101. <code>literal</code> and <code>lituse</code>, but not a many-to-one. That is, if
  102. there are two code paths that load up the same address and feed the
  103. value to a single use, then the use may not use a <code>lituse</code>
  104. relocation.
  105. </p>
  106. </dd>
  107. <dt><code>!lituse_base!<var>N</var></code></dt>
  108. <dd><p>Used with any memory format instruction (e.g. <code>ldl</code>) to indicate
  109. that the literal is used for an address load. The offset field of the
  110. instruction must be zero. During relaxation, the code may be altered
  111. to use a gp-relative load.
  112. </p>
  113. </dd>
  114. <dt><code>!lituse_jsr!<var>N</var></code></dt>
  115. <dd><p>Used with a register branch format instruction (e.g. <code>jsr</code>) to
  116. indicate that the literal is used for a call. During relaxation, the
  117. code may be altered to use a direct branch (e.g. <code>bsr</code>).
  118. </p>
  119. </dd>
  120. <dt><code>!lituse_jsrdirect!<var>N</var></code></dt>
  121. <dd><p>Similar to <code>lituse_jsr</code>, but also that this call cannot be vectored
  122. through a PLT entry. This is useful for functions with special calling
  123. conventions which do not allow the normal call-clobbered registers to be
  124. clobbered.
  125. </p>
  126. </dd>
  127. <dt><code>!lituse_bytoff!<var>N</var></code></dt>
  128. <dd><p>Used with a byte mask instruction (e.g. <code>extbl</code>) to indicate
  129. that only the low 3 bits of the address are relevant. During relaxation,
  130. the code may be altered to use an immediate instead of a register shift.
  131. </p>
  132. </dd>
  133. <dt><code>!lituse_addr!<var>N</var></code></dt>
  134. <dd><p>Used with any other instruction to indicate that the original address
  135. is in fact used, and the original <code>ldq</code> instruction may not be
  136. altered or deleted. This is useful in conjunction with <code>lituse_jsr</code>
  137. to test whether a weak symbol is defined.
  138. </p>
  139. <div class="example">
  140. <pre class="example">ldq $27,foo($29) !literal!1
  141. beq $27,is_undef !lituse_addr!1
  142. jsr $26,($27),foo !lituse_jsr!1
  143. </pre></div>
  144. </dd>
  145. <dt><code>!lituse_tlsgd!<var>N</var></code></dt>
  146. <dd><p>Used with a register branch format instruction to indicate that the
  147. literal is the call to <code>__tls_get_addr</code> used to compute the
  148. address of the thread-local storage variable whose descriptor was
  149. loaded with <code>!tlsgd!<var>N</var></code>.
  150. </p>
  151. </dd>
  152. <dt><code>!lituse_tlsldm!<var>N</var></code></dt>
  153. <dd><p>Used with a register branch format instruction to indicate that the
  154. literal is the call to <code>__tls_get_addr</code> used to compute the
  155. address of the base of the thread-local storage block for the current
  156. module. The descriptor for the module must have been loaded with
  157. <code>!tlsldm!<var>N</var></code>.
  158. </p>
  159. </dd>
  160. <dt><code>!gpdisp!<var>N</var></code></dt>
  161. <dd><p>Used with <code>ldah</code> and <code>lda</code> to load the GP from the current
  162. address, a-la the <code>ldgp</code> macro. The source register for the
  163. <code>ldah</code> instruction must contain the address of the <code>ldah</code>
  164. instruction. There must be exactly one <code>lda</code> instruction paired
  165. with the <code>ldah</code> instruction, though it may appear anywhere in
  166. the instruction stream. The immediate operands must be zero.
  167. </p>
  168. <div class="example">
  169. <pre class="example">bsr $26,foo
  170. ldah $29,0($26) !gpdisp!1
  171. lda $29,0($29) !gpdisp!1
  172. </pre></div>
  173. </dd>
  174. <dt><code>!gprelhigh</code></dt>
  175. <dd><p>Used with an <code>ldah</code> instruction to add the high 16 bits of a
  176. 32-bit displacement from the GP.
  177. </p>
  178. </dd>
  179. <dt><code>!gprellow</code></dt>
  180. <dd><p>Used with any memory format instruction to add the low 16 bits of a
  181. 32-bit displacement from the GP.
  182. </p>
  183. </dd>
  184. <dt><code>!gprel</code></dt>
  185. <dd><p>Used with any memory format instruction to add a 16-bit displacement
  186. from the GP.
  187. </p>
  188. </dd>
  189. <dt><code>!samegp</code></dt>
  190. <dd><p>Used with any branch format instruction to skip the GP load at the
  191. target address. The referenced symbol must have the same GP as the
  192. source object file, and it must be declared to either not use <code>$27</code>
  193. or perform a standard GP load in the first two instructions via the
  194. <code>.prologue</code> directive.
  195. </p>
  196. </dd>
  197. <dt><code>!tlsgd</code></dt>
  198. <dt><code>!tlsgd!<var>N</var></code></dt>
  199. <dd><p>Used with an <code>lda</code> instruction to load the address of a TLS
  200. descriptor for a symbol in the GOT.
  201. </p>
  202. <p>The sequence number <var>N</var> is optional, and if present it used to
  203. pair the descriptor load with both the <code>literal</code> loading the
  204. address of the <code>__tls_get_addr</code> function and the <code>lituse_tlsgd</code>
  205. marking the call to that function.
  206. </p>
  207. <p>For proper relaxation, both the <code>tlsgd</code>, <code>literal</code> and
  208. <code>lituse</code> relocations must be in the same extended basic block.
  209. That is, the relocation with the lowest address must be executed
  210. first at runtime.
  211. </p>
  212. </dd>
  213. <dt><code>!tlsldm</code></dt>
  214. <dt><code>!tlsldm!<var>N</var></code></dt>
  215. <dd><p>Used with an <code>lda</code> instruction to load the address of a TLS
  216. descriptor for the current module in the GOT.
  217. </p>
  218. <p>Similar in other respects to <code>tlsgd</code>.
  219. </p>
  220. </dd>
  221. <dt><code>!gotdtprel</code></dt>
  222. <dd><p>Used with an <code>ldq</code> instruction to load the offset of the TLS
  223. symbol within its module&rsquo;s thread-local storage block. Also known
  224. as the dynamic thread pointer offset or dtp-relative offset.
  225. </p>
  226. </dd>
  227. <dt><code>!dtprelhi</code></dt>
  228. <dt><code>!dtprello</code></dt>
  229. <dt><code>!dtprel</code></dt>
  230. <dd><p>Like <code>gprel</code> relocations except they compute dtp-relative offsets.
  231. </p>
  232. </dd>
  233. <dt><code>!gottprel</code></dt>
  234. <dd><p>Used with an <code>ldq</code> instruction to load the offset of the TLS
  235. symbol from the thread pointer. Also known as the tp-relative offset.
  236. </p>
  237. </dd>
  238. <dt><code>!tprelhi</code></dt>
  239. <dt><code>!tprello</code></dt>
  240. <dt><code>!tprel</code></dt>
  241. <dd><p>Like <code>gprel</code> relocations except they compute tp-relative offsets.
  242. </p></dd>
  243. </dl>
  244. <hr>
  245. <div class="header">
  246. <p>
  247. Previous: <a href="Alpha_002dRegs.html#Alpha_002dRegs" accesskey="p" rel="prev">Alpha-Regs</a>, Up: <a href="Alpha-Syntax.html#Alpha-Syntax" accesskey="u" rel="up">Alpha Syntax</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>
  248. </div>
  249. </body>
  250. </html>