~ubuntu-branches/ubuntu/utopic/binutils-arm64-cross/utopic

« back to all changes in this revision

Viewing changes to binutils-2.23.52.20130611/gas/doc/c-nios2.texi

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2013-06-20 17:38:09 UTC
  • Revision ID: package-import@ubuntu.com-20130620173809-app8lzgvymy5fg6c
Tags: 0.7
Build-depend on binutils-source (>= 2.23.52.20130620-1~).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
@c Copyright 2012, 2013 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 man end
 
5
@ifset GENERIC
 
6
@page
 
7
@node NiosII-Dependent
 
8
@chapter Nios II Dependent Features
 
9
@end ifset
 
10
@ifclear GENERIC
 
11
@node Machine Dependencies
 
12
@chapter Nios II Dependent Features
 
13
@end ifclear
 
14
 
 
15
@cindex Altera Nios II support
 
16
@cindex Nios support
 
17
@cindex Nios II support
 
18
@menu
 
19
* Nios II Options::              Options
 
20
* Nios II Syntax::               Syntax
 
21
* Nios II Relocations::          Relocations
 
22
* Nios II Directives::           Nios II Machine Directives
 
23
* Nios II Opcodes::              Opcodes
 
24
@end menu
 
25
 
 
26
@node Nios II Options
 
27
@section Options
 
28
@cindex Nios II options
 
29
@cindex options for Nios II
 
30
 
 
31
@c man begin OPTIONS
 
32
@table @gcctabopt
 
33
 
 
34
@cindex @code{relax-section} command line option, Nios II
 
35
@item -relax-section
 
36
Replace identified out-of-range branches with PC-relative @code{jmp}
 
37
sequences when possible.  The generated code sequences are suitable
 
38
for use in position-independent code, but there is a practical limit
 
39
on the extended branch range because of the length of the sequences.
 
40
This option is the default.
 
41
 
 
42
@cindex @code{relax-all} command line option, Nios II
 
43
@item -relax-all
 
44
Replace branch instructions not determinable to be in range
 
45
and all call instructions with @code{jmp} and @code{callr} sequences
 
46
(respectively).  This option generates absolute relocations against the
 
47
target symbols and is not appropriate for position-independent code.
 
48
 
 
49
@cindex @code{no-relax} command line option, Nios II
 
50
@item -no-relax
 
51
Do not replace any branches or calls.
 
52
 
 
53
@cindex @code{EB} command line option, Nios II
 
54
@item -EB
 
55
Generate big-endian output.
 
56
 
 
57
@cindex @code{EL} command line option, Nios II
 
58
@item -EL
 
59
Generate little-endian output.  This is the default.
 
60
 
 
61
@end table
 
62
@c man end
 
63
 
 
64
@node Nios II Syntax
 
65
@section Syntax
 
66
@menu
 
67
* Nios II Chars::                Special Characters
 
68
@end menu
 
69
 
 
70
 
 
71
@node Nios II Chars
 
72
@subsection Special Characters
 
73
 
 
74
@cindex line comment character, Nios II
 
75
@cindex Nios II line comment character
 
76
@cindex line separator character, Nios II
 
77
@cindex Nios II line separator character
 
