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