]>
Commit | Line | Data |
---|---|---|
0bbf2aa4 | 1 | @c Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2003 |
f7e42eb4 | 2 | @c Free Software Foundation, Inc. |
252b5132 RH |
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 | |
6057a28f | 25 | * ARM Mapping Symbols:: Mapping Symbols |
252b5132 RH |
26 | @end menu |
27 | ||
28 | @node ARM Options | |
29 | @section Options | |
30 | @cindex ARM options (none) | |
31 | @cindex options for ARM (none) | |
adcf07e6 | 32 | |
252b5132 | 33 | @table @code |
adcf07e6 | 34 | |
03b1477f | 35 | @cindex @code{-mcpu=} command line option, ARM |
92081f48 | 36 | @item -mcpu=@var{processor}[+@var{extension}@dots{}] |
252b5132 RH |
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 | |
03b1477f RE |
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{arm8}, | |
71 | @code{arm810}, | |
72 | @code{strongarm}, | |
73 | @code{strongarm1}, | |
74 | @code{strongarm110}, | |
75 | @code{strongarm1100}, | |
76 | @code{strongarm1110}, | |
77 | @code{arm9}, | |
78 | @code{arm920}, | |
79 | @code{arm920t}, | |
80 | @code{arm922t}, | |
81 | @code{arm940t}, | |
82 | @code{arm9tdmi}, | |
83 | @code{arm9e}, | |
7de9afa2 PB |
84 | @code{arm926e}, |
85 | @code{arm926ejs}, | |
03b1477f RE |
86 | @code{arm946e-r0}, |
87 | @code{arm946e}, | |
88 | @code{arm966e-r0}, | |
89 | @code{arm966e}, | |
90 | @code{arm10t}, | |
91 | @code{arm10e}, | |
92 | @code{arm1020}, | |
93 | @code{arm1020t}, | |
7de9afa2 PB |
94 | @code{arm1020e}, |
95 | @code{arm1026ejs}, | |
09d92015 MM |
96 | @code{arm1136js}, |
97 | @code{arm1136jfs}, | |
03b1477f RE |
98 | @code{ep9312} (ARM920 with Cirrus Maverick coprocessor), |
99 | @code{i80200} (Intel XScale processor) | |
e16bb312 | 100 | @code{iwmmxt} (Intel(r) XScale processor with Wireless MMX(tm) technology coprocessor) |
03b1477f RE |
101 | and |
102 | @code{xscale}. | |
103 | The special name @code{all} may be used to allow the | |
104 | assembler to accept instructions valid for any ARM processor. | |
105 | ||
106 | In addition to the basic instruction set, the assembler can be told to | |
107 | accept various extension mnemonics that extend the processor using the | |
108 | co-processor instruction space. For example, @code{-mcpu=arm920+maverick} | |
109 | is equivalent to specifying @code{-mcpu=ep9312}. The following extensions | |
110 | are currently supported: | |
111 | @code{+maverick} | |
e16bb312 | 112 | @code{+iwmmxt} |
03b1477f RE |
113 | and |
114 | @code{+xscale}. | |
115 | ||
116 | @cindex @code{-march=} command line option, ARM | |
92081f48 | 117 | @item -march=@var{architecture}[+@var{extension}@dots{}] |
252b5132 RH |
118 | This option specifies the target architecture. The assembler will issue |
119 | an error message if an attempt is made to assemble an instruction which | |
03b1477f RE |
120 | will not execute on the target architecture. The following architecture |
121 | names are recognized: | |
122 | @code{armv1}, | |
123 | @code{armv2}, | |
124 | @code{armv2a}, | |
125 | @code{armv2s}, | |
126 | @code{armv3}, | |
127 | @code{armv3m}, | |
128 | @code{armv4}, | |
129 | @code{armv4xm}, | |
130 | @code{armv4t}, | |
131 | @code{armv4txm}, | |
132 | @code{armv5}, | |
133 | @code{armv5t}, | |
134 | @code{armv5txm}, | |
135 | @code{armv5te}, | |
09d92015 | 136 | @code{armv5texp}, |
c5f98204 | 137 | @code{armv6}, |
1ddd7f43 | 138 | @code{armv6j}, |
e16bb312 | 139 | @code{iwmmxt} |
03b1477f RE |
140 | and |
141 | @code{xscale}. | |
142 | If both @code{-mcpu} and | |
143 | @code{-march} are specified, the assembler will use | |
144 | the setting for @code{-mcpu}. | |
145 | ||
146 | The architecture option can be extended with the same instruction set | |
147 | extension options as the @code{-mcpu} option. | |
148 | ||
149 | @cindex @code{-mfpu=} command line option, ARM | |
150 | @item -mfpu=@var{floating-point-format} | |
151 | ||
152 | This option specifies the floating point format to assemble for. The | |
153 | assembler will issue an error message if an attempt is made to assemble | |
154 | an instruction which will not execute on the target floating point unit. | |
155 | The following format options are recognized: | |
156 | @code{softfpa}, | |
157 | @code{fpe}, | |
bc89618b RE |
158 | @code{fpe2}, |
159 | @code{fpe3}, | |
03b1477f RE |
160 | @code{fpa}, |
161 | @code{fpa10}, | |
162 | @code{fpa11}, | |
163 | @code{arm7500fe}, | |
164 | @code{softvfp}, | |
165 | @code{softvfp+vfp}, | |
166 | @code{vfp}, | |
167 | @code{vfp10}, | |
168 | @code{vfp10-r0}, | |
169 | @code{vfp9}, | |
170 | @code{vfpxd}, | |
09d92015 MM |
171 | @code{arm1020t}, |
172 | @code{arm1020e}, | |
33a392fb | 173 | @code{arm1136jfs} |
03b1477f | 174 | and |
33a392fb | 175 | @code{maverick}. |
03b1477f RE |
176 | |
177 | In addition to determining which instructions are assembled, this option | |
178 | also affects the way in which the @code{.double} assembler directive behaves | |
179 | when assembling little-endian code. | |
180 | ||
181 | The default is dependent on the processor selected. For Architecture 5 or | |
182 | later, the default is to assembler for VFP instructions; for earlier | |
183 | architectures the default is to assemble for FPA instructions. | |
adcf07e6 | 184 | |
252b5132 RH |
185 | @cindex @code{-mthumb} command line option, ARM |
186 | @item -mthumb | |
03b1477f RE |
187 | This option specifies that the assembler should start assembling Thumb |
188 | instructions; that is, it should behave as though the file starts with a | |
189 | @code{.code 16} directive. | |
adcf07e6 | 190 | |
252b5132 RH |
191 | @cindex @code{-mthumb-interwork} command line option, ARM |
192 | @item -mthumb-interwork | |
193 | This option specifies that the output generated by the assembler should | |
194 | be marked as supporting interworking. | |
adcf07e6 | 195 | |
252b5132 | 196 | @cindex @code{-mapcs} command line option, ARM |
0ac658b8 | 197 | @item -mapcs @code{[26|32]} |
252b5132 RH |
198 | This option specifies that the output generated by the assembler should |
199 | be marked as supporting the indicated version of the Arm Procedure. | |
200 | Calling Standard. | |
adcf07e6 | 201 | |
077b8428 NC |
202 | @cindex @code{-matpcs} command line option, ARM |
203 | @item -matpcs | |
204 | This option specifies that the output generated by the assembler should | |
205 | be marked as supporting the Arm/Thumb Procedure Calling Standard. If | |
206 | enabled this option will cause the assembler to create an empty | |
207 | debugging section in the object file called .arm.atpcs. Debuggers can | |
208 | use this to determine the ABI being used by. | |
209 | ||
adcf07e6 | 210 | @cindex @code{-mapcs-float} command line option, ARM |
252b5132 | 211 | @item -mapcs-float |
1be59579 | 212 | This indicates the floating point variant of the APCS should be |
252b5132 | 213 | used. In this variant floating point arguments are passed in FP |
550262c4 | 214 | registers rather than integer registers. |
adcf07e6 NC |
215 | |
216 | @cindex @code{-mapcs-reentrant} command line option, ARM | |
252b5132 RH |
217 | @item -mapcs-reentrant |
218 | This indicates that the reentrant variant of the APCS should be used. | |
219 | This variant supports position independent code. | |
adcf07e6 | 220 | |
33a392fb PB |
221 | @cindex @code{-mfloat-abi=} command line option, ARM |
222 | @item -mfloat-abi=@var{abi} | |
223 | This option specifies that the output generated by the assembler should be | |
224 | marked as using specified floating point ABI. | |
225 | The following values are recognized: | |
226 | @code{soft}, | |
227 | @code{softfp} | |
228 | and | |
229 | @code{hard}. | |
230 | ||
252b5132 RH |
231 | @cindex @code{-EB} command line option, ARM |
232 | @item -EB | |
233 | This option specifies that the output generated by the assembler should | |
234 | be marked as being encoded for a big-endian processor. | |
adcf07e6 | 235 | |
252b5132 RH |
236 | @cindex @code{-EL} command line option, ARM |
237 | @item -EL | |
238 | This option specifies that the output generated by the assembler should | |
239 | be marked as being encoded for a little-endian processor. | |
adcf07e6 | 240 | |
252b5132 RH |
241 | @cindex @code{-k} command line option, ARM |
242 | @cindex PIC code generation for ARM | |
243 | @item -k | |
a349d9dd PB |
244 | This option specifies that the output of the assembler should be marked |
245 | as position-independent code (PIC). | |
adcf07e6 NC |
246 | |
247 | @cindex @code{-moabi} command line option, ARM | |
252b5132 RH |
248 | @item -moabi |
249 | This indicates that the code should be assembled using the old ARM ELF | |
250 | conventions, based on a beta release release of the ARM-ELF | |
251 | specifications, rather than the default conventions which are based on | |
252 | the final release of the ARM-ELF specifications. | |
adcf07e6 | 253 | |
252b5132 RH |
254 | @end table |
255 | ||
256 | ||
257 | @node ARM Syntax | |
258 | @section Syntax | |
259 | @menu | |
260 | * ARM-Chars:: Special Characters | |
261 | * ARM-Regs:: Register Names | |
262 | @end menu | |
263 | ||
264 | @node ARM-Chars | |
265 | @subsection Special Characters | |
266 | ||
267 | @cindex line comment character, ARM | |
268 | @cindex ARM line comment character | |
550262c4 NC |
269 | The presence of a @samp{@@} on a line indicates the start of a comment |
270 | that extends to the end of the current line. If a @samp{#} appears as | |
271 | the first character of a line, the whole line is treated as a comment. | |
272 | ||
273 | @cindex line separator, ARM | |
274 | @cindex statement separator, ARM | |
275 | @cindex ARM line separator | |
a349d9dd PB |
276 | The @samp{;} character can be used instead of a newline to separate |
277 | statements. | |
550262c4 NC |
278 | |
279 | @cindex immediate character, ARM | |
280 | @cindex ARM immediate character | |
281 | Either @samp{#} or @samp{$} can be used to indicate immediate operands. | |
252b5132 RH |
282 | |
283 | @cindex identifiers, ARM | |
284 | @cindex ARM identifiers | |
285 | *TODO* Explain about /data modifier on symbols. | |
286 | ||
287 | @node ARM-Regs | |
288 | @subsection Register Names | |
289 | ||
290 | @cindex ARM register names | |
291 | @cindex register names, ARM | |
292 | *TODO* Explain about ARM register naming, and the predefined names. | |
293 | ||
294 | @node ARM Floating Point | |
295 | @section Floating Point | |
296 | ||
297 | @cindex floating point, ARM (@sc{ieee}) | |
298 | @cindex ARM floating point (@sc{ieee}) | |
299 | The ARM family uses @sc{ieee} floating-point numbers. | |
300 | ||
301 | ||
302 | ||
303 | @node ARM Directives | |
304 | @section ARM Machine Directives | |
305 | ||
306 | @cindex machine directives, ARM | |
307 | @cindex ARM machine directives | |
308 | @table @code | |
309 | ||
adcf07e6 NC |
310 | @cindex @code{align} directive, ARM |
311 | @item .align @var{expression} [, @var{expression}] | |
312 | This is the generic @var{.align} directive. For the ARM however if the | |
313 | first argument is zero (ie no alignment is needed) the assembler will | |
314 | behave as if the argument had been 2 (ie pad to the next four byte | |
062b7c0c | 315 | boundary). This is for compatibility with ARM's own assembler. |
adcf07e6 | 316 | |
252b5132 RH |
317 | @cindex @code{req} directive, ARM |
318 | @item @var{name} .req @var{register name} | |
319 | This creates an alias for @var{register name} called @var{name}. For | |
320 | example: | |
321 | ||
322 | @smallexample | |
323 | foo .req r0 | |
324 | @end smallexample | |
325 | ||
0bbf2aa4 NC |
326 | @cindex @code{unreq} directive, ARM |
327 | @item .unreq @var{alias-name} | |
328 | This undefines a register alias which was previously defined using the | |
329 | @code{req} directive. For example: | |
330 | ||
331 | @smallexample | |
332 | foo .req r0 | |
333 | .unreq foo | |
334 | @end smallexample | |
335 | ||
336 | An error occurs if the name is undefined. Note - this pseudo op can | |
337 | be used to delete builtin in register name aliases (eg 'r0'). This | |
338 | should only be done if it is really necessary. | |
339 | ||
252b5132 | 340 | @cindex @code{code} directive, ARM |
0ac658b8 | 341 | @item .code @code{[16|32]} |
252b5132 RH |
342 | This directive selects the instruction set being generated. The value 16 |
343 | selects Thumb, with the value 32 selecting ARM. | |
344 | ||
345 | @cindex @code{thumb} directive, ARM | |
346 | @item .thumb | |
347 | This performs the same action as @var{.code 16}. | |
348 | ||
349 | @cindex @code{arm} directive, ARM | |
350 | @item .arm | |
351 | This performs the same action as @var{.code 32}. | |
352 | ||
353 | @cindex @code{force_thumb} directive, ARM | |
354 | @item .force_thumb | |
355 | This directive forces the selection of Thumb instructions, even if the | |
356 | target processor does not support those instructions | |
357 | ||
358 | @cindex @code{thumb_func} directive, ARM | |
359 | @item .thumb_func | |
360 | This directive specifies that the following symbol is the name of a | |
361 | Thumb encoded function. This information is necessary in order to allow | |
362 | the assembler and linker to generate correct code for interworking | |
363 | between Arm and Thumb instructions and should be used even if | |
1994a7c7 NC |
364 | interworking is not going to be performed. The presence of this |
365 | directive also implies @code{.thumb} | |
252b5132 | 366 | |
5395a469 NC |
367 | @cindex @code{thumb_set} directive, ARM |
368 | @item .thumb_set | |
369 | This performs the equivalent of a @code{.set} directive in that it | |
370 | creates a symbol which is an alias for another symbol (possibly not yet | |
371 | defined). This directive also has the added property in that it marks | |
372 | the aliased symbol as being a thumb function entry point, in the same | |
373 | way that the @code{.thumb_func} directive does. | |
374 | ||
252b5132 RH |
375 | @cindex @code{.ltorg} directive, ARM |
376 | @item .ltorg | |
377 | This directive causes the current contents of the literal pool to be | |
378 | dumped into the current section (which is assumed to be the .text | |
379 | section) at the current location (aligned to a word boundary). | |
3d0c9500 NC |
380 | @code{GAS} maintains a separate literal pool for each section and each |
381 | sub-section. The @code{.ltorg} directive will only affect the literal | |
382 | pool of the current section and sub-section. At the end of assembly | |
383 | all remaining, un-empty literal pools will automatically be dumped. | |
384 | ||
385 | Note - older versions of @code{GAS} would dump the current literal | |
386 | pool any time a section change occurred. This is no longer done, since | |
387 | it prevents accurate control of the placement of literal pools. | |
252b5132 RH |
388 | |
389 | @cindex @code{.pool} directive, ARM | |
390 | @item .pool | |
391 | This is a synonym for .ltorg. | |
392 | ||
393 | @end table | |
394 | ||
395 | @node ARM Opcodes | |
396 | @section Opcodes | |
397 | ||
398 | @cindex ARM opcodes | |
399 | @cindex opcodes for ARM | |
49a5575c NC |
400 | @code{@value{AS}} implements all the standard ARM opcodes. It also |
401 | implements several pseudo opcodes, including several synthetic load | |
402 | instructions. | |
252b5132 | 403 | |
49a5575c NC |
404 | @table @code |
405 | ||
406 | @cindex @code{NOP} pseudo op, ARM | |
407 | @item NOP | |
408 | @smallexample | |
409 | nop | |
410 | @end smallexample | |
252b5132 | 411 | |
49a5575c NC |
412 | This pseudo op will always evaluate to a legal ARM instruction that does |
413 | nothing. Currently it will evaluate to MOV r0, r0. | |
252b5132 | 414 | |
49a5575c NC |
415 | @cindex @code{LDR reg,=<label>} pseudo op, ARM |
416 | @item LDR | |
252b5132 RH |
417 | @smallexample |
418 | ldr <register> , = <expression> | |
419 | @end smallexample | |
420 | ||
421 | If expression evaluates to a numeric constant then a MOV or MVN | |
422 | instruction will be used in place of the LDR instruction, if the | |
423 | constant can be generated by either of these instructions. Otherwise | |
424 | the constant will be placed into the nearest literal pool (if it not | |
425 | already there) and a PC relative LDR instruction will be generated. | |
426 | ||
49a5575c NC |
427 | @cindex @code{ADR reg,<label>} pseudo op, ARM |
428 | @item ADR | |
429 | @smallexample | |
430 | adr <register> <label> | |
431 | @end smallexample | |
432 | ||
433 | This instruction will load the address of @var{label} into the indicated | |
434 | register. The instruction will evaluate to a PC relative ADD or SUB | |
435 | instruction depending upon where the label is located. If the label is | |
436 | out of range, or if it is not defined in the same file (and section) as | |
437 | the ADR instruction, then an error will be generated. This instruction | |
438 | will not make use of the literal pool. | |
439 | ||
440 | @cindex @code{ADRL reg,<label>} pseudo op, ARM | |
441 | @item ADRL | |
442 | @smallexample | |
443 | adrl <register> <label> | |
444 | @end smallexample | |
445 | ||
446 | This instruction will load the address of @var{label} into the indicated | |
a349d9dd | 447 | register. The instruction will evaluate to one or two PC relative ADD |
49a5575c NC |
448 | or SUB instructions depending upon where the label is located. If a |
449 | second instruction is not needed a NOP instruction will be generated in | |
450 | its place, so that this instruction is always 8 bytes long. | |
451 | ||
452 | If the label is out of range, or if it is not defined in the same file | |
453 | (and section) as the ADRL instruction, then an error will be generated. | |
454 | This instruction will not make use of the literal pool. | |
455 | ||
456 | @end table | |
457 | ||
252b5132 RH |
458 | For information on the ARM or Thumb instruction sets, see @cite{ARM |
459 | Software Development Toolkit Reference Manual}, Advanced RISC Machines | |
460 | Ltd. | |
461 | ||
6057a28f NC |
462 | @node ARM Mapping Symbols |
463 | @section Mapping Symbols | |
464 | ||
465 | The ARM ELF specification requires that special symbols be inserted | |
466 | into object files to mark certain features: | |
467 | ||
468 | @table @code | |
469 | ||
470 | @cindex @code{$a} | |
471 | @item $a | |
472 | At the start of a region of code containing ARM instructions. | |
473 | ||
474 | @cindex @code{$t} | |
475 | @item $t | |
476 | At the start of a region of code containing THUMB instructions. | |
477 | ||
478 | @cindex @code{$d} | |
479 | @item $d | |
480 | At the start of a region of data. | |
481 | ||
482 | @end table | |
483 | ||
484 | The assembler will automatically insert these symbols for you - there | |
485 | is no need to code them yourself. Support for tagging symbols ($b, | |
486 | $f, $p and $m) which is also mentioned in the current ARM ELF | |
487 | specification is not implemented. This is because they have been | |
488 | dropped from the new EABI and so tools cannot rely upon their | |
489 | presence. | |
490 |