1 |
38 |
julius |
@c Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
|
2 |
|
|
@c Free Software Foundation, Inc.
|
3 |
|
|
@c This is part of the GAS manual.
|
4 |
|
|
@c For copying conditions, see the file as.texinfo.
|
5 |
|
|
|
6 |
|
|
@ifset GENERIC
|
7 |
|
|
@page
|
8 |
|
|
@node ARM-Dependent
|
9 |
|
|
@chapter ARM Dependent Features
|
10 |
|
|
@end ifset
|
11 |
|
|
|
12 |
|
|
@ifclear GENERIC
|
13 |
|
|
@node Machine Dependencies
|
14 |
|
|
@chapter ARM Dependent Features
|
15 |
|
|
@end ifclear
|
16 |
|
|
|
17 |
|
|
@cindex ARM support
|
18 |
|
|
@cindex Thumb support
|
19 |
|
|
@menu
|
20 |
|
|
* ARM Options:: Options
|
21 |
|
|
* ARM Syntax:: Syntax
|
22 |
|
|
* ARM Floating Point:: Floating Point
|
23 |
|
|
* ARM Directives:: ARM Machine Directives
|
24 |
|
|
* ARM Opcodes:: Opcodes
|
25 |
|
|
* ARM Mapping Symbols:: Mapping Symbols
|
26 |
|
|
@end menu
|
27 |
|
|
|
28 |
|
|
@node ARM Options
|
29 |
|
|
@section Options
|
30 |
|
|
@cindex ARM options (none)
|
31 |
|
|
@cindex options for ARM (none)
|
32 |
|
|
|
33 |
|
|
@table @code
|
34 |
|
|
|
35 |
|
|
@cindex @code{-mcpu=} command line option, ARM
|
36 |
|
|
@item -mcpu=@var{processor}[+@var{extension}@dots{}]
|
37 |
|
|
This option specifies the target processor. The assembler will issue an
|
38 |
|
|
error message if an attempt is made to assemble an instruction which
|
39 |
|
|
will not execute on the target processor. The following processor names are
|
40 |
|
|
recognized:
|
41 |
|
|
@code{arm1},
|
42 |
|
|
@code{arm2},
|
43 |
|
|
@code{arm250},
|
44 |
|
|
@code{arm3},
|
45 |
|
|
@code{arm6},
|
46 |
|
|
@code{arm60},
|
47 |
|
|
@code{arm600},
|
48 |
|
|
@code{arm610},
|
49 |
|
|
@code{arm620},
|
50 |
|
|
@code{arm7},
|
51 |
|
|
@code{arm7m},
|
52 |
|
|
@code{arm7d},
|
53 |
|
|
@code{arm7dm},
|
54 |
|
|
@code{arm7di},
|
55 |
|
|
@code{arm7dmi},
|
56 |
|
|
@code{arm70},
|
57 |
|
|
@code{arm700},
|
58 |
|
|
@code{arm700i},
|
59 |
|
|
@code{arm710},
|
60 |
|
|
@code{arm710t},
|
61 |
|
|
@code{arm720},
|
62 |
|
|
@code{arm720t},
|
63 |
|
|
@code{arm740t},
|
64 |
|
|
@code{arm710c},
|
65 |
|
|
@code{arm7100},
|
66 |
|
|
@code{arm7500},
|
67 |
|
|
@code{arm7500fe},
|
68 |
|
|
@code{arm7t},
|
69 |
|
|
@code{arm7tdmi},
|
70 |
|
|
@code{arm7tdmi-s},
|
71 |
|
|
@code{arm8},
|
72 |
|
|
@code{arm810},
|
73 |
|
|
@code{strongarm},
|
74 |
|
|
@code{strongarm1},
|
75 |
|
|
@code{strongarm110},
|
76 |
|
|
@code{strongarm1100},
|
77 |
|
|
@code{strongarm1110},
|
78 |
|
|
@code{arm9},
|
79 |
|
|
@code{arm920},
|
80 |
|
|
@code{arm920t},
|
81 |
|
|
@code{arm922t},
|
82 |
|
|
@code{arm940t},
|
83 |
|
|
@code{arm9tdmi},
|
84 |
|
|
@code{arm9e},
|
85 |
|
|
@code{arm926e},
|
86 |
|
|
@code{arm926ej-s},
|
87 |
|
|
@code{arm946e-r0},
|
88 |
|
|
@code{arm946e},
|
89 |
|
|
@code{arm946e-s},
|
90 |
|
|
@code{arm966e-r0},
|
91 |
|
|
@code{arm966e},
|
92 |
|
|
@code{arm966e-s},
|
93 |
|
|
@code{arm968e-s},
|
94 |
|
|
@code{arm10t},
|
95 |
|
|
@code{arm10tdmi},
|
96 |
|
|
@code{arm10e},
|
97 |
|
|
@code{arm1020},
|
98 |
|
|
@code{arm1020t},
|
99 |
|
|
@code{arm1020e},
|
100 |
|
|
@code{arm1022e},
|
101 |
|
|
@code{arm1026ej-s},
|
102 |
|
|
@code{arm1136j-s},
|
103 |
|
|
@code{arm1136jf-s},
|
104 |
|
|
@code{arm1156t2-s},
|
105 |
|
|
@code{arm1156t2f-s},
|
106 |
|
|
@code{arm1176jz-s},
|
107 |
|
|
@code{arm1176jzf-s},
|
108 |
|
|
@code{mpcore},
|
109 |
|
|
@code{mpcorenovfp},
|
110 |
|
|
@code{cortex-a8},
|
111 |
|
|
@code{cortex-a9},
|
112 |
|
|
@code{cortex-r4},
|
113 |
|
|
@code{cortex-m3},
|
114 |
|
|
@code{ep9312} (ARM920 with Cirrus Maverick coprocessor),
|
115 |
|
|
@code{i80200} (Intel XScale processor)
|
116 |
|
|
@code{iwmmxt} (Intel(r) XScale processor with Wireless MMX(tm) technology coprocessor)
|
117 |
|
|
and
|
118 |
|
|
@code{xscale}.
|
119 |
|
|
The special name @code{all} may be used to allow the
|
120 |
|
|
assembler to accept instructions valid for any ARM processor.
|
121 |
|
|
|
122 |
|
|
In addition to the basic instruction set, the assembler can be told to
|
123 |
|
|
accept various extension mnemonics that extend the processor using the
|
124 |
|
|
co-processor instruction space. For example, @code{-mcpu=arm920+maverick}
|
125 |
|
|
is equivalent to specifying @code{-mcpu=ep9312}. The following extensions
|
126 |
|
|
are currently supported:
|
127 |
|
|
@code{+maverick}
|
128 |
|
|
@code{+iwmmxt}
|
129 |
|
|
and
|
130 |
|
|
@code{+xscale}.
|
131 |
|
|
|
132 |
|
|
@cindex @code{-march=} command line option, ARM
|
133 |
|
|
@item -march=@var{architecture}[+@var{extension}@dots{}]
|
134 |
|
|
This option specifies the target architecture. The assembler will issue
|
135 |
|
|
an error message if an attempt is made to assemble an instruction which
|
136 |
|
|
will not execute on the target architecture. The following architecture
|
137 |
|
|
names are recognized:
|
138 |
|
|
@code{armv1},
|
139 |
|
|
@code{armv2},
|
140 |
|
|
@code{armv2a},
|
141 |
|
|
@code{armv2s},
|
142 |
|
|
@code{armv3},
|
143 |
|
|
@code{armv3m},
|
144 |
|
|
@code{armv4},
|
145 |
|
|
@code{armv4xm},
|
146 |
|
|
@code{armv4t},
|
147 |
|
|
@code{armv4txm},
|
148 |
|
|
@code{armv5},
|
149 |
|
|
@code{armv5t},
|
150 |
|
|
@code{armv5txm},
|
151 |
|
|
@code{armv5te},
|
152 |
|
|
@code{armv5texp},
|
153 |
|
|
@code{armv6},
|
154 |
|
|
@code{armv6j},
|
155 |
|
|
@code{armv6k},
|
156 |
|
|
@code{armv6z},
|
157 |
|
|
@code{armv6zk},
|
158 |
|
|
@code{armv7},
|
159 |
|
|
@code{armv7-a},
|
160 |
|
|
@code{armv7-r},
|
161 |
|
|
@code{armv7-m},
|
162 |
|
|
@code{iwmmxt}
|
163 |
|
|
and
|
164 |
|
|
@code{xscale}.
|
165 |
|
|
If both @code{-mcpu} and
|
166 |
|
|
@code{-march} are specified, the assembler will use
|
167 |
|
|
the setting for @code{-mcpu}.
|
168 |
|
|
|
169 |
|
|
The architecture option can be extended with the same instruction set
|
170 |
|
|
extension options as the @code{-mcpu} option.
|
171 |
|
|
|
172 |
|
|
@cindex @code{-mfpu=} command line option, ARM
|
173 |
|
|
@item -mfpu=@var{floating-point-format}
|
174 |
|
|
|
175 |
|
|
This option specifies the floating point format to assemble for. The
|
176 |
|
|
assembler will issue an error message if an attempt is made to assemble
|
177 |
|
|
an instruction which will not execute on the target floating point unit.
|
178 |
|
|
The following format options are recognized:
|
179 |
|
|
@code{softfpa},
|
180 |
|
|
@code{fpe},
|
181 |
|
|
@code{fpe2},
|
182 |
|
|
@code{fpe3},
|
183 |
|
|
@code{fpa},
|
184 |
|
|
@code{fpa10},
|
185 |
|
|
@code{fpa11},
|
186 |
|
|
@code{arm7500fe},
|
187 |
|
|
@code{softvfp},
|
188 |
|
|
@code{softvfp+vfp},
|
189 |
|
|
@code{vfp},
|
190 |
|
|
@code{vfp10},
|
191 |
|
|
@code{vfp10-r0},
|
192 |
|
|
@code{vfp9},
|
193 |
|
|
@code{vfpxd},
|
194 |
|
|
@code{vfpv2}
|
195 |
|
|
@code{vfpv3}
|
196 |
|
|
@code{vfpv3-d16}
|
197 |
|
|
@code{arm1020t},
|
198 |
|
|
@code{arm1020e},
|
199 |
|
|
@code{arm1136jf-s},
|
200 |
|
|
@code{maverick}
|
201 |
|
|
and
|
202 |
|
|
@code{neon}.
|
203 |
|
|
|
204 |
|
|
In addition to determining which instructions are assembled, this option
|
205 |
|
|
also affects the way in which the @code{.double} assembler directive behaves
|
206 |
|
|
when assembling little-endian code.
|
207 |
|
|
|
208 |
|
|
The default is dependent on the processor selected. For Architecture 5 or
|
209 |
|
|
later, the default is to assembler for VFP instructions; for earlier
|
210 |
|
|
architectures the default is to assemble for FPA instructions.
|
211 |
|
|
|
212 |
|
|
@cindex @code{-mthumb} command line option, ARM
|
213 |
|
|
@item -mthumb
|
214 |
|
|
This option specifies that the assembler should start assembling Thumb
|
215 |
|
|
instructions; that is, it should behave as though the file starts with a
|
216 |
|
|
@code{.code 16} directive.
|
217 |
|
|
|
218 |
|
|
@cindex @code{-mthumb-interwork} command line option, ARM
|
219 |
|
|
@item -mthumb-interwork
|
220 |
|
|
This option specifies that the output generated by the assembler should
|
221 |
|
|
be marked as supporting interworking.
|
222 |
|
|
|
223 |
|
|
@cindex @code{-mapcs} command line option, ARM
|
224 |
|
|
@item -mapcs @code{[26|32]}
|
225 |
|
|
This option specifies that the output generated by the assembler should
|
226 |
|
|
be marked as supporting the indicated version of the Arm Procedure.
|
227 |
|
|
Calling Standard.
|
228 |
|
|
|
229 |
|
|
@cindex @code{-matpcs} command line option, ARM
|
230 |
|
|
@item -matpcs
|
231 |
|
|
This option specifies that the output generated by the assembler should
|
232 |
|
|
be marked as supporting the Arm/Thumb Procedure Calling Standard. If
|
233 |
|
|
enabled this option will cause the assembler to create an empty
|
234 |
|
|
debugging section in the object file called .arm.atpcs. Debuggers can
|
235 |
|
|
use this to determine the ABI being used by.
|
236 |
|
|
|
237 |
|
|
@cindex @code{-mapcs-float} command line option, ARM
|
238 |
|
|
@item -mapcs-float
|
239 |
|
|
This indicates the floating point variant of the APCS should be
|
240 |
|
|
used. In this variant floating point arguments are passed in FP
|
241 |
|
|
registers rather than integer registers.
|
242 |
|
|
|
243 |
|
|
@cindex @code{-mapcs-reentrant} command line option, ARM
|
244 |
|
|
@item -mapcs-reentrant
|
245 |
|
|
This indicates that the reentrant variant of the APCS should be used.
|
246 |
|
|
This variant supports position independent code.
|
247 |
|
|
|
248 |
|
|
@cindex @code{-mfloat-abi=} command line option, ARM
|
249 |
|
|
@item -mfloat-abi=@var{abi}
|
250 |
|
|
This option specifies that the output generated by the assembler should be
|
251 |
|
|
marked as using specified floating point ABI.
|
252 |
|
|
The following values are recognized:
|
253 |
|
|
@code{soft},
|
254 |
|
|
@code{softfp}
|
255 |
|
|
and
|
256 |
|
|
@code{hard}.
|
257 |
|
|
|
258 |
|
|
@cindex @code{-eabi=} command line option, ARM
|
259 |
|
|
@item -meabi=@var{ver}
|
260 |
|
|
This option specifies which EABI version the produced object files should
|
261 |
|
|
conform to.
|
262 |
|
|
The following values are recognized:
|
263 |
|
|
@code{gnu},
|
264 |
|
|
@code{4}
|
265 |
|
|
and
|
266 |
|
|
@code{5}.
|
267 |
|
|
|
268 |
|
|
@cindex @code{-EB} command line option, ARM
|
269 |
|
|
@item -EB
|
270 |
|
|
This option specifies that the output generated by the assembler should
|
271 |
|
|
be marked as being encoded for a big-endian processor.
|
272 |
|
|
|
273 |
|
|
@cindex @code{-EL} command line option, ARM
|
274 |
|
|
@item -EL
|
275 |
|
|
This option specifies that the output generated by the assembler should
|
276 |
|
|
be marked as being encoded for a little-endian processor.
|
277 |
|
|
|
278 |
|
|
@cindex @code{-k} command line option, ARM
|
279 |
|
|
@cindex PIC code generation for ARM
|
280 |
|
|
@item -k
|
281 |
|
|
This option specifies that the output of the assembler should be marked
|
282 |
|
|
as position-independent code (PIC).
|
283 |
|
|
|
284 |
|
|
@cindex @code{--fix-v4bx} command line option, ARM
|
285 |
|
|
@item --fix-v4bx
|
286 |
|
|
Allow @code{BX} instructions in ARMv4 code. This is intended for use with
|
287 |
|
|
the linker option of the same name.
|
288 |
|
|
|
289 |
|
|
@end table
|
290 |
|
|
|
291 |
|
|
|
292 |
|
|
@node ARM Syntax
|
293 |
|
|
@section Syntax
|
294 |
|
|
@menu
|
295 |
|
|
* ARM-Chars:: Special Characters
|
296 |
|
|
* ARM-Regs:: Register Names
|
297 |
|
|
* ARM-Relocations:: Relocations
|
298 |
|
|
@end menu
|
299 |
|
|
|
300 |
|
|
@node ARM-Chars
|
301 |
|
|
@subsection Special Characters
|
302 |
|
|
|
303 |
|
|
@cindex line comment character, ARM
|
304 |
|
|
@cindex ARM line comment character
|
305 |
|
|
The presence of a @samp{@@} on a line indicates the start of a comment
|
306 |
|
|
that extends to the end of the current line. If a @samp{#} appears as
|
307 |
|
|
the first character of a line, the whole line is treated as a comment.
|
308 |
|
|
|
309 |
|
|
@cindex line separator, ARM
|
310 |
|
|
@cindex statement separator, ARM
|
311 |
|
|
@cindex ARM line separator
|
312 |
|
|
The @samp{;} character can be used instead of a newline to separate
|
313 |
|
|
statements.
|
314 |
|
|
|
315 |
|
|
@cindex immediate character, ARM
|
316 |
|
|
@cindex ARM immediate character
|
317 |
|
|
Either @samp{#} or @samp{$} can be used to indicate immediate operands.
|
318 |
|
|
|
319 |
|
|
@cindex identifiers, ARM
|
320 |
|
|
@cindex ARM identifiers
|
321 |
|
|
*TODO* Explain about /data modifier on symbols.
|
322 |
|
|
|
323 |
|
|
@node ARM-Regs
|
324 |
|
|
@subsection Register Names
|
325 |
|
|
|
326 |
|
|
@cindex ARM register names
|
327 |
|
|
@cindex register names, ARM
|
328 |
|
|
*TODO* Explain about ARM register naming, and the predefined names.
|
329 |
|
|
|
330 |
|
|
@node ARM Floating Point
|
331 |
|
|
@section Floating Point
|
332 |
|
|
|
333 |
|
|
@cindex floating point, ARM (@sc{ieee})
|
334 |
|
|
@cindex ARM floating point (@sc{ieee})
|
335 |
|
|
The ARM family uses @sc{ieee} floating-point numbers.
|
336 |
|
|
|
337 |
|
|
@node ARM-Relocations
|
338 |
|
|
@subsection ARM relocation generation
|
339 |
|
|
|
340 |
|
|
@cindex data relocations, ARM
|
341 |
|
|
@cindex ARM data relocations
|
342 |
|
|
Specific data relocations can be generated by putting the relocation name
|
343 |
|
|
in parentheses after the symbol name. For example:
|
344 |
|
|
|
345 |
|
|
@smallexample
|
346 |
|
|
.word foo(TARGET1)
|
347 |
|
|
@end smallexample
|
348 |
|
|
|
349 |
|
|
This will generate an @samp{R_ARM_TARGET1} relocation against the symbol
|
350 |
|
|
@var{foo}.
|
351 |
|
|
The following relocations are supported:
|
352 |
|
|
@code{GOT},
|
353 |
|
|
@code{GOTOFF},
|
354 |
|
|
@code{TARGET1},
|
355 |
|
|
@code{TARGET2},
|
356 |
|
|
@code{SBREL},
|
357 |
|
|
@code{TLSGD},
|
358 |
|
|
@code{TLSLDM},
|
359 |
|
|
@code{TLSLDO},
|
360 |
|
|
@code{GOTTPOFF}
|
361 |
|
|
and
|
362 |
|
|
@code{TPOFF}.
|
363 |
|
|
|
364 |
|
|
For compatibility with older toolchains the assembler also accepts
|
365 |
|
|
@code{(PLT)} after branch targets. This will generate the deprecated
|
366 |
|
|
@samp{R_ARM_PLT32} relocation.
|
367 |
|
|
|
368 |
|
|
@cindex MOVW and MOVT relocations, ARM
|
369 |
|
|
Relocations for @samp{MOVW} and @samp{MOVT} instructions can be generated
|
370 |
|
|
by prefixing the value with @samp{#:lower16:} and @samp{#:upper16}
|
371 |
|
|
respectively. For example to load the 32-bit address of foo into r0:
|
372 |
|
|
|
373 |
|
|
@smallexample
|
374 |
|
|
MOVW r0, #:lower16:foo
|
375 |
|
|
MOVT r0, #:upper16:foo
|
376 |
|
|
@end smallexample
|
377 |
|
|
|
378 |
|
|
@node ARM Directives
|
379 |
|
|
@section ARM Machine Directives
|
380 |
|
|
|
381 |
|
|
@cindex machine directives, ARM
|
382 |
|
|
@cindex ARM machine directives
|
383 |
|
|
@table @code
|
384 |
|
|
|
385 |
|
|
@cindex @code{align} directive, ARM
|
386 |
|
|
@item .align @var{expression} [, @var{expression}]
|
387 |
|
|
This is the generic @var{.align} directive. For the ARM however if the
|
388 |
|
|
first argument is zero (ie no alignment is needed) the assembler will
|
389 |
|
|
behave as if the argument had been 2 (ie pad to the next four byte
|
390 |
|
|
boundary). This is for compatibility with ARM's own assembler.
|
391 |
|
|
|
392 |
|
|
@cindex @code{req} directive, ARM
|
393 |
|
|
@item @var{name} .req @var{register name}
|
394 |
|
|
This creates an alias for @var{register name} called @var{name}. For
|
395 |
|
|
example:
|
396 |
|
|
|
397 |
|
|
@smallexample
|
398 |
|
|
foo .req r0
|
399 |
|
|
@end smallexample
|
400 |
|
|
|
401 |
|
|
@cindex @code{unreq} directive, ARM
|
402 |
|
|
@item .unreq @var{alias-name}
|
403 |
|
|
This undefines a register alias which was previously defined using the
|
404 |
|
|
@code{req}, @code{dn} or @code{qn} directives. For example:
|
405 |
|
|
|
406 |
|
|
@smallexample
|
407 |
|
|
foo .req r0
|
408 |
|
|
.unreq foo
|
409 |
|
|
@end smallexample
|
410 |
|
|
|
411 |
|
|
An error occurs if the name is undefined. Note - this pseudo op can
|
412 |
|
|
be used to delete builtin in register name aliases (eg 'r0'). This
|
413 |
|
|
should only be done if it is really necessary.
|
414 |
|
|
|
415 |
|
|
@cindex @code{dn} and @code{qn} directives, ARM
|
416 |
|
|
@item @var{name} .dn @var{register name} [@var{.type}] [[@var{index}]]
|
417 |
|
|
@item @var{name} .qn @var{register name} [@var{.type}] [[@var{index}]]
|
418 |
|
|
|
419 |
|
|
The @code{dn} and @code{qn} directives are used to create typed
|
420 |
|
|
and/or indexed register aliases for use in Advanced SIMD Extension
|
421 |
|
|
(Neon) instructions. The former should be used to create aliases
|
422 |
|
|
of double-precision registers, and the latter to create aliases of
|
423 |
|
|
quad-precision registers.
|
424 |
|
|
|
425 |
|
|
If these directives are used to create typed aliases, those aliases can
|
426 |
|
|
be used in Neon instructions instead of writing types after the mnemonic
|
427 |
|
|
or after each operand. For example:
|
428 |
|
|
|
429 |
|
|
@smallexample
|
430 |
|
|
x .dn d2.f32
|
431 |
|
|
y .dn d3.f32
|
432 |
|
|
z .dn d4.f32[1]
|
433 |
|
|
vmul x,y,z
|
434 |
|
|
@end smallexample
|
435 |
|
|
|
436 |
|
|
This is equivalent to writing the following:
|
437 |
|
|
|
438 |
|
|
@smallexample
|
439 |
|
|
vmul.f32 d2,d3,d4[1]
|
440 |
|
|
@end smallexample
|
441 |
|
|
|
442 |
|
|
Aliases created using @code{dn} or @code{qn} can be destroyed using
|
443 |
|
|
@code{unreq}.
|
444 |
|
|
|
445 |
|
|
@cindex @code{code} directive, ARM
|
446 |
|
|
@item .code @code{[16|32]}
|
447 |
|
|
This directive selects the instruction set being generated. The value 16
|
448 |
|
|
selects Thumb, with the value 32 selecting ARM.
|
449 |
|
|
|
450 |
|
|
@cindex @code{thumb} directive, ARM
|
451 |
|
|
@item .thumb
|
452 |
|
|
This performs the same action as @var{.code 16}.
|
453 |
|
|
|
454 |
|
|
@cindex @code{arm} directive, ARM
|
455 |
|
|
@item .arm
|
456 |
|
|
This performs the same action as @var{.code 32}.
|
457 |
|
|
|
458 |
|
|
@cindex @code{force_thumb} directive, ARM
|
459 |
|
|
@item .force_thumb
|
460 |
|
|
This directive forces the selection of Thumb instructions, even if the
|
461 |
|
|
target processor does not support those instructions
|
462 |
|
|
|
463 |
|
|
@cindex @code{thumb_func} directive, ARM
|
464 |
|
|
@item .thumb_func
|
465 |
|
|
This directive specifies that the following symbol is the name of a
|
466 |
|
|
Thumb encoded function. This information is necessary in order to allow
|
467 |
|
|
the assembler and linker to generate correct code for interworking
|
468 |
|
|
between Arm and Thumb instructions and should be used even if
|
469 |
|
|
interworking is not going to be performed. The presence of this
|
470 |
|
|
directive also implies @code{.thumb}
|
471 |
|
|
|
472 |
|
|
This directive is not neccessary when generating EABI objects. On these
|
473 |
|
|
targets the encoding is implicit when generating Thumb code.
|
474 |
|
|
|
475 |
|
|
@cindex @code{thumb_set} directive, ARM
|
476 |
|
|
@item .thumb_set
|
477 |
|
|
This performs the equivalent of a @code{.set} directive in that it
|
478 |
|
|
creates a symbol which is an alias for another symbol (possibly not yet
|
479 |
|
|
defined). This directive also has the added property in that it marks
|
480 |
|
|
the aliased symbol as being a thumb function entry point, in the same
|
481 |
|
|
way that the @code{.thumb_func} directive does.
|
482 |
|
|
|
483 |
|
|
@cindex @code{.ltorg} directive, ARM
|
484 |
|
|
@item .ltorg
|
485 |
|
|
This directive causes the current contents of the literal pool to be
|
486 |
|
|
dumped into the current section (which is assumed to be the .text
|
487 |
|
|
section) at the current location (aligned to a word boundary).
|
488 |
|
|
@code{GAS} maintains a separate literal pool for each section and each
|
489 |
|
|
sub-section. The @code{.ltorg} directive will only affect the literal
|
490 |
|
|
pool of the current section and sub-section. At the end of assembly
|
491 |
|
|
all remaining, un-empty literal pools will automatically be dumped.
|
492 |
|
|
|
493 |
|
|
Note - older versions of @code{GAS} would dump the current literal
|
494 |
|
|
pool any time a section change occurred. This is no longer done, since
|
495 |
|
|
it prevents accurate control of the placement of literal pools.
|
496 |
|
|
|
497 |
|
|
@cindex @code{.pool} directive, ARM
|
498 |
|
|
@item .pool
|
499 |
|
|
This is a synonym for .ltorg.
|
500 |
|
|
|
501 |
|
|
@cindex @code{.fnstart} directive, ARM
|
502 |
|
|
@item .fnstart
|
503 |
|
|
Marks the start of a function with an unwind table entry.
|
504 |
|
|
|
505 |
|
|
@cindex @code{.fnend} directive, ARM
|
506 |
|
|
@item .fnend
|
507 |
|
|
Marks the end of a function with an unwind table entry. The unwind index
|
508 |
|
|
table entry is created when this directive is processed.
|
509 |
|
|
|
510 |
|
|
If no personality routine has been specified then standard personality
|
511 |
|
|
routine 0 or 1 will be used, depending on the number of unwind opcodes
|
512 |
|
|
required.
|
513 |
|
|
|
514 |
|
|
@cindex @code{.cantunwind} directive, ARM
|
515 |
|
|
@item .cantunwind
|
516 |
|
|
Prevents unwinding through the current function. No personality routine
|
517 |
|
|
or exception table data is required or permitted.
|
518 |
|
|
|
519 |
|
|
@cindex @code{.personality} directive, ARM
|
520 |
|
|
@item .personality @var{name}
|
521 |
|
|
Sets the personality routine for the current function to @var{name}.
|
522 |
|
|
|
523 |
|
|
@cindex @code{.personalityindex} directive, ARM
|
524 |
|
|
@item .personalityindex @var{index}
|
525 |
|
|
Sets the personality routine for the current function to the EABI standard
|
526 |
|
|
routine number @var{index}
|
527 |
|
|
|
528 |
|
|
@cindex @code{.handlerdata} directive, ARM
|
529 |
|
|
@item .handlerdata
|
530 |
|
|
Marks the end of the current function, and the start of the exception table
|
531 |
|
|
entry for that function. Anything between this directive and the
|
532 |
|
|
@code{.fnend} directive will be added to the exception table entry.
|
533 |
|
|
|
534 |
|
|
Must be preceded by a @code{.personality} or @code{.personalityindex}
|
535 |
|
|
directive.
|
536 |
|
|
|
537 |
|
|
@cindex @code{.save} directive, ARM
|
538 |
|
|
@item .save @var{reglist}
|
539 |
|
|
Generate unwinder annotations to restore the registers in @var{reglist}.
|
540 |
|
|
The format of @var{reglist} is the same as the corresponding store-multiple
|
541 |
|
|
instruction.
|
542 |
|
|
|
543 |
|
|
@smallexample
|
544 |
|
|
@exdent @emph{core registers}
|
545 |
|
|
.save @{r4, r5, r6, lr@}
|
546 |
|
|
stmfd sp!, @{r4, r5, r6, lr@}
|
547 |
|
|
@exdent @emph{FPA registers}
|
548 |
|
|
.save f4, 2
|
549 |
|
|
sfmfd f4, 2, [sp]!
|
550 |
|
|
@exdent @emph{VFP registers}
|
551 |
|
|
.save @{d8, d9, d10@}
|
552 |
|
|
fstmdx sp!, @{d8, d9, d10@}
|
553 |
|
|
@exdent @emph{iWMMXt registers}
|
554 |
|
|
.save @{wr10, wr11@}
|
555 |
|
|
wstrd wr11, [sp, #-8]!
|
556 |
|
|
wstrd wr10, [sp, #-8]!
|
557 |
|
|
or
|
558 |
|
|
.save wr11
|
559 |
|
|
wstrd wr11, [sp, #-8]!
|
560 |
|
|
.save wr10
|
561 |
|
|
wstrd wr10, [sp, #-8]!
|
562 |
|
|
@end smallexample
|
563 |
|
|
|
564 |
|
|
@cindex @code{.vsave} directive, ARM
|
565 |
|
|
@item .vsave @var{vfp-reglist}
|
566 |
|
|
Generate unwinder annotations to restore the VFP registers in @var{vfp-reglist}
|
567 |
|
|
using FLDMD. Also works for VFPv3 registers
|
568 |
|
|
that are to be restored using VLDM.
|
569 |
|
|
The format of @var{vfp-reglist} is the same as the corresponding store-multiple
|
570 |
|
|
instruction.
|
571 |
|
|
|
572 |
|
|
@smallexample
|
573 |
|
|
@exdent @emph{VFP registers}
|
574 |
|
|
.vsave @{d8, d9, d10@}
|
575 |
|
|
fstmdd sp!, @{d8, d9, d10@}
|
576 |
|
|
@exdent @emph{VFPv3 registers}
|
577 |
|
|
.vsave @{d15, d16, d17@}
|
578 |
|
|
vstm sp!, @{d15, d16, d17@}
|
579 |
|
|
@end smallexample
|
580 |
|
|
|
581 |
|
|
Since FLDMX and FSTMX are now deprecated, this directive should be
|
582 |
|
|
used in favour of @code{.save} for saving VFP registers for ARMv6 and above.
|
583 |
|
|
|
584 |
|
|
@cindex @code{.pad} directive, ARM
|
585 |
|
|
@item .pad #@var{count}
|
586 |
|
|
Generate unwinder annotations for a stack adjustment of @var{count} bytes.
|
587 |
|
|
A positive value indicates the function prologue allocated stack space by
|
588 |
|
|
decrementing the stack pointer.
|
589 |
|
|
|
590 |
|
|
@cindex @code{.movsp} directive, ARM
|
591 |
|
|
@item .movsp @var{reg} [, #@var{offset}]
|
592 |
|
|
Tell the unwinder that @var{reg} contains an offset from the current
|
593 |
|
|
stack pointer. If @var{offset} is not specified then it is assumed to be
|
594 |
|
|
zero.
|
595 |
|
|
|
596 |
|
|
@cindex @code{.setfp} directive, ARM
|
597 |
|
|
@item .setfp @var{fpreg}, @var{spreg} [, #@var{offset}]
|
598 |
|
|
Make all unwinder annotations relaive to a frame pointer. Without this
|
599 |
|
|
the unwinder will use offsets from the stack pointer.
|
600 |
|
|
|
601 |
|
|
The syntax of this directive is the same as the @code{sub} or @code{mov}
|
602 |
|
|
instruction used to set the frame pointer. @var{spreg} must be either
|
603 |
|
|
@code{sp} or mentioned in a previous @code{.movsp} directive.
|
604 |
|
|
|
605 |
|
|
@smallexample
|
606 |
|
|
.movsp ip
|
607 |
|
|
mov ip, sp
|
608 |
|
|
@dots{}
|
609 |
|
|
.setfp fp, ip, #4
|
610 |
|
|
sub fp, ip, #4
|
611 |
|
|
@end smallexample
|
612 |
|
|
|
613 |
|
|
@cindex @code{.unwind_raw} directive, ARM
|
614 |
|
|
@item .raw @var{offset}, @var{byte1}, @dots{}
|
615 |
|
|
Insert one of more arbitary unwind opcode bytes, which are known to adjust
|
616 |
|
|
the stack pointer by @var{offset} bytes.
|
617 |
|
|
|
618 |
|
|
For example @code{.unwind_raw 4, 0xb1, 0x01} is equivalent to
|
619 |
|
|
@code{.save @{r0@}}
|
620 |
|
|
|
621 |
|
|
@cindex @code{.cpu} directive, ARM
|
622 |
|
|
@item .cpu @var{name}
|
623 |
|
|
Select the target processor. Valid values for @var{name} are the same as
|
624 |
|
|
for the @option{-mcpu} commandline option.
|
625 |
|
|
|
626 |
|
|
@cindex @code{.arch} directive, ARM
|
627 |
|
|
@item .arch @var{name}
|
628 |
|
|
Select the target architecture. Valid values for @var{name} are the same as
|
629 |
|
|
for the @option{-march} commandline option.
|
630 |
|
|
|
631 |
|
|
@cindex @code{.object_arch} directive, ARM
|
632 |
|
|
@item .object_arch @var{name}
|
633 |
|
|
Override the architecture recorded in the EABI object attribute section.
|
634 |
|
|
Valid values for @var{name} are the same as for the @code{.arch} directive.
|
635 |
|
|
Typically this is useful when code uses runtime detection of CPU features.
|
636 |
|
|
|
637 |
|
|
@cindex @code{.fpu} directive, ARM
|
638 |
|
|
@item .fpu @var{name}
|
639 |
|
|
Select the floating point unit to assemble for. Valid values for @var{name}
|
640 |
|
|
are the same as for the @option{-mfpu} commandline option.
|
641 |
|
|
|
642 |
|
|
@cindex @code{.eabi_attribute} directive, ARM
|
643 |
|
|
@item .eabi_attribute @var{tag}, @var{value}
|
644 |
|
|
Set the EABI object attribute number @var{tag} to @var{value}. The value
|
645 |
|
|
is either a @code{number}, @code{"string"}, or @code{number, "string"}
|
646 |
|
|
depending on the tag.
|
647 |
|
|
|
648 |
|
|
@end table
|
649 |
|
|
|
650 |
|
|
@node ARM Opcodes
|
651 |
|
|
@section Opcodes
|
652 |
|
|
|
653 |
|
|
@cindex ARM opcodes
|
654 |
|
|
@cindex opcodes for ARM
|
655 |
|
|
@code{@value{AS}} implements all the standard ARM opcodes. It also
|
656 |
|
|
implements several pseudo opcodes, including several synthetic load
|
657 |
|
|
instructions.
|
658 |
|
|
|
659 |
|
|
@table @code
|
660 |
|
|
|
661 |
|
|
@cindex @code{NOP} pseudo op, ARM
|
662 |
|
|
@item NOP
|
663 |
|
|
@smallexample
|
664 |
|
|
nop
|
665 |
|
|
@end smallexample
|
666 |
|
|
|
667 |
|
|
This pseudo op will always evaluate to a legal ARM instruction that does
|
668 |
|
|
nothing. Currently it will evaluate to MOV r0, r0.
|
669 |
|
|
|
670 |
|
|
@cindex @code{LDR reg,=<label>} pseudo op, ARM
|
671 |
|
|
@item LDR
|
672 |
|
|
@smallexample
|
673 |
|
|
ldr <register> , = <expression>
|
674 |
|
|
@end smallexample
|
675 |
|
|
|
676 |
|
|
If expression evaluates to a numeric constant then a MOV or MVN
|
677 |
|
|
instruction will be used in place of the LDR instruction, if the
|
678 |
|
|
constant can be generated by either of these instructions. Otherwise
|
679 |
|
|
the constant will be placed into the nearest literal pool (if it not
|
680 |
|
|
already there) and a PC relative LDR instruction will be generated.
|
681 |
|
|
|
682 |
|
|
@cindex @code{ADR reg,<label>} pseudo op, ARM
|
683 |
|
|
@item ADR
|
684 |
|
|
@smallexample
|
685 |
|
|
adr <register> <label>
|
686 |
|
|
@end smallexample
|
687 |
|
|
|
688 |
|
|
This instruction will load the address of @var{label} into the indicated
|
689 |
|
|
register. The instruction will evaluate to a PC relative ADD or SUB
|
690 |
|
|
instruction depending upon where the label is located. If the label is
|
691 |
|
|
out of range, or if it is not defined in the same file (and section) as
|
692 |
|
|
the ADR instruction, then an error will be generated. This instruction
|
693 |
|
|
will not make use of the literal pool.
|
694 |
|
|
|
695 |
|
|
@cindex @code{ADRL reg,<label>} pseudo op, ARM
|
696 |
|
|
@item ADRL
|
697 |
|
|
@smallexample
|
698 |
|
|
adrl <register> <label>
|
699 |
|
|
@end smallexample
|
700 |
|
|
|
701 |
|
|
This instruction will load the address of @var{label} into the indicated
|
702 |
|
|
register. The instruction will evaluate to one or two PC relative ADD
|
703 |
|
|
or SUB instructions depending upon where the label is located. If a
|
704 |
|
|
second instruction is not needed a NOP instruction will be generated in
|
705 |
|
|
its place, so that this instruction is always 8 bytes long.
|
706 |
|
|
|
707 |
|
|
If the label is out of range, or if it is not defined in the same file
|
708 |
|
|
(and section) as the ADRL instruction, then an error will be generated.
|
709 |
|
|
This instruction will not make use of the literal pool.
|
710 |
|
|
|
711 |
|
|
@end table
|
712 |
|
|
|
713 |
|
|
For information on the ARM or Thumb instruction sets, see @cite{ARM
|
714 |
|
|
Software Development Toolkit Reference Manual}, Advanced RISC Machines
|
715 |
|
|
Ltd.
|
716 |
|
|
|
717 |
|
|
@node ARM Mapping Symbols
|
718 |
|
|
@section Mapping Symbols
|
719 |
|
|
|
720 |
|
|
The ARM ELF specification requires that special symbols be inserted
|
721 |
|
|
into object files to mark certain features:
|
722 |
|
|
|
723 |
|
|
@table @code
|
724 |
|
|
|
725 |
|
|
@cindex @code{$a}
|
726 |
|
|
@item $a
|
727 |
|
|
At the start of a region of code containing ARM instructions.
|
728 |
|
|
|
729 |
|
|
@cindex @code{$t}
|
730 |
|
|
@item $t
|
731 |
|
|
At the start of a region of code containing THUMB instructions.
|
732 |
|
|
|
733 |
|
|
@cindex @code{$d}
|
734 |
|
|
@item $d
|
735 |
|
|
At the start of a region of data.
|
736 |
|
|
|
737 |
|
|
@end table
|
738 |
|
|
|
739 |
|
|
The assembler will automatically insert these symbols for you - there
|
740 |
|
|
is no need to code them yourself. Support for tagging symbols ($b,
|
741 |
|
|
$f, $p and $m) which is also mentioned in the current ARM ELF
|
742 |
|
|
specification is not implemented. This is because they have been
|
743 |
|
|
dropped from the new EABI and so tools cannot rely upon their
|
744 |
|
|
presence.
|
745 |
|
|
|