CRIS_002dPic.html 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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-2017 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 5.2, http://www.gnu.org/software/texinfo/ -->
  13. <head>
  14. <title>Using as: CRIS-Pic</title>
  15. <meta name="description" content="Using as: CRIS-Pic">
  16. <meta name="keywords" content="Using as: CRIS-Pic">
  17. <meta name="resource-type" content="document">
  18. <meta name="distribution" content="global">
  19. <meta name="Generator" content="makeinfo">
  20. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  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.smallquotation {font-size: smaller}
  31. div.display {margin-left: 3.2em}
  32. div.example {margin-left: 3.2em}
  33. div.indentedblock {margin-left: 3.2em}
  34. div.lisp {margin-left: 3.2em}
  35. div.smalldisplay {margin-left: 3.2em}
  36. div.smallexample {margin-left: 3.2em}
  37. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  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.nocodebreak {white-space:nowrap}
  49. span.nolinebreak {white-space:nowrap}
  50. span.roman {font-family:serif; 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" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  57. <a name="CRIS_002dPic"></a>
  58. <div class="header">
  59. <p>
  60. 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>
  61. </div>
  62. <hr>
  63. <a name="Symbols-in-position_002dindependent-code"></a>
  64. <h4 class="subsubsection">9.8.4.2 Symbols in position-independent code</h4>
  65. <a name="index-Symbols-in-position_002dindependent-code_002c-CRIS"></a>
  66. <a name="index-CRIS-symbols-in-position_002dindependent-code"></a>
  67. <a name="index-Position_002dindependent-code_002c-symbols-in_002c-CRIS"></a>
  68. <p>When generating <a name="crispic"></a>position-independent code (SVR4
  69. PIC) for use in cris-axis-linux-gnu or crisv32-axis-linux-gnu
  70. shared libraries, symbol
  71. suffixes are used to specify what kind of run-time symbol lookup
  72. will be used, expressed in the object as different
  73. <em>relocation types</em>. Usually, all absolute symbol values
  74. must be located in a table, the <em>global offset table</em>,
  75. leaving the code position-independent; independent of values of
  76. global symbols and independent of the address of the code. The
  77. suffix modifies the value of the symbol, into for example an
  78. index into the global offset table where the real symbol value
  79. is entered, or a PC-relative value, or a value relative to the
  80. start of the global offset table. All symbol suffixes start
  81. with the character &lsquo;<samp>:</samp>&rsquo; (omitted in the list below). Every
  82. symbol use in code or a read-only section must therefore have a
  83. PIC suffix to enable a useful shared library to be created.
  84. Usually, these constructs must not be used with an additive
  85. constant offset as is usually allowed, i.e. no 4 as in
  86. <code>symbol + 4</code> is allowed. This restriction is checked at
  87. link-time, not at assembly-time.
  88. </p>
  89. <dl compact="compact">
  90. <dt><code>GOT</code></dt>
  91. <dd>
  92. <p>Attaching this suffix to a symbol in an instruction causes the
  93. symbol to be entered into the global offset table. The value is
  94. a 32-bit index for that symbol into the global offset table.
  95. The name of the corresponding relocation is
  96. &lsquo;<samp>R_CRIS_32_GOT</samp>&rsquo;. Example: <code>move.d
  97. [$r0+extsym:GOT],$r9</code>
  98. </p>
  99. </dd>
  100. <dt><code>GOT16</code></dt>
  101. <dd>
  102. <p>Same as for &lsquo;<samp>GOT</samp>&rsquo;, but the value is a 16-bit index into the
  103. global offset table. The corresponding relocation is
  104. &lsquo;<samp>R_CRIS_16_GOT</samp>&rsquo;. Example: <code>move.d
  105. [$r0+asymbol:GOT16],$r10</code>
  106. </p>
  107. </dd>
  108. <dt><code>PLT</code></dt>
  109. <dd>
  110. <p>This suffix is used for function symbols. It causes a
  111. <em>procedure linkage table</em>, an array of code stubs, to be
  112. created at the time the shared object is created or linked
  113. against, together with a global offset table entry. The value
  114. is a pc-relative offset to the corresponding stub code in the
  115. procedure linkage table. This arrangement causes the run-time
  116. symbol resolver to be called to look up and set the value of the
  117. symbol the first time the function is called (at latest;
  118. depending environment variables). It is only safe to leave the
  119. symbol unresolved this way if all references are function calls.
  120. The name of the relocation is &lsquo;<samp>R_CRIS_32_PLT_PCREL</samp>&rsquo;.
  121. Example: <code>add.d fnname:PLT,$pc</code>
  122. </p>
  123. </dd>
  124. <dt><code>PLTG</code></dt>
  125. <dd>
  126. <p>Like PLT, but the value is relative to the beginning of the
  127. global offset table. The relocation is
  128. &lsquo;<samp>R_CRIS_32_PLT_GOTREL</samp>&rsquo;. Example: <code>move.d
  129. fnname:PLTG,$r3</code>
  130. </p>
  131. </dd>
  132. <dt><code>GOTPLT</code></dt>
  133. <dd>
  134. <p>Similar to &lsquo;<samp>PLT</samp>&rsquo;, but the value of the symbol is a 32-bit
  135. index into the global offset table. This is somewhat of a mix
  136. between the effect of the &lsquo;<samp>GOT</samp>&rsquo; and the &lsquo;<samp>PLT</samp>&rsquo; suffix;
  137. the difference to &lsquo;<samp>GOT</samp>&rsquo; is that there will be a procedure
  138. linkage table entry created, and that the symbol is assumed to
  139. be a function entry and will be resolved by the run-time
  140. resolver as with &lsquo;<samp>PLT</samp>&rsquo;. The relocation is
  141. &lsquo;<samp>R_CRIS_32_GOTPLT</samp>&rsquo;. Example: <code>jsr
  142. [$r0+fnname:GOTPLT]</code>
  143. </p>
  144. </dd>
  145. <dt><code>GOTPLT16</code></dt>
  146. <dd>
  147. <p>A variant of &lsquo;<samp>GOTPLT</samp>&rsquo; giving a 16-bit value. Its
  148. relocation name is &lsquo;<samp>R_CRIS_16_GOTPLT</samp>&rsquo;. Example: <code>jsr
  149. [$r0+fnname:GOTPLT16]</code>
  150. </p>
  151. </dd>
  152. <dt><code>GOTOFF</code></dt>
  153. <dd>
  154. <p>This suffix must only be attached to a local symbol, but may be
  155. used in an expression adding an offset. The value is the
  156. address of the symbol relative to the start of the global offset
  157. table. The relocation name is &lsquo;<samp>R_CRIS_32_GOTREL</samp>&rsquo;.
  158. Example: <code>move.d [$r0+localsym:GOTOFF],r3</code>
  159. </p></dd>
  160. </dl>
  161. <hr>
  162. <div class="header">
  163. <p>
  164. 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>
  165. </div>
  166. </body>
  167. </html>