78
@samp{#} is the line comment character.
 
79
@samp{;} is the line separator character.
 
80
 
 
81
 
 
82
@node Nios II Relocations
 
83
@section Nios II Machine Relocations
 
84
 
 
85
@cindex machine relocations, Nios II
 
86
@cindex Nios II machine relocations
 
87
 
 
88
@table @code
 
89
@cindex @code{hiadj} directive, Nios II
 
90
@item %hiadj(@var{expression})
 
91
Extract the upper 16 bits of @var{expression} and add 
 
92
one if the 15th bit is set. 
 
93
 
 
94
The value of @code{%hiadj(@var{expression})} is:
 
95
@smallexample
 
96
((@var{expression} >> 16) & 0xffff) + ((@var{expression} >> 15) & 0x01)
 
97
@end smallexample
 
98
 
 
99
The @code{%hiadj} relocation is intended to be used with
 
100
the @code{addi}, @code{ld} or @code{st} instructions
 
101
along with a @code{%lo}, in order to load a 32-bit constant.
 
102
 
 
103
@smallexample
 
104
movhi r2, %hiadj(symbol)
 
105
addi r2, r2, %lo(symbol)
 
106
@end smallexample
 
107
 
 
108
@cindex @code{hi} directive, Nios II
 
109
@item %hi(@var{expression})
 
110
Extract the upper 16 bits of @var{expression}.
 
111
 
 
112
@cindex @code{lo} directive, Nios II
 
113
@item %lo(@var{expression})
 
114
Extract the lower 16 bits of @var{expression}.
 
115
 
 
116
@cindex @code{gprel} directive, Nios II
 
117
@item %gprel(@var{expression})
 
118
Subtract the value of the symbol @code{_gp} from
 
119
@var{expression}. 
 
120
 
 
121
The intention of the @code{%gprel} relocation is
 
122
to have a fast small area of memory which only
 
123
takes a 16-bit immediate to access.
 
124
 
 
125
@smallexample
 
126
        .section .sdata
 
127
fastint:
 
128
        .int 123
 
129
        .section .text
 
130
        ldw r4, %gprel(fastint)(gp)
 
131
@end smallexample
 
132
 
 
133
@cindex @code{call} directive, Nios II
 
134
@cindex @code{got} directive, Nios II
 
135
@cindex @code{gotoff} directive, Nios II
 
136
@cindex @code{gotoff_lo} directive, Nios II
 
137
@cindex @code{gotoff_hiadj} directive, Nios II
 
138
@cindex @code{tls_gd} directive, Nios II
 
139
@cindex @code{tls_ie} directive, Nios II
 
140
@cindex @code{tls_le} directive, Nios II
 
141
@cindex @code{tls_ldm} directive, Nios II
 
142
@cindex @code{tls_ldo} directive, Nios II
 
143
@item %call(@var{expression})
 
144
@itemx %got(@var{expression})
 
145
@itemx %gotoff(@var{expression})
 
146
@itemx %gotoff_lo(@var{expression})
 
147
@itemx %gotoff_hiadj(@var{expression})
 
148
@itemx %tls_gd(@var{expression})
 
149
@itemx %tls_ie(@var{expression})
 
150
@itemx %tls_le(@var{expression})
 
151
@itemx %tls_ldm(@var{expression})
 
152
@itemx %tls_ldo(@var{expression})
 
153
 
 
154
These relocations support the ABI for Linux Systems documented in the
 
155
@cite{Nios II Processor Reference Handbook}.
 
156
@end table
 
157
 
 
158
 
 
159
@node Nios II Directives
 
160
@section Nios II Machine Directives
 
161
 
 
162
@cindex machine directives, Nios II
 
163
@cindex Nios II machine directives
 
164
 
 
165
@table @code
 
166
 
 
167
@cindex @code{align} directive, Nios II
 
168
@item .align @var{expression} [, @var{expression}]
 
169
This is the generic @code{.align} directive, however
 
170
this aligns to a power of two.
 
171
 
 
172
@cindex @code{half} directive, Nios II
 
173
@item .half @var{expression}
 
174
Create an aligned constant 2 bytes in size.
 
175
 
 
176
@cindex @code{word} directive, Nios II
 
177
@item .word @var{expression}
 
178
Create an aligned constant 4 bytes in size.
 
179
 
 
180
@cindex @code{dword} directive, Nios II
 
181
@item .dword @var{expression}
 
182
Create an aligned constant 8 bytes in size.
 
183
 
 
184
@cindex @code{2byte} directive, Nios II
 
185
@item .2byte @var{expression}
 
186
Create an unaligned constant 2 bytes in size.
 
187
 
 
188
@cindex @code{4byte} directive, Nios II
 
189
@item .4byte @var{expression}
 
190
Create an unaligned constant 4 bytes in size.
 
191
 
 
192
@cindex @code{8byte} directive, Nios II
 
193
@item .8byte @var{expression}
 
194
Create an unaligned constant 8 bytes in size.
 
195
 
 
196
@cindex @code{16byte} directive, Nios II
 
197
@item .16byte @var{expression}
 
198
Create an unaligned constant 16 bytes in size.
 
199
 
 
200
@cindex @code{set noat} directive, Nios II
 
201
@item .set noat
 
202
Allows assembly code to use @code{at} register without 
 
203
warning.  Macro or relaxation expansions
 
204
generate warnings.
 
205
 
 
206
@cindex @code{set at} directive, Nios II
 
207
@item .set at
 
208
Assembly code using @code{at} register generates
 
209
warnings, and macro expansion and relaxation are
 
210
enabled.
 
211
 
 
212
@cindex @code{set nobreak} directive, Nios II
 
213
@item .set nobreak
 
214
Allows assembly code to use @code{ba} and @code{bt}
 
215
registers without warning. 
 
216
 
 
217
@cindex @code{set break} directive, Nios II
 
218
@item .set break
 
219
Turns warnings back on for using @code{ba} and @code{bt}
 
220
registers.
 
221
 
 
222
@cindex @code{set norelax} directive, Nios II
 
223
@item .set norelax
 
224
Do not replace any branches or calls.
 
225
 
 
226
@cindex @code{set relaxsection} directive, Nios II
 
227
@item .set relaxsection
 
228
Replace identified out-of-range branches with 
 
229
@code{jmp} sequences (default).
 
230
 
 
231
@cindex @code{set relaxall} directive, Nios II
 
232
@item .set relaxsection
 
233
Replace all branch and call instructions with
 
234
@code{jmp} and @code{callr} sequences.
 
235
 
 
236
@cindex @code{set} directive, Nios II
 
237
@item .set @dots{}
 
238
All other @code{.set} are the normal use.
 
239
 
 
240
@end table
 
241
 
 
242
@node Nios II Opcodes
 
243
@section Opcodes
 
244
 
 
245
@cindex Nios II opcodes
 
246
@cindex opcodes for Nios II
 
247
@code{@value{AS}} implements all the standard Nios II opcodes documented in the
 
248
@cite{Nios II Processor Reference Handbook}, including the assembler
 
249
pseudo-instructions.