OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-binutils/] [binutils-2.19.1/] [gas/] [doc/] [c-cris.texi] - Blame information for rev 6

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 6 jlechner
@c Copyright 2002, 2004 Free Software Foundation, Inc.
2
@c This is part of the GAS manual.
3
@c For copying conditions, see the file as.texinfo.
4
@c CRIS description contributed by Axis Communications.
5
@ifset GENERIC
6
@page
7
@node CRIS-Dependent
8
@chapter CRIS Dependent Features
9
@end ifset
10
@ifclear GENERIC
11
@node Machine Dependencies
12
@chapter CRIS Dependent Features
13
@end ifclear
14
 
15
@cindex CRIS support
16
@menu
17
* CRIS-Opts::              Command-line Options
18
* CRIS-Expand::            Instruction expansion
19
* CRIS-Symbols::           Symbols
20
* CRIS-Syntax::            Syntax
21
@end menu
22
 
23
@node CRIS-Opts
24
@section Command-line Options
25
 
26
@cindex options, CRIS
27
@cindex CRIS options
28
The CRIS version of @code{@value{AS}} has these
29
machine-dependent command-line options.
30
 
31
@cindex @option{--emulation=criself} command line option, CRIS
32
@cindex @option{--emulation=crisaout} command line option, CRIS
33
@cindex CRIS @option{--emulation=criself} command line option
34
@cindex CRIS @option{--emulation=crisaout} command line option
35
 
36
The format of the generated object files can be either ELF or
37
a.out, specified by the command-line options
38
@option{--emulation=crisaout} and @option{--emulation=criself}.
39
The default is ELF (criself), unless @code{@value{AS}} has been
40
configured specifically for a.out by using the configuration
41
name @code{cris-axis-aout}.
42
 
43
@cindex @option{--underscore} command line option, CRIS
44
@cindex @option{--no-underscore} command line option, CRIS
45
@cindex CRIS @option{--underscore} command line option
46
@cindex CRIS @option{--no-underscore} command line option
47
There are two different link-incompatible ELF object file
48
variants for CRIS, for use in environments where symbols are
49
expected to be prefixed by a leading @samp{_} character and for
50
environments without such a symbol prefix.  The variant used for
51
GNU/Linux port has no symbol prefix.  Which variant to produce
52
is specified by either of the options @option{--underscore} and
53
@option{--no-underscore}.  The default is @option{--underscore}.
54
Since symbols in CRIS a.out objects are expected to have a
55
@samp{_} prefix, specifying @option{--no-underscore} when
56
generating a.out objects is an error.  Besides the object format
57
difference, the effect of this option is to parse register names
58
differently (@pxref{crisnous}).  The @option{--no-underscore}
59
option makes a @samp{$} register prefix mandatory.
60
 
61
@cindex @option{--pic} command line option, CRIS
62
@cindex CRIS @option{--pic} command line option
63
@cindex Position-independent code, CRIS
64
@cindex CRIS position-independent code
65
The option @option{--pic} must be passed to @code{@value{AS}} in
66
order to recognize the symbol syntax used for ELF (SVR4 PIC)
67
position-independent-code (@pxref{crispic}).  This will also
68
affect expansion of instructions.  The expansion with
69
@option{--pic} will use PC-relative rather than (slightly
70
faster) absolute addresses in those expansions.
71
 
72
@cindex @option{--march=@var{architecture}} command line option, CRIS
73
@cindex CRIS @option{--march=@var{architecture}} command line option
74
@cindex Architecture variant option, CRIS
75
@cindex CRIS architecture variant option
76
The option @option{--march=@var{architecture}}
77
@anchor{march-option}specifies the recognized instruction set
78
and recognized register names.  It also controls the
79
architecture type of the object file.  Valid values for
80
@var{architecture} are:
81
@table @code
82
 
83
@item v0_v10
84
All instructions and register names for any architecture variant
85
in the set v0@dots{}v10 are recognized.  This is the
86
default if the target is configured as cris-*.
87
 
88
@item v10
89
Only instructions and register names for CRIS v10 (as found in
90
ETRAX 100 LX) are recognized.  This is the default if the target
91
is configured as crisv10-*.
92
 
93
@item v32
94
Only instructions and register names for CRIS v32 (code name
95
Guinness) are recognized.  This is the default if the target is
96
configured as crisv32-*.  This value implies
97
@option{--no-mul-bug-abort}.  (A subsequent
98
@option{--mul-bug-abort} will turn it back on.)
99
 
