You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CRIS_002dPic.html 7.8KB

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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>CRIS-Pic (Using as)</title>
  16. <meta name="description" content="CRIS-Pic (Using as)">
  17. <meta name="keywords" content="CRIS-Pic (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="CRIS_002dSyntax.html#CRIS_002dSyntax" rel="up" title="CRIS-Syntax">
  25. <link href="CRIS_002dRegs.html#CRIS_002dRegs" rel="next" title="CRIS-Regs">
  26. <link href="CRIS_002dChars.html#CRIS_002dChars" rel="prev" title="CRIS-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="CRIS_002dPic"></a>
  57. <div class="header">
  58. <p>
  59. Next: <a href="CRIS_002dRegs.html#CRIS_002dRegs" accesskey="n" rel="next">CRIS-Regs</a>, Previous: <a href="CRIS_002dChars.html#CRIS_002dChars" accesskey="p" rel="prev">CRIS-Chars</a>, Up: <a href="CRIS_002dSyntax.html#CRIS_002dSyntax" accesskey="u" rel="up">CRIS-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="Symbols-in-position_002dindependent-code"></a>
  63. <h4 class="subsubsection">9.9.4.2 Symbols in position-independent code</h4>
  64. <a name="index-Symbols-in-position_002dindependent-code_002c-CRIS"></a>
  65. <a name="index-CRIS-symbols-in-position_002dindependent-code"></a>
  66. <a name="index-Position_002dindependent-code_002c-symbols-in_002c-CRIS"></a>
  67. <p>When generating <a name="crispic"></a>position-independent code (SVR4
  68. PIC) for use in cris-axis-linux-gnu or crisv32-axis-linux-gnu
  69. shared libraries, symbol
  70. suffixes are used to specify what kind of run-time symbol lookup
  71. will be used, expressed in the object as different
  72. <em>relocation types</em>. Usually, all absolute symbol values
  73. must be located in a table, the <em>global offset table</em>,
  74. leaving the code position-independent; independent of values of
  75. global symbols and independent of the address of the code. The
  76. suffix modifies the value of the symbol, into for example an
  77. index into the global offset table where the real symbol value
  78. is entered, or a PC-relative value, or a value relative to the
  79. start of the global offset table. All symbol suffixes start
  80. with the character &lsquo;<samp>:</samp>&rsquo; (omitted in the list below). Every
  81. symbol use in code or a read-only section must therefore have a
  82. PIC suffix to enable a useful shared library to be created.
  83. Usually, these constructs must not be used with an additive
  84. constant offset as is usually allowed, i.e. no 4 as in
  85. <code>symbol + 4</code> is allowed. This restriction is checked at
  86. link-time, not at assembly-time.
  87. </p>
  88. <dl compact="compact">
  89. <dt><code>GOT</code></dt>
  90. <dd>
  91. <p>Attaching this suffix to a symbol in an instruction causes the
  92. symbol to be entered into the global offset table. The value is
  93. a 32-bit index for that symbol into the global offset table.
  94. The name of the corresponding relocation is
  95. &lsquo;<samp>R_CRIS_32_GOT</samp>&rsquo;. Example: <code>move.d
  96. [$r0+extsym:GOT],$r9</code>
  97. </p>
  98. </dd>
  99. <dt><code>GOT16</code></dt>
  100. <dd>
  101. <p>Same as for &lsquo;<samp>GOT</samp>&rsquo;, but the value is a 16-bit index into the
  102. global offset table. The corresponding relocation is
  103. &lsquo;<samp>R_CRIS_16_GOT</samp>&rsquo;. Example: <code>move.d
  104. [$r0+asymbol:GOT16],$r10</code>
  105. </p>
  106. </dd>
  107. <dt><code>PLT</code></dt>
  108. <dd>
  109. <p>This suffix is used for function symbols. It causes a
  110. <em>procedure linkage table</em>, an array of code stubs, to be
  111. created at the time the shared object is created or linked
  112. against, together with a global offset table entry. The value
  113. is a pc-relative offset to the corresponding stub code in the
  114. procedure linkage table. This arrangement causes the run-time
  115. symbol resolver to be called to look up and set the value of the
  116. symbol the first time the function is called (at latest;
  117. depending environment variables). It is only safe to leave the
  118. symbol unresolved this way if all references are function calls.
  119. The name of the relocation is &lsquo;<samp>R_CRIS_32_PLT_PCREL</samp>&rsquo;.
  120. Example: <code>add.d fnname:PLT,$pc</code>
  121. </p>
  122. </dd>
  123. <dt><code>PLTG</code></dt>
  124. <dd>
  125. <p>Like PLT, but the value is relative to the beginning of the
  126. global offset table. The relocation is
  127. &lsquo;<samp>R_CRIS_32_PLT_GOTREL</samp>&rsquo;. Example: <code>move.d
  128. fnname:PLTG,$r3</code>
  129. </p>
  130. </dd>
  131. <dt><code>GOTPLT</code></dt>
  132. <dd>
  133. <p>Similar to &lsquo;<samp>PLT</samp>&rsquo;, but the value of the symbol is a 32-bit
  134. index into the global offset table. This is somewhat of a mix
  135. between the effect of the &lsquo;<samp>GOT</samp>&rsquo; and the &lsquo;<samp>PLT</samp>&rsquo; suffix;
  136. the difference to &lsquo;<samp>GOT</samp>&rsquo; is that there will be a procedure
  137. linkage table entry created, and that the symbol is assumed to
  138. be a function entry and will be resolved by the run-time
  139. resolver as with &lsquo;<samp>PLT</samp>&rsquo;. The relocation is
  140. &lsquo;<samp>R_CRIS_32_GOTPLT</samp>&rsquo;. Example: <code>jsr
  141. [$r0+fnname:GOTPLT]</code>
  142. </p>
  143. </dd>
  144. <dt><code>GOTPLT16</code></dt>
  145. <dd>
  146. <p>A variant of &lsquo;<samp>GOTPLT</samp>&rsquo; giving a 16-bit value. Its
  147. relocation name is &lsquo;<samp>R_CRIS_16_GOTPLT</samp>&rsquo;. Example: <code>jsr
  148. [$r0+fnname:GOTPLT16]</code>
  149. </p>
  150. </dd>
  151. <dt><code>GOTOFF</code></dt>
  152. <dd>
  153. <p>This suffix must only be attached to a local symbol, but may be
  154. used in an expression adding an offset. The value is the
  155. address of the symbol relative to the start of the global offset
  156. table. The relocation name is &lsquo;<samp>R_CRIS_32_GOTREL</samp>&rsquo;.
  157. Example: <code>move.d [$r0+localsym:GOTOFF],r3</code>
  158. </p></dd>
  159. </dl>
  160. <hr>
  161. <div class="header">
  162. <p>
  163. Next: <a href="CRIS_002dRegs.html#CRIS_002dRegs" accesskey="n" rel="next">CRIS-Regs</a>, Previous: <a href="CRIS_002dChars.html#CRIS_002dChars" accesskey="p" rel="prev">CRIS-Chars</a>, Up: <a href="CRIS_002dSyntax.html#CRIS_002dSyntax" accesskey="u" rel="up">CRIS-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>
  164. </div>
  165. </body>
  166. </html>