|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <!-- This file documents the GNU Assembler "as".
-
- Copyright (C) 1991-2020 Free Software Foundation, Inc.
-
- Permission is granted to copy, distribute and/or modify this document
- under the terms of the GNU Free Documentation License, Version 1.3
- or any later version published by the Free Software Foundation;
- with no Invariant Sections, with no Front-Cover Texts, and with no
- Back-Cover Texts. A copy of the license is included in the
- section entitled "GNU Free Documentation License".
- -->
- <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>CRIS-Pic (Using as)</title>
-
- <meta name="description" content="CRIS-Pic (Using as)">
- <meta name="keywords" content="CRIS-Pic (Using as)">
- <meta name="resource-type" content="document">
- <meta name="distribution" content="global">
- <meta name="Generator" content="makeinfo">
- <link href="index.html#Top" rel="start" title="Top">
- <link href="AS-Index.html#AS-Index" rel="index" title="AS Index">
- <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
- <link href="CRIS_002dSyntax.html#CRIS_002dSyntax" rel="up" title="CRIS-Syntax">
- <link href="CRIS_002dRegs.html#CRIS_002dRegs" rel="next" title="CRIS-Regs">
- <link href="CRIS_002dChars.html#CRIS_002dChars" rel="prev" title="CRIS-Chars">
- <style type="text/css">
- <!--
- a.summary-letter {text-decoration: none}
- blockquote.indentedblock {margin-right: 0em}
- blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
- blockquote.smallquotation {font-size: smaller}
- div.display {margin-left: 3.2em}
- div.example {margin-left: 3.2em}
- div.lisp {margin-left: 3.2em}
- div.smalldisplay {margin-left: 3.2em}
- div.smallexample {margin-left: 3.2em}
- div.smalllisp {margin-left: 3.2em}
- kbd {font-style: oblique}
- pre.display {font-family: inherit}
- pre.format {font-family: inherit}
- pre.menu-comment {font-family: serif}
- pre.menu-preformatted {font-family: serif}
- pre.smalldisplay {font-family: inherit; font-size: smaller}
- pre.smallexample {font-size: smaller}
- pre.smallformat {font-family: inherit; font-size: smaller}
- pre.smalllisp {font-size: smaller}
- span.nolinebreak {white-space: nowrap}
- span.roman {font-family: initial; font-weight: normal}
- span.sansserif {font-family: sans-serif; font-weight: normal}
- ul.no-bullet {list-style: none}
- -->
- </style>
-
-
- </head>
-
- <body lang="en">
- <a name="CRIS_002dPic"></a>
- <div class="header">
- <p>
- 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>
- </div>
- <hr>
- <a name="Symbols-in-position_002dindependent-code"></a>
- <h4 class="subsubsection">9.9.4.2 Symbols in position-independent code</h4>
- <a name="index-Symbols-in-position_002dindependent-code_002c-CRIS"></a>
- <a name="index-CRIS-symbols-in-position_002dindependent-code"></a>
- <a name="index-Position_002dindependent-code_002c-symbols-in_002c-CRIS"></a>
-
- <p>When generating <a name="crispic"></a>position-independent code (SVR4
- PIC) for use in cris-axis-linux-gnu or crisv32-axis-linux-gnu
- shared libraries, symbol
- suffixes are used to specify what kind of run-time symbol lookup
- will be used, expressed in the object as different
- <em>relocation types</em>. Usually, all absolute symbol values
- must be located in a table, the <em>global offset table</em>,
- leaving the code position-independent; independent of values of
- global symbols and independent of the address of the code. The
- suffix modifies the value of the symbol, into for example an
- index into the global offset table where the real symbol value
- is entered, or a PC-relative value, or a value relative to the
- start of the global offset table. All symbol suffixes start
- with the character ‘<samp>:</samp>’ (omitted in the list below). Every
- symbol use in code or a read-only section must therefore have a
- PIC suffix to enable a useful shared library to be created.
- Usually, these constructs must not be used with an additive
- constant offset as is usually allowed, i.e. no 4 as in
- <code>symbol + 4</code> is allowed. This restriction is checked at
- link-time, not at assembly-time.
- </p>
- <dl compact="compact">
- <dt><code>GOT</code></dt>
- <dd>
- <p>Attaching this suffix to a symbol in an instruction causes the
- symbol to be entered into the global offset table. The value is
- a 32-bit index for that symbol into the global offset table.
- The name of the corresponding relocation is
- ‘<samp>R_CRIS_32_GOT</samp>’. Example: <code>move.d
- [$r0+extsym:GOT],$r9</code>
- </p>
- </dd>
- <dt><code>GOT16</code></dt>
- <dd>
- <p>Same as for ‘<samp>GOT</samp>’, but the value is a 16-bit index into the
- global offset table. The corresponding relocation is
- ‘<samp>R_CRIS_16_GOT</samp>’. Example: <code>move.d
- [$r0+asymbol:GOT16],$r10</code>
- </p>
- </dd>
- <dt><code>PLT</code></dt>
- <dd>
- <p>This suffix is used for function symbols. It causes a
- <em>procedure linkage table</em>, an array of code stubs, to be
- created at the time the shared object is created or linked
- against, together with a global offset table entry. The value
- is a pc-relative offset to the corresponding stub code in the
- procedure linkage table. This arrangement causes the run-time
- symbol resolver to be called to look up and set the value of the
- symbol the first time the function is called (at latest;
- depending environment variables). It is only safe to leave the
- symbol unresolved this way if all references are function calls.
- The name of the relocation is ‘<samp>R_CRIS_32_PLT_PCREL</samp>’.
- Example: <code>add.d fnname:PLT,$pc</code>
- </p>
- </dd>
- <dt><code>PLTG</code></dt>
- <dd>
- <p>Like PLT, but the value is relative to the beginning of the
- global offset table. The relocation is
- ‘<samp>R_CRIS_32_PLT_GOTREL</samp>’. Example: <code>move.d
- fnname:PLTG,$r3</code>
- </p>
- </dd>
- <dt><code>GOTPLT</code></dt>
- <dd>
- <p>Similar to ‘<samp>PLT</samp>’, but the value of the symbol is a 32-bit
- index into the global offset table. This is somewhat of a mix
- between the effect of the ‘<samp>GOT</samp>’ and the ‘<samp>PLT</samp>’ suffix;
- the difference to ‘<samp>GOT</samp>’ is that there will be a procedure
- linkage table entry created, and that the symbol is assumed to
- be a function entry and will be resolved by the run-time
- resolver as with ‘<samp>PLT</samp>’. The relocation is
- ‘<samp>R_CRIS_32_GOTPLT</samp>’. Example: <code>jsr
- [$r0+fnname:GOTPLT]</code>
- </p>
- </dd>
- <dt><code>GOTPLT16</code></dt>
- <dd>
- <p>A variant of ‘<samp>GOTPLT</samp>’ giving a 16-bit value. Its
- relocation name is ‘<samp>R_CRIS_16_GOTPLT</samp>’. Example: <code>jsr
- [$r0+fnname:GOTPLT16]</code>
- </p>
- </dd>
- <dt><code>GOTOFF</code></dt>
- <dd>
- <p>This suffix must only be attached to a local symbol, but may be
- used in an expression adding an offset. The value is the
- address of the symbol relative to the start of the global offset
- table. The relocation name is ‘<samp>R_CRIS_32_GOTREL</samp>’.
- Example: <code>move.d [$r0+localsym:GOTOFF],r3</code>
- </p></dd>
- </dl>
-
- <hr>
- <div class="header">
- <p>
- 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>
- </div>
-
-
-
- </body>
- </html>
|