100
@item common_v10_v32
101
Only instructions with register names and addressing modes with
102
opcodes common to the v10 and v32 are recognized.
103
@end table
104
 
105
@cindex @option{-N} command line option, CRIS
106
@cindex CRIS @option{-N} command line option
107
When @option{-N} is specified, @code{@value{AS}} will emit a
108
warning when a 16-bit branch instruction is expanded into a
109
32-bit multiple-instruction construct (@pxref{CRIS-Expand}).
110
 
111
@cindex @option{--no-mul-bug-abort} command line option, CRIS
112
@cindex @option{--mul-bug-abort} command line option, CRIS
113
@cindex CRIS @option{--no-mul-bug-abort} command line option
114
@cindex CRIS @option{--mul-bug-abort} command line option
115
 
116
Some versions of the CRIS v10, for example in the Etrax 100 LX,
117
contain a bug that causes destabilizing memory accesses when a
118
multiply instruction is executed with certain values in the
119
first operand just before a cache-miss.  When the
120
@option{--mul-bug-abort} command line option is active (the
121
default value), @code{@value{AS}} will refuse to assemble a file
122
containing a multiply instruction at a dangerous offset, one
123
that could be the last on a cache-line, or is in a section with
124
insufficient alignment.  This placement checking does not catch
125
any case where the multiply instruction is dangerously placed
126
because it is located in a delay-slot.  The
127
@option{--mul-bug-abort} command line option turns off the
128
checking.
129
 
130
@node CRIS-Expand
131
@section Instruction expansion
132
 
133
@cindex instruction expansion, CRIS
134
@cindex CRIS instruction expansion
135
@code{@value{AS}} will silently choose an instruction that fits
136
the operand size for @samp{[register+constant]} operands.  For
137
example, the offset @code{127} in @code{move.d [r3+127],r4} fits
138
in an instruction using a signed-byte offset.  Similarly,
139
@code{move.d [r2+32767],r1} will generate an instruction using a
140
16-bit offset.  For symbolic expressions and constants that do
141
not fit in 16 bits including the sign bit, a 32-bit offset is
142
generated.
143
 
144
For branches, @code{@value{AS}} will expand from a 16-bit branch
145
instruction into a sequence of instructions that can reach a
146
full 32-bit address.  Since this does not correspond to a single
147
instruction, such expansions can optionally be warned about.
148
@xref{CRIS-Opts}.
149
 
150
If the operand is found to fit the range, a @code{lapc} mnemonic
151
will translate to a @code{lapcq} instruction.  Use @code{lapc.d}
152
to force the 32-bit @code{lapc} instruction.
153
 
154
Similarly, the @code{addo} mnemonic will translate to the
155
shortest fitting instruction of @code{addoq}, @code{addo.w} and
156
@code{addo.d}, when used with a operand that is a constant known
157
at assembly time.
158
 
159
@node CRIS-Symbols
160
@section Symbols
161
@cindex Symbols, built-in, CRIS
162
@cindex Symbols, CRIS, built-in
163
@cindex CRIS built-in symbols
164
@cindex Built-in symbols, CRIS
165
 
166
Some symbols are defined by the assembler.  They're intended to
167
be used in conditional assembly, for example:
168
@smallexample
169
 .if ..asm.arch.cris.v32
170
 @var{code for CRIS v32}
171
 .elseif ..asm.arch.cris.common_v10_v32
172
 @var{code common to CRIS v32 and CRIS v10}
173
 .elseif ..asm.arch.cris.v10 | ..asm.arch.cris.any_v0_v10
174
 @var{code for v10}
175
 .else
176
 .error "Code needs to be added here."
177
 .endif
178
@end smallexample
179
 
180
These symbols are defined in the assembler, reflecting
181
command-line options, either when specified or the default.
182
They are always defined, to 0 or 1.
183
@table @code
184
 
185
@item ..asm.arch.cris.any_v0_v10
186
This symbol is non-zero when @option{--march=v0_v10} is specified
187
or the default.
188
 
189
@item ..asm.arch.cris.common_v10_v32
190
Set according to the option @option{--march=common_v10_v32}.
191
 
192
@item ..asm.arch.cris.v10
193
Reflects the option @option{--march=v10}.
194
 
195
@item ..asm.arch.cris.v32
196
Corresponds to @option{--march=v10}.
197
@end table
198
 
