Fuad Tabba | c588ecf | 2021-02-04 13:59:53 +0000 | [diff] [blame^] | 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 | |
| 5 | Copyright (C) 1991-2014 Free Software Foundation, Inc. |
| 6 | |
| 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 | --> |
| 14 | <!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ --> |
| 15 | <head> |
| 16 | <title>Using as: CRIS-Pic</title> |
| 17 | |
| 18 | <meta name="description" content="Using as: CRIS-Pic"> |
| 19 | <meta name="keywords" content="Using as: CRIS-Pic"> |
| 20 | <meta name="resource-type" content="document"> |
| 21 | <meta name="distribution" content="global"> |
| 22 | <meta name="Generator" content="makeinfo"> |
| 23 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 24 | <link href="index.html#Top" rel="start" title="Top"> |
| 25 | <link href="AS-Index.html#AS-Index" rel="index" title="AS Index"> |
| 26 | <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> |
| 27 | <link href="CRIS_002dSyntax.html#CRIS_002dSyntax" rel="up" title="CRIS-Syntax"> |
| 28 | <link href="CRIS_002dRegs.html#CRIS_002dRegs" rel="next" title="CRIS-Regs"> |
| 29 | <link href="CRIS_002dChars.html#CRIS_002dChars" rel="prev" title="CRIS-Chars"> |
| 30 | <style type="text/css"> |
| 31 | <!-- |
| 32 | a.summary-letter {text-decoration: none} |
| 33 | blockquote.smallquotation {font-size: smaller} |
| 34 | div.display {margin-left: 3.2em} |
| 35 | div.example {margin-left: 3.2em} |
| 36 | div.indentedblock {margin-left: 3.2em} |
| 37 | div.lisp {margin-left: 3.2em} |
| 38 | div.smalldisplay {margin-left: 3.2em} |
| 39 | div.smallexample {margin-left: 3.2em} |
| 40 | div.smallindentedblock {margin-left: 3.2em; font-size: smaller} |
| 41 | div.smalllisp {margin-left: 3.2em} |
| 42 | kbd {font-style:oblique} |
| 43 | pre.display {font-family: inherit} |
| 44 | pre.format {font-family: inherit} |
| 45 | pre.menu-comment {font-family: serif} |
| 46 | pre.menu-preformatted {font-family: serif} |
| 47 | pre.smalldisplay {font-family: inherit; font-size: smaller} |
| 48 | pre.smallexample {font-size: smaller} |
| 49 | pre.smallformat {font-family: inherit; font-size: smaller} |
| 50 | pre.smalllisp {font-size: smaller} |
| 51 | span.nocodebreak {white-space:nowrap} |
| 52 | span.nolinebreak {white-space:nowrap} |
| 53 | span.roman {font-family:serif; font-weight:normal} |
| 54 | span.sansserif {font-family:sans-serif; font-weight:normal} |
| 55 | ul.no-bullet {list-style: none} |
| 56 | --> |
| 57 | </style> |
| 58 | |
| 59 | |
| 60 | </head> |
| 61 | |
| 62 | <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"> |
| 63 | <a name="CRIS_002dPic"></a> |
| 64 | <div class="header"> |
| 65 | <p> |
| 66 | 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> [<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> |
| 67 | </div> |
| 68 | <hr> |
| 69 | <a name="Symbols-in-position_002dindependent-code"></a> |
| 70 | <h4 class="subsubsection">9.8.4.2 Symbols in position-independent code</h4> |
| 71 | <a name="index-Symbols-in-position_002dindependent-code_002c-CRIS"></a> |
| 72 | <a name="index-CRIS-symbols-in-position_002dindependent-code"></a> |
| 73 | <a name="index-Position_002dindependent-code_002c-symbols-in_002c-CRIS"></a> |
| 74 | |
| 75 | <p>When generating <a name="crispic"></a>position-independent code (SVR4 |
| 76 | PIC) for use in cris-axis-linux-gnu or crisv32-axis-linux-gnu |
| 77 | shared libraries, symbol |
| 78 | suffixes are used to specify what kind of run-time symbol lookup |
| 79 | will be used, expressed in the object as different |
| 80 | <em>relocation types</em>. Usually, all absolute symbol values |
| 81 | must be located in a table, the <em>global offset table</em>, |
| 82 | leaving the code position-independent; independent of values of |
| 83 | global symbols and independent of the address of the code. The |
| 84 | suffix modifies the value of the symbol, into for example an |
| 85 | index into the global offset table where the real symbol value |
| 86 | is entered, or a PC-relative value, or a value relative to the |
| 87 | start of the global offset table. All symbol suffixes start |
| 88 | with the character ‘<samp>:</samp>’ (omitted in the list below). Every |
| 89 | symbol use in code or a read-only section must therefore have a |
| 90 | PIC suffix to enable a useful shared library to be created. |
| 91 | Usually, these constructs must not be used with an additive |
| 92 | constant offset as is usually allowed, i.e. no 4 as in |
| 93 | <code>symbol + 4</code> is allowed. This restriction is checked at |
| 94 | link-time, not at assembly-time. |
| 95 | </p> |
| 96 | <dl compact="compact"> |
| 97 | <dt><code>GOT</code></dt> |
| 98 | <dd> |
| 99 | <p>Attaching this suffix to a symbol in an instruction causes the |
| 100 | symbol to be entered into the global offset table. The value is |
| 101 | a 32-bit index for that symbol into the global offset table. |
| 102 | The name of the corresponding relocation is |
| 103 | ‘<samp>R_CRIS_32_GOT</samp>’. Example: <code>move.d |
| 104 | [$r0+extsym:GOT],$r9</code> |
| 105 | </p> |
| 106 | </dd> |
| 107 | <dt><code>GOT16</code></dt> |
| 108 | <dd> |
| 109 | <p>Same as for ‘<samp>GOT</samp>’, but the value is a 16-bit index into the |
| 110 | global offset table. The corresponding relocation is |
| 111 | ‘<samp>R_CRIS_16_GOT</samp>’. Example: <code>move.d |
| 112 | [$r0+asymbol:GOT16],$r10</code> |
| 113 | </p> |
| 114 | </dd> |
| 115 | <dt><code>PLT</code></dt> |
| 116 | <dd> |
| 117 | <p>This suffix is used for function symbols. It causes a |
| 118 | <em>procedure linkage table</em>, an array of code stubs, to be |
| 119 | created at the time the shared object is created or linked |
| 120 | against, together with a global offset table entry. The value |
| 121 | is a pc-relative offset to the corresponding stub code in the |
| 122 | procedure linkage table. This arrangement causes the run-time |
| 123 | symbol resolver to be called to look up and set the value of the |
| 124 | symbol the first time the function is called (at latest; |
| 125 | depending environment variables). It is only safe to leave the |
| 126 | symbol unresolved this way if all references are function calls. |
| 127 | The name of the relocation is ‘<samp>R_CRIS_32_PLT_PCREL</samp>’. |
| 128 | Example: <code>add.d fnname:PLT,$pc</code> |
| 129 | </p> |
| 130 | </dd> |
| 131 | <dt><code>PLTG</code></dt> |
| 132 | <dd> |
| 133 | <p>Like PLT, but the value is relative to the beginning of the |
| 134 | global offset table. The relocation is |
| 135 | ‘<samp>R_CRIS_32_PLT_GOTREL</samp>’. Example: <code>move.d |
| 136 | fnname:PLTG,$r3</code> |
| 137 | </p> |
| 138 | </dd> |
| 139 | <dt><code>GOTPLT</code></dt> |
| 140 | <dd> |
| 141 | <p>Similar to ‘<samp>PLT</samp>’, but the value of the symbol is a 32-bit |
| 142 | index into the global offset table. This is somewhat of a mix |
| 143 | between the effect of the ‘<samp>GOT</samp>’ and the ‘<samp>PLT</samp>’ suffix; |
| 144 | the difference to ‘<samp>GOT</samp>’ is that there will be a procedure |
| 145 | linkage table entry created, and that the symbol is assumed to |
| 146 | be a function entry and will be resolved by the run-time |
| 147 | resolver as with ‘<samp>PLT</samp>’. The relocation is |
| 148 | ‘<samp>R_CRIS_32_GOTPLT</samp>’. Example: <code>jsr |
| 149 | [$r0+fnname:GOTPLT]</code> |
| 150 | </p> |
| 151 | </dd> |
| 152 | <dt><code>GOTPLT16</code></dt> |
| 153 | <dd> |
| 154 | <p>A variant of ‘<samp>GOTPLT</samp>’ giving a 16-bit value. Its |
| 155 | relocation name is ‘<samp>R_CRIS_16_GOTPLT</samp>’. Example: <code>jsr |
| 156 | [$r0+fnname:GOTPLT16]</code> |
| 157 | </p> |
| 158 | </dd> |
| 159 | <dt><code>GOTOFF</code></dt> |
| 160 | <dd> |
| 161 | <p>This suffix must only be attached to a local symbol, but may be |
| 162 | used in an expression adding an offset. The value is the |
| 163 | address of the symbol relative to the start of the global offset |
| 164 | table. The relocation name is ‘<samp>R_CRIS_32_GOTREL</samp>’. |
| 165 | Example: <code>move.d [$r0+localsym:GOTOFF],r3</code> |
| 166 | </p></dd> |
| 167 | </dl> |
| 168 | |
| 169 | <hr> |
| 170 | <div class="header"> |
| 171 | <p> |
| 172 | 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> [<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> |
| 173 | </div> |
| 174 | |
| 175 | |
| 176 | |
| 177 | </body> |
| 178 | </html> |