Commit | Line | Data |
---|---|---|
2da5c037 | 1 | @c Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 |
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}, | |
1ff4677c | 70 | @code{arm7tdmi-s}, |
03b1477f RE |
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}, | |
7de9afa2 | 85 | @code{arm926e}, |
1ff4677c | 86 | @code{arm926ej-s}, |
03b1477f RE |
87 | @code{arm946e-r0}, |
88 | @code{arm946e}, | |
db8ac8f9 | 89 | @code{arm946e-s}, |
03b1477f RE |
90 | @code{arm966e-r0}, |
91 | @code{arm966e}, | |
db8ac8f9 PB |
92 | @code{arm966e-s}, |
93 | @code{arm968e-s}, | |
03b1477f | 94 | @code{arm10t}, |
db8ac8f9 | 95 | @code{arm10tdmi}, |
03b1477f RE |
96 | @code{arm10e}, |
97 | @code{arm1020}, | |
98 | @code{arm1020t}, | |
7de9afa2 | 99 | @code{arm1020e}, |
db8ac8f9 | 100 | @code{arm1022e}, |
1ff4677c RE |
101 | @code{arm1026ej-s}, |
102 | @code{arm1136j-s}, | |
103 | @code{arm1136jf-s}, | |
db8ac8f9 PB |
104 | @code{arm1156t2-s}, |
105 | @code{arm1156t2f-s}, | |
0dd132b6 NC |
106 | @code{arm1176jz-s}, |
107 | @code{arm1176jzf-s}, | |
108 | @code{mpcore}, | |
109 | @code{mpcorenovfp}, | |
62b3e311 PB |
110 | @code{cortex-a8}, |
111 | @code{cortex-r4}, | |
112 | @code{cortex-m3}, | |
03b1477f RE |
113 | @code{ep9312} (ARM920 with Cirrus Maverick coprocessor), |
114 | @code{i80200} (Intel XScale processor) | |
e16bb312 | 115 | @code{iwmmxt} (Intel(r) XScale processor with Wireless MMX(tm) technology coprocessor) |
03b1477f RE |
116 | and |
117 | @code{xscale}. | |
118 | The special name @code{all} may be used to allow the | |
119 | assembler to accept instructions valid for any ARM processor. | |
120 | ||
121 | In addition to the basic instruction set, the assembler can be told to | |
122 | accept various extension mnemonics that extend the processor using the | |
123 | co-processor instruction space. For example, @code{-mcpu=arm920+maverick} | |
124 | is equivalent to specifying @code{-mcpu=ep9312}. The following extensions | |
125 | are currently supported: | |
126 | @code{+maverick} | |
e16bb312 | 127 | @code{+iwmmxt} |
03b1477f RE |
128 | and |
129 | @code{+xscale}. | |
130 | ||
131 | @cindex @code{-march=} command line option, ARM | |
92081f48 | 132 | @item -march=@var{architecture}[+@var{extension}@dots{}] |
252b5132 RH |
133 | This option specifies the target architecture. The assembler will issue |
134 | an error message if an attempt is made to assemble an instruction which | |
03b1477f RE |
135 | will not execute on the target architecture. The following architecture |
136 | names are recognized: | |
137 | @code{armv1}, | |
138 | @code{armv2}, | |
139 | @code{armv2a}, | |
140 | @code{armv2s}, | |
141 | @code{armv3}, | |
142 | @code{armv3m}, | |
143 | @code{armv4}, | |
144 | @code{armv4xm}, | |
145 | @code{armv4t}, | |
146 | @code{armv4txm}, | |
147 | @code{armv5}, | |
148 | @code{armv5t}, | |
149 | @code{armv5txm}, | |
150 | @code{armv5te}, | |
09d92015 | 151 | @code{armv5texp}, |
c5f98204 | 152 | @code{armv6}, |
1ddd7f43 | 153 | @code{armv6j}, |
0dd132b6 NC |
154 | @code{armv6k}, |
155 | @code{armv6z}, | |
156 | @code{armv6zk}, | |
62b3e311 PB |
157 | @code{armv7}, |
158 | @code{armv7a}, | |
159 | @code{armv7r}, | |
160 | @code{armv7m}, | |
e16bb312 | 161 | @code{iwmmxt} |
03b1477f RE |
162 | and |
163 | @code{xscale}. | |
164 | If both @code{-mcpu} and | |
165 | @code{-march} are specified, the assembler will use | |
166 | the setting for @code{-mcpu}. | |
167 | ||
168 | The architecture option can be extended with the same instruction set | |
169 | extension options as the @code{-mcpu} option. | |
170 | ||
171 | @cindex @code{-mfpu=} command line option, ARM | |
172 | @item -mfpu=@var{floating-point-format} | |
173 | ||
174 | This option specifies the floating point format to assemble for. The | |
175 | assembler will issue an error message if an attempt is made to assemble | |
176 | an instruction which will not execute on the target floating point unit. | |
177 | The following format options are recognized: | |
178 | @code{softfpa}, | |
179 | @code{fpe}, | |
bc89618b RE |
180 | @code{fpe2}, |
181 | @code{fpe3}, | |
03b1477f RE |
182 | @code{fpa}, |
183 | @code{fpa10}, | |
184 | @code{fpa11}, | |
185 | @code{arm7500fe}, | |
186 | @code{softvfp}, | |
187 | @code{softvfp+vfp}, | |
188 | @code{vfp}, | |
189 | @code{vfp10}, | |
190 | @code{vfp10-r0}, | |
191 | @code{vfp9}, | |
192 | @code{vfpxd}, | |
09d92015 MM |
193 | @code{arm1020t}, |
194 | @code{arm1020e}, | |
1ff4677c | 195 | @code{arm1136jf-s} |
03b1477f | 196 | and |
33a392fb | 197 | @code{maverick}. |
03b1477f RE |
198 | |
199 | In addition to determining which instructions are assembled, this option | |
200 | also affects the way in which the @code{.double} assembler directive behaves | |
201 | when assembling little-endian code. | |
202 | ||
203 | The default is dependent on the processor selected. For Architecture 5 or | |
204 | later, the default is to assembler for VFP instructions; for earlier | |
205 | architectures the default is to assemble for FPA instructions. | |
adcf07e6 | 206 | |
252b5132 RH |
207 | @cindex @code{-mthumb} command line option, ARM |
208 | @item -mthumb | |
03b1477f RE |
209 | This option specifies that the assembler should start assembling Thumb |
210 | instructions; that is, it should behave as though the file starts with a | |
211 | @code{.code 16} directive. | |
adcf07e6 | 212 | |
252b5132 RH |
213 | @cindex @code{-mthumb-interwork} command line option, ARM |
214 | @item -mthumb-interwork | |
215 | This option specifies that the output generated by the assembler should | |
216 | be marked as supporting interworking. | |
adcf07e6 | 217 | |
252b5132 | 218 | @cindex @code{-mapcs} command line option, ARM |
0ac658b8 | 219 | @item -mapcs @code{[26|32]} |
252b5132 RH |
220 | This option specifies that the output generated by the assembler should |
221 | be marked as supporting the indicated version of the Arm Procedure. | |
222 | Calling Standard. | |
adcf07e6 | 223 | |
077b8428 NC |
224 | @cindex @code{-matpcs} command line option, ARM |
225 | @item -matpcs | |
226 | This option specifies that the output generated by the assembler should | |
227 | be marked as supporting the Arm/Thumb Procedure Calling Standard. If | |
228 | enabled this option will cause the assembler to create an empty | |
229 | debugging section in the object file called .arm.atpcs. Debuggers can | |
230 | use this to determine the ABI being used by. | |
231 | ||
adcf07e6 | 232 | @cindex @code{-mapcs-float} command line option, ARM |
252b5132 | 233 | @item -mapcs-float |
1be59579 | 234 | This indicates the floating point variant of the APCS should be |
252b5132 | 235 | used. In this variant floating point arguments are passed in FP |
550262c4 | 236 | registers rather than integer registers. |
adcf07e6 NC |
237 | |
238 | @cindex @code{-mapcs-reentrant} command line option, ARM | |
252b5132 RH |
239 | @item -mapcs-reentrant |
240 | This indicates that the reentrant variant of the APCS should be used. | |
241 | This variant supports position independent code. | |
adcf07e6 | 242 | |
33a392fb PB |
243 | @cindex @code{-mfloat-abi=} command line option, ARM |
244 | @item -mfloat-abi=@var{abi} | |
245 | This option specifies that the output generated by the assembler should be | |
246 | marked as using specified floating point ABI. | |
247 | The following values are recognized: | |
248 | @code{soft}, | |
249 | @code{softfp} | |
250 | and | |
251 | @code{hard}. | |
252 | ||
d507cf36 PB |
253 | @cindex @code{-eabi=} command line option, ARM |
254 | @item -meabi=@var{ver} | |
255 | This option specifies which EABI version the produced object files should | |
256 | conform to. | |
257 | The following values are recognised: | |
3a4a14e9 PB |
258 | @code{gnu}, |
259 | @code{4} | |
d507cf36 | 260 | and |
3a4a14e9 | 261 | @code{5}. |
d507cf36 | 262 | |
252b5132 RH |
263 | @cindex @code{-EB} command line option, ARM |
264 | @item -EB | |
265 | This option specifies that the output generated by the assembler should | |
266 | be marked as being encoded for a big-endian processor. | |
adcf07e6 | 267 | |
252b5132 RH |
268 | @cindex @code{-EL} command line option, ARM |
269 | @item -EL | |
270 | This option specifies that the output generated by the assembler should | |
271 | be marked as being encoded for a little-endian processor. | |
adcf07e6 | 272 | |
252b5132 RH |
273 | @cindex @code{-k} command line option, ARM |
274 | @cindex PIC code generation for ARM | |
275 | @item -k | |
a349d9dd PB |
276 | This option specifies that the output of the assembler should be marked |
277 | as position-independent code (PIC). | |
adcf07e6 | 278 | |
252b5132 RH |
279 | @end table |
280 | ||
281 | ||
282 | @node ARM Syntax | |
283 | @section Syntax | |
284 | @menu | |
285 | * ARM-Chars:: Special Characters | |
286 | * ARM-Regs:: Register Names | |
287 | @end menu | |
288 | ||
289 | @node ARM-Chars | |
290 | @subsection Special Characters | |
291 | ||
292 | @cindex line comment character, ARM | |
293 | @cindex ARM line comment character | |
550262c4 NC |
294 | The presence of a @samp{@@} on a line indicates the start of a comment |
295 | that extends to the end of the current line. If a @samp{#} appears as | |
296 | the first character of a line, the whole line is treated as a comment. | |
297 | ||
298 | @cindex line separator, ARM | |
299 | @cindex statement separator, ARM | |
300 | @cindex ARM line separator | |
a349d9dd PB |
301 | The @samp{;} character can be used instead of a newline to separate |
302 | statements. | |
550262c4 NC |
303 | |
304 | @cindex immediate character, ARM | |
305 | @cindex ARM immediate character | |
306 | Either @samp{#} or @samp{$} can be used to indicate immediate operands. | |
252b5132 RH |
307 | |
308 | @cindex identifiers, ARM | |
309 | @cindex ARM identifiers | |
310 | *TODO* Explain about /data modifier on symbols. | |
311 | ||
312 | @node ARM-Regs | |
313 | @subsection Register Names | |
314 | ||
315 | @cindex ARM register names | |
316 | @cindex register names, ARM | |
317 | *TODO* Explain about ARM register naming, and the predefined names. | |
318 | ||
319 | @node ARM Floating Point | |
320 | @section Floating Point | |
321 | ||
322 | @cindex floating point, ARM (@sc{ieee}) | |
323 | @cindex ARM floating point (@sc{ieee}) | |
324 | The ARM family uses @sc{ieee} floating-point numbers. | |
325 | ||
326 | ||
327 | ||
328 | @node ARM Directives | |
329 | @section ARM Machine Directives | |
330 | ||
331 | @cindex machine directives, ARM | |
332 | @cindex ARM machine directives | |
333 | @table @code | |
334 | ||
adcf07e6 NC |
335 | @cindex @code{align} directive, ARM |
336 | @item .align @var{expression} [, @var{expression}] | |
337 | This is the generic @var{.align} directive. For the ARM however if the | |
338 | first argument is zero (ie no alignment is needed) the assembler will | |
339 | behave as if the argument had been 2 (ie pad to the next four byte | |
062b7c0c | 340 | boundary). This is for compatibility with ARM's own assembler. |
adcf07e6 | 341 | |
252b5132 RH |
342 | @cindex @code{req} directive, ARM |
343 | @item @var{name} .req @var{register name} | |
344 | This creates an alias for @var{register name} called @var{name}. For | |
345 | example: | |
346 | ||
347 | @smallexample | |
348 | foo .req r0 | |
349 | @end smallexample | |
350 | ||
0bbf2aa4 NC |
351 | @cindex @code{unreq} directive, ARM |
352 | @item .unreq @var{alias-name} | |
353 | This undefines a register alias which was previously defined using the | |
354 | @code{req} directive. For example: | |
355 | ||
356 | @smallexample | |
357 | foo .req r0 | |
358 | .unreq foo | |
359 | @end smallexample | |
360 | ||
361 | An error occurs if the name is undefined. Note - this pseudo op can | |
362 | be used to delete builtin in register name aliases (eg 'r0'). This | |
363 | should only be done if it is really necessary. | |
364 | ||
252b5132 | 365 | @cindex @code{code} directive, ARM |
0ac658b8 | 366 | @item .code @code{[16|32]} |
252b5132 RH |
367 | This directive selects the instruction set being generated. The value 16 |
368 | selects Thumb, with the value 32 selecting ARM. | |
369 | ||
370 | @cindex @code{thumb} directive, ARM | |
371 | @item .thumb | |
372 | This performs the same action as @var{.code 16}. | |
373 | ||
374 | @cindex @code{arm} directive, ARM | |
375 | @item .arm | |
376 | This performs the same action as @var{.code 32}. | |
377 | ||
378 | @cindex @code{force_thumb} directive, ARM | |
379 | @item .force_thumb | |
380 | This directive forces the selection of Thumb instructions, even if the | |
381 | target processor does not support those instructions | |
382 | ||
383 | @cindex @code{thumb_func} directive, ARM | |
384 | @item .thumb_func | |
385 | This directive specifies that the following symbol is the name of a | |
386 | Thumb encoded function. This information is necessary in order to allow | |
387 | the assembler and linker to generate correct code for interworking | |
388 | between Arm and Thumb instructions and should be used even if | |
1994a7c7 NC |
389 | interworking is not going to be performed. The presence of this |
390 | directive also implies @code{.thumb} | |
252b5132 | 391 | |
5395a469 NC |
392 | @cindex @code{thumb_set} directive, ARM |
393 | @item .thumb_set | |
394 | This performs the equivalent of a @code{.set} directive in that it | |
395 | creates a symbol which is an alias for another symbol (possibly not yet | |
396 | defined). This directive also has the added property in that it marks | |
397 | the aliased symbol as being a thumb function entry point, in the same | |
398 | way that the @code{.thumb_func} directive does. | |
399 | ||
252b5132 RH |
400 | @cindex @code{.ltorg} directive, ARM |
401 | @item .ltorg | |
402 | This directive causes the current contents of the literal pool to be | |
403 | dumped into the current section (which is assumed to be the .text | |
404 | section) at the current location (aligned to a word boundary). | |
3d0c9500 NC |
405 | @code{GAS} maintains a separate literal pool for each section and each |
406 | sub-section. The @code{.ltorg} directive will only affect the literal | |
407 | pool of the current section and sub-section. At the end of assembly | |
408 | all remaining, un-empty literal pools will automatically be dumped. | |
409 | ||
410 | Note - older versions of @code{GAS} would dump the current literal | |
411 | pool any time a section change occurred. This is no longer done, since | |
412 | it prevents accurate control of the placement of literal pools. | |
252b5132 RH |
413 | |
414 | @cindex @code{.pool} directive, ARM | |
415 | @item .pool | |
416 | This is a synonym for .ltorg. | |
417 | ||
7ed4c4c5 NC |
418 | @cindex @code{.fnstart} directive, ARM |
419 | @item .unwind_fnstart | |
420 | Marks the start of a function with an unwind table entry. | |
421 | ||
422 | @cindex @code{.fnend} directive, ARM | |
423 | @item .unwind_fnend | |
424 | Marks the end of a function with an unwind table entry. The unwind index | |
425 | table entry is created when this directive is processed. | |
426 | ||
427 | If no personality routine has been specified then standard personality | |
428 | routine 0 or 1 will be used, depending on the number of unwind opcodes | |
429 | required. | |
430 | ||
431 | @cindex @code{.cantunwind} directive, ARM | |
432 | @item .cantunwind | |
433 | Prevents unwinding through the current function. No personality routine | |
434 | or exception table data is required or permitted. | |
435 | ||
436 | @cindex @code{.personality} directive, ARM | |
437 | @item .personality @var{name} | |
438 | Sets the personality routine for the current function to @var{name}. | |
439 | ||
440 | @cindex @code{.personalityindex} directive, ARM | |
441 | @item .personalityindex @var{index} | |
442 | Sets the personality routine for the current function to the EABI standard | |
443 | routine number @var{index} | |
444 | ||
445 | @cindex @code{.handlerdata} directive, ARM | |
446 | @item .handlerdata | |
447 | Marks the end of the current function, and the start of the exception table | |
448 | entry for that function. Anything between this directive and the | |
449 | @code{.fnend} directive will be added to the exception table entry. | |
450 | ||
451 | Must be preceded by a @code{.personality} or @code{.personalityindex} | |
452 | directive. | |
453 | ||
454 | @cindex @code{.save} directive, ARM | |
455 | @item .save @var{reglist} | |
456 | Generate unwinder annotations to restore the registers in @var{reglist}. | |
457 | The format of @var{reglist} is the same as the corresponding store-multiple | |
458 | instruction. | |
459 | ||
460 | @smallexample | |
461 | @exdent @emph{core registers} | |
462 | .save @{r4, r5, r6, lr@} | |
463 | stmfd sp!, @{r4, r5, r6, lr@} | |
464 | @exdent @emph{FPA registers} | |
465 | .save f4, 2 | |
466 | sfmfd f4, 2, [sp]! | |
467 | @exdent @emph{VFP registers} | |
468 | .save @{d8, d9, d10@} | |
469 | fstmdf sp!, @{d8, d9, d10@} | |
470 | @exdent @emph{iWMMXt registers} | |
471 | .save @{wr10, wr11@} | |
472 | wstrd wr11, [sp, #-8]! | |
473 | wstrd wr10, [sp, #-8]! | |
474 | or | |
475 | .save wr11 | |
476 | wstrd wr11, [sp, #-8]! | |
477 | .save wr10 | |
478 | wstrd wr10, [sp, #-8]! | |
479 | @end smallexample | |
480 | ||
481 | @cindex @code{.pad} directive, ARM | |
482 | @item .pad #@var{count} | |
483 | Generate unwinder annotations for a stack adjustment of @var{count} bytes. | |
484 | A positive value indicates the function prologue allocated stack space by | |
485 | decrementing the stack pointer. | |
486 | ||
487 | @cindex @code{.movsp} directive, ARM | |
488 | @item .movsp @var{reg} | |
489 | Tell the unwinder that @var{reg} contains the current stack pointer. | |
490 | ||
491 | @cindex @code{.setfp} directive, ARM | |
492 | @item .setfp @var{fpreg}, @var{spreg} [, #@var{offset}] | |
493 | Make all unwinder annotations relaive to a frame pointer. Without this | |
494 | the unwinder will use offsets from the stack pointer. | |
495 | ||
496 | The syntax of this directive is the same as the @code{sub} or @code{mov} | |
497 | instruction used to set the frame pointer. @var{spreg} must be either | |
498 | @code{sp} or mentioned in a previous @code{.movsp} directive. | |
499 | ||
500 | @smallexample | |
501 | .movsp ip | |
502 | mov ip, sp | |
503 | @dots{} | |
504 | .setfp fp, ip, #4 | |
505 | sub fp, ip, #4 | |
506 | @end smallexample | |
507 | ||
508 | @cindex @code{.unwind_raw} directive, ARM | |
509 | @item .raw @var{offset}, @var{byte1}, @dots{} | |
510 | Insert one of more arbitary unwind opcode bytes, which are known to adjust | |
511 | the stack pointer by @var{offset} bytes. | |
512 | ||
513 | For example @code{.unwind_raw 4, 0xb1, 0x01} is equivalent to | |
514 | @code{.save @{r0@}} | |
515 | ||
ee065d83 PB |
516 | @cindex @code{.cpu} directive, ARM |
517 | @item .cpu @var{name} | |
518 | Select the target processor. Valid values for @var{name} are the same as | |
519 | for the @option{-mcpu} commandline option. | |
520 | ||
521 | @cindex @code{.arch} directive, ARM | |
522 | @item .arch @var{name} | |
523 | Select the target architecture. Valid values for @var{name} are the same as | |
524 | for the @option{-march} commandline option. | |
525 | ||
526 | @cindex @code{.fpu} directive, ARM | |
527 | @item .fpu @var{name} | |
528 | Select the floating point unit to assemble for. Valid values for @var{name} | |
529 | are the same as for the @option{-mfpu} commandline option. | |
530 | ||
531 | @cindex @code{.eabi_attribute} directive, ARM | |
532 | @item .eabi_attribute @var{tag}, @var{value} | |
533 | Set the EABI object attribute number @var{tag} to @var{value}. The value | |
534 | is either a @code{number}, @code{"string"}, or @code{number, "string"} | |
535 | depending on the tag. | |
536 | ||
252b5132 RH |
537 | @end table |
538 | ||
539 | @node ARM Opcodes | |
540 | @section Opcodes | |
541 | ||
542 | @cindex ARM opcodes | |
543 | @cindex opcodes for ARM | |
49a5575c NC |
544 | @code{@value{AS}} implements all the standard ARM opcodes. It also |
545 | implements several pseudo opcodes, including several synthetic load | |
546 | instructions. | |
252b5132 | 547 | |
49a5575c NC |
548 | @table @code |
549 | ||
550 | @cindex @code{NOP} pseudo op, ARM | |
551 | @item NOP | |
552 | @smallexample | |
553 | nop | |
554 | @end smallexample | |
252b5132 | 555 | |
49a5575c NC |
556 | This pseudo op will always evaluate to a legal ARM instruction that does |
557 | nothing. Currently it will evaluate to MOV r0, r0. | |
252b5132 | 558 | |
49a5575c NC |
559 | @cindex @code{LDR reg,=<label>} pseudo op, ARM |
560 | @item LDR | |
252b5132 RH |
561 | @smallexample |
562 | ldr <register> , = <expression> | |
563 | @end smallexample | |
564 | ||
565 | If expression evaluates to a numeric constant then a MOV or MVN | |
566 | instruction will be used in place of the LDR instruction, if the | |
567 | constant can be generated by either of these instructions. Otherwise | |
568 | the constant will be placed into the nearest literal pool (if it not | |
569 | already there) and a PC relative LDR instruction will be generated. | |
570 | ||
49a5575c NC |
571 | @cindex @code{ADR reg,<label>} pseudo op, ARM |
572 | @item ADR | |
573 | @smallexample | |
574 | adr <register> <label> | |
575 | @end smallexample | |
576 | ||
577 | This instruction will load the address of @var{label} into the indicated | |
578 | register. The instruction will evaluate to a PC relative ADD or SUB | |
579 | instruction depending upon where the label is located. If the label is | |
580 | out of range, or if it is not defined in the same file (and section) as | |
581 | the ADR instruction, then an error will be generated. This instruction | |
582 | will not make use of the literal pool. | |
583 | ||
584 | @cindex @code{ADRL reg,<label>} pseudo op, ARM | |
585 | @item ADRL | |
586 | @smallexample | |
587 | adrl <register> <label> | |
588 | @end smallexample | |
589 | ||
590 | This instruction will load the address of @var{label} into the indicated | |
a349d9dd | 591 | register. The instruction will evaluate to one or two PC relative ADD |
49a5575c NC |
592 | or SUB instructions depending upon where the label is located. If a |
593 | second instruction is not needed a NOP instruction will be generated in | |
594 | its place, so that this instruction is always 8 bytes long. | |
595 | ||
596 | If the label is out of range, or if it is not defined in the same file | |
597 | (and section) as the ADRL instruction, then an error will be generated. | |
598 | This instruction will not make use of the literal pool. | |
599 | ||
600 | @end table | |
601 | ||
252b5132 RH |
602 | For information on the ARM or Thumb instruction sets, see @cite{ARM |
603 | Software Development Toolkit Reference Manual}, Advanced RISC Machines | |
604 | Ltd. | |
605 | ||
6057a28f NC |
606 | @node ARM Mapping Symbols |
607 | @section Mapping Symbols | |
608 | ||
609 | The ARM ELF specification requires that special symbols be inserted | |
610 | into object files to mark certain features: | |
611 | ||
612 | @table @code | |
613 | ||
614 | @cindex @code{$a} | |
615 | @item $a | |
616 | At the start of a region of code containing ARM instructions. | |
617 | ||
618 | @cindex @code{$t} | |
619 | @item $t | |
620 | At the start of a region of code containing THUMB instructions. | |
621 | ||
622 | @cindex @code{$d} | |
623 | @item $d | |
624 | At the start of a region of data. | |
625 | ||
626 | @end table | |
627 | ||
628 | The assembler will automatically insert these symbols for you - there | |
629 | is no need to code them yourself. Support for tagging symbols ($b, | |
630 | $f, $p and $m) which is also mentioned in the current ARM ELF | |
631 | specification is not implemented. This is because they have been | |
632 | dropped from the new EABI and so tools cannot rely upon their | |
633 | presence. | |
634 |