blob: ebe5163eb60ea828a2b838789abbb58272b89606 [file] [log] [blame]
Fuad Tabbac588ecf2021-02-04 13:59:53 +00001<!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
5Copyright (C) 1991-2014 Free Software Foundation, Inc.
6
7Permission is granted to copy, distribute and/or modify this document
8under the terms of the GNU Free Documentation License, Version 1.3
9or any later version published by the Free Software Foundation;
10with no Invariant Sections, with no Front-Cover Texts, and with no
11Back-Cover Texts. A copy of the license is included in the
12section 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<!--
32a.summary-letter {text-decoration: none}
33blockquote.smallquotation {font-size: smaller}
34div.display {margin-left: 3.2em}
35div.example {margin-left: 3.2em}
36div.indentedblock {margin-left: 3.2em}
37div.lisp {margin-left: 3.2em}
38div.smalldisplay {margin-left: 3.2em}
39div.smallexample {margin-left: 3.2em}
40div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
41div.smalllisp {margin-left: 3.2em}
42kbd {font-style:oblique}
43pre.display {font-family: inherit}
44pre.format {font-family: inherit}
45pre.menu-comment {font-family: serif}
46pre.menu-preformatted {font-family: serif}
47pre.smalldisplay {font-family: inherit; font-size: smaller}
48pre.smallexample {font-size: smaller}
49pre.smallformat {font-family: inherit; font-size: smaller}
50pre.smalllisp {font-size: smaller}
51span.nocodebreak {white-space:nowrap}
52span.nolinebreak {white-space:nowrap}
53span.roman {font-family:serif; font-weight:normal}
54span.sansserif {font-family:sans-serif; font-weight:normal}
55ul.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>
66Next: <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>
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
76PIC) for use in cris-axis-linux-gnu or crisv32-axis-linux-gnu
77shared libraries, symbol
78suffixes are used to specify what kind of run-time symbol lookup
79will be used, expressed in the object as different
80<em>relocation types</em>. Usually, all absolute symbol values
81must be located in a table, the <em>global offset table</em>,
82leaving the code position-independent; independent of values of
83global symbols and independent of the address of the code. The
84suffix modifies the value of the symbol, into for example an
85index into the global offset table where the real symbol value
86is entered, or a PC-relative value, or a value relative to the
87start of the global offset table. All symbol suffixes start
88with the character &lsquo;<samp>:</samp>&rsquo; (omitted in the list below). Every
89symbol use in code or a read-only section must therefore have a
90PIC suffix to enable a useful shared library to be created.
91Usually, these constructs must not be used with an additive
92constant offset as is usually allowed, i.e. no 4 as in
93<code>symbol + 4</code> is allowed. This restriction is checked at
94link-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
100symbol to be entered into the global offset table. The value is
101a 32-bit index for that symbol into the global offset table.
102The name of the corresponding relocation is
103&lsquo;<samp>R_CRIS_32_GOT</samp>&rsquo;. 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 &lsquo;<samp>GOT</samp>&rsquo;, but the value is a 16-bit index into the
110global offset table. The corresponding relocation is
111&lsquo;<samp>R_CRIS_16_GOT</samp>&rsquo;. 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
119created at the time the shared object is created or linked
120against, together with a global offset table entry. The value
121is a pc-relative offset to the corresponding stub code in the
122procedure linkage table. This arrangement causes the run-time
123symbol resolver to be called to look up and set the value of the
124symbol the first time the function is called (at latest;
125depending environment variables). It is only safe to leave the
126symbol unresolved this way if all references are function calls.
127The name of the relocation is &lsquo;<samp>R_CRIS_32_PLT_PCREL</samp>&rsquo;.
128Example: <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
134global offset table. The relocation is
135&lsquo;<samp>R_CRIS_32_PLT_GOTREL</samp>&rsquo;. Example: <code>move.d
136fnname:PLTG,$r3</code>
137</p>
138</dd>
139<dt><code>GOTPLT</code></dt>
140<dd>
141<p>Similar to &lsquo;<samp>PLT</samp>&rsquo;, but the value of the symbol is a 32-bit
142index into the global offset table. This is somewhat of a mix
143between the effect of the &lsquo;<samp>GOT</samp>&rsquo; and the &lsquo;<samp>PLT</samp>&rsquo; suffix;
144the difference to &lsquo;<samp>GOT</samp>&rsquo; is that there will be a procedure
145linkage table entry created, and that the symbol is assumed to
146be a function entry and will be resolved by the run-time
147resolver as with &lsquo;<samp>PLT</samp>&rsquo;. The relocation is
148&lsquo;<samp>R_CRIS_32_GOTPLT</samp>&rsquo;. 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 &lsquo;<samp>GOTPLT</samp>&rsquo; giving a 16-bit value. Its
155relocation name is &lsquo;<samp>R_CRIS_16_GOTPLT</samp>&rsquo;. 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
162used in an expression adding an offset. The value is the
163address of the symbol relative to the start of the global offset
164table. The relocation name is &lsquo;<samp>R_CRIS_32_GOTREL</samp>&rsquo;.
165Example: <code>move.d [$r0+localsym:GOTOFF],r3</code>
166</p></dd>
167</dl>
168
169<hr>
170<div class="header">
171<p>
172Next: <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>
173</div>
174
175
176
177</body>
178</html>