199
Speaking of symbols, when a symbol is used in code, it can have
200
a suffix modifying its value for use in position-independent
201
code. @xref{CRIS-Pic}.
202
 
203
@node CRIS-Syntax
204
@section Syntax
205
 
206
There are different aspects of the CRIS assembly syntax.
207
 
208
@menu
209
* CRIS-Chars::                  Special Characters
210
* CRIS-Pic::                    Position-Independent Code Symbols
211
* CRIS-Regs::                   Register Names
212
* CRIS-Pseudos::                Assembler Directives
213
@end menu
214
 
215
@node CRIS-Chars
216
@subsection Special Characters
217
@cindex line comment characters, CRIS
218
@cindex CRIS line comment characters
219
 
220
The character @samp{#} is a line comment character.  It starts a
221
comment if and only if it is placed at the beginning of a line.
222
 
223
A @samp{;} character starts a comment anywhere on the line,
224
causing all characters up to the end of the line to be ignored.
225
 
226
A @samp{@@} character is handled as a line separator equivalent
227
to a logical new-line character (except in a comment), so
228
separate instructions can be specified on a single line.
229
 
230
@node CRIS-Pic
231
@subsection Symbols in position-independent code
232
@cindex Symbols in position-independent code, CRIS
233
@cindex CRIS symbols in position-independent code
234
@cindex Position-independent code, symbols in, CRIS
235
 
236
When generating @anchor{crispic}position-independent code (SVR4
237
PIC) for use in cris-axis-linux-gnu or crisv32-axis-linux-gnu
238
shared libraries, symbol
239
suffixes are used to specify what kind of run-time symbol lookup
240
will be used, expressed in the object as different
241
@emph{relocation types}.  Usually, all absolute symbol values
242
must be located in a table, the @emph{global offset table},
243
leaving the code position-independent; independent of values of
244
global symbols and independent of the address of the code.  The
245
suffix modifies the value of the symbol, into for example an
246
index into the global offset table where the real symbol value
247
is entered, or a PC-relative value, or a value relative to the
248
start of the global offset table.  All symbol suffixes start
249
with the character @samp{:} (omitted in the list below).  Every
250
symbol use in code or a read-only section must therefore have a
251
PIC suffix to enable a useful shared library to be created.
252
Usually, these constructs must not be used with an additive
253
constant offset as is usually allowed, i.e.@: no 4 as in
254
@code{symbol + 4} is allowed.  This restriction is checked at
255
link-time, not at assembly-time.
256
 
257
@table @code
258
@item GOT
259
 
260
Attaching this suffix to a symbol in an instruction causes the
261
symbol to be entered into the global offset table.  The value is
262
a 32-bit index for that symbol into the global offset table.
263
The name of the corresponding relocation is
264
@samp{R_CRIS_32_GOT}.  Example: @code{move.d
265
[$r0+extsym:GOT],$r9}
266
 
267
@item GOT16
268
 
269
Same as for @samp{GOT}, but the value is a 16-bit index into the
270
global offset table.  The corresponding relocation is
271
@samp{R_CRIS_16_GOT}.  Example: @code{move.d
272
[$r0+asymbol:GOT16],$r10}
273
 
274
@item PLT
275
 
276
This suffix is used for function symbols.  It causes a
277
@emph{procedure linkage table}, an array of code stubs, to be
278
created at the time the shared object is created or linked
279
against, together with a global offset table entry.  The value
280
is a pc-relative offset to the corresponding stub code in the
281
procedure linkage table.  This arrangement causes the run-time
282
symbol resolver to be called to look up and set the value of the
283
symbol the first time the function is called (at latest;
284
depending environment variables).  It is only safe to leave the
285
symbol unresolved this way if all references are function calls.
286
The name of the relocation is @samp{R_CRIS_32_PLT_PCREL}.
287
Example: @code{add.d fnname:PLT,$pc}
288
 
289
@item PLTG
290
 
291
Like PLT, but the value is relative to the beginning of the
292
global offset table.  The relocation is
293
@samp{R_CRIS_32_PLT_GOTREL}.  Example: @code{move.d
294
fnname:PLTG,$r3}
295
 
296
@item GOTPLT
297
 
298
Similar to @samp{PLT}, but the value of the symbol is a 32-bit
299
index into the global offset table.  This is somewhat of a mix
300
between the effect of the @samp{GOT} and the @samp{PLT} suffix;
301
the difference to @samp{GOT} is that there will be a procedure
302
linkage table entry created, and that the symbol is assumed to
303
be a function entry and will be resolved by the run-time
304
resolver as with @samp{PLT}.  The relocation is
305
@samp{R_CRIS_32_GOTPLT}.  Example: @code{jsr
306
[$r0+fnname:GOTPLT]}
307
 
308
@item GOTPLT16
309
 
310
A variant of @samp{GOTPLT} giving a 16-bit value.  Its
311
relocation name is @samp{R_CRIS_16_GOTPLT}.  Example: @code{jsr
312
[$r0+fnname:GOTPLT16]}
313
 
314
@item GOTOFF
315
 
316
This suffix must only be attached to a local symbol, but may be
317
used in an expression adding an offset.  The value is the
318
address of the symbol relative to the start of the global offset
319
table.  The relocation name is @samp{R_CRIS_32_GOTREL}.
320
Example: @code{move.d [$r0+localsym:GOTOFF],r3}
321
@end table
322
 
323
@node CRIS-Regs
324
@subsection Register names
325
@cindex register names, CRIS
326
@cindex CRIS register names
327
 
328
A @samp{$} character may always prefix a general or special
329
register name in an instruction operand but is mandatory when
330
the option @option{--no-underscore} is specified or when the
331
@code{.syntax register_prefix} directive is in effect
332
(@pxref{crisnous}).  Register names are case-insensitive.
333
 
334
@node CRIS-Pseudos
335
@subsection Assembler Directives
336
@cindex assembler directives, CRIS
337
@cindex pseudo-ops, CRIS
338
@cindex CRIS assembler directives
339
@cindex CRIS pseudo-ops
340
 
341
There are a few CRIS-specific pseudo-directives in addition to
342
the generic ones.  @xref{Pseudo Ops}.  Constants emitted by
343
pseudo-directives are in little-endian order for CRIS.  There is
344
no support for floating-point-specific directives for CRIS.
345
 
346
@table @code
347
@item .dword EXPRESSIONS
348
@cindex assembler directive .dword, CRIS
349
@cindex pseudo-op .dword, CRIS
350
@cindex CRIS assembler directive .dword
351
@cindex CRIS pseudo-op .dword
352
 
353
The @code{.dword} directive is a synonym for @code{.int},
354
expecting zero or more EXPRESSIONS, separated by commas.  For
355
each expression, a 32-bit little-endian constant is emitted.
356
 
357
@item .syntax ARGUMENT
358
@cindex assembler directive .syntax, CRIS
359
@cindex pseudo-op .syntax, CRIS
360
@cindex CRIS assembler directive .syntax
361
@cindex CRIS pseudo-op .syntax
362
The @code{.syntax} directive takes as @var{ARGUMENT} one of the
363
following case-sensitive choices.
364
 
365
@table @code
366
@item no_register_prefix
367
 
368
The @code{.syntax no_register_prefix} @anchor{crisnous}directive
369
makes a @samp{$} character prefix on all registers optional.  It
370
overrides a previous setting, including the corresponding effect
371
of the option @option{--no-underscore}.  If this directive is
372
used when ordinary symbols do not have a @samp{_} character
373
prefix, care must be taken to avoid ambiguities whether an
374
operand is a register or a symbol; using symbols with names the
375
same as general or special registers then invoke undefined
376
behavior.
377
 
378
@item register_prefix
379
 
380
This directive makes a @samp{$} character prefix on all
381
registers mandatory.  It overrides a previous setting, including
382
the corresponding effect of the option @option{--underscore}.
383
 
384
@item leading_underscore
385
 
386
This is an assertion directive, emitting an error if the
387
@option{--no-underscore} option is in effect.
388
 
389
@item no_leading_underscore
390
 
391
This is the opposite of the @code{.syntax leading_underscore}
392
directive and emits an error if the option @option{--underscore}
393
is in effect.
394
@end table
395
 
396
@item .arch ARGUMENT
397
@cindex assembler directive .arch, CRIS
398
@cindex pseudo-op .arch, CRIS
399
@cindex CRIS assembler directive .arch
400
@cindex CRIS pseudo-op .arch
401
This is an assertion directive, giving an error if the specified
402
@var{ARGUMENT} is not the same as the specified or default value
403
for the @option{--march=@var{architecture}} option
404
(@pxref{march-option}).
405
 
406
@c If you compare with md_pseudo_table, you see that we don't
407
@c document ".file" and ".loc" here.  This is because we're just
408
@c wrapping the corresponding ELF function and emitting an error for
409
@c a.out.
410
@end table

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.