1 @c Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2003
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.
9 @chapter ARM Dependent Features
13 @node Machine Dependencies
14 @chapter ARM Dependent Features
20 * ARM Options:: Options
22 * ARM Floating Point:: Floating Point
23 * ARM Directives:: ARM Machine Directives
24 * ARM Opcodes:: Opcodes
25 * ARM Mapping Symbols:: Mapping Symbols
30 @cindex ARM options (none)
31 @cindex options for ARM (none)
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
98 @code{ep9312} (ARM920 with Cirrus Maverick coprocessor),
99 @code{i80200} (Intel XScale processor)
100 @code{iwmmxt} (Intel(r) XScale processor with Wireless MMX(tm) technology coprocessor)
103 The special name @code{all} may be used to allow the
104 assembler to accept instructions valid for any ARM processor.
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:
116 @cindex @code{-march=} command line option, ARM
117 @item -march=@var{architecture}[+@var{extension}@dots{}]
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
120 will not execute on the target architecture. The following architecture
121 names are recognized:
142 If both @code{-mcpu} and
143 @code{-march} are specified, the assembler will use
144 the setting for @code{-mcpu}.
146 The architecture option can be extended with the same instruction set
147 extension options as the @code{-mcpu} option.
149 @cindex @code{-mfpu=} command line option, ARM
150 @item -mfpu=@var{floating-point-format}
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:
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.
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.
185 @cindex @code{-mthumb} command line option, ARM
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.
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.
196 @cindex @code{-mapcs} command line option, ARM
197 @item -mapcs @code{[26|32]}
198 This option specifies that the output generated by the assembler should
199 be marked as supporting the indicated version of the Arm Procedure.
202 @cindex @code{-matpcs} command line option, ARM
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.
210 @cindex @code{-mapcs-float} command line option, ARM
212 This indicates the floating point variant of the APCS should be
213 used. In this variant floating point arguments are passed in FP
214 registers rather than integer registers.
216 @cindex @code{-mapcs-reentrant} command line option, ARM
217 @item -mapcs-reentrant
218 This indicates that the reentrant variant of the APCS should be used.
219 This variant supports position independent code.
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:
231 @cindex @code{-EB} command line option, ARM
233 This option specifies that the output generated by the assembler should
234 be marked as being encoded for a big-endian processor.
236 @cindex @code{-EL} command line option, ARM
238 This option specifies that the output generated by the assembler should
239 be marked as being encoded for a little-endian processor.
241 @cindex @code{-k} command line option, ARM
242 @cindex PIC code generation for ARM
244 This option specifies that the output of the assembler should be marked
245 as position-independent code (PIC).
247 @cindex @code{-moabi} command line option, ARM
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.
260 * ARM-Chars:: Special Characters
261 * ARM-Regs:: Register Names
265 @subsection Special Characters
267 @cindex line comment character, ARM
268 @cindex ARM line comment character
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.
273 @cindex line separator, ARM
274 @cindex statement separator, ARM
275 @cindex ARM line separator
276 The @samp{;} character can be used instead of a newline to separate
279 @cindex immediate character, ARM
280 @cindex ARM immediate character
281 Either @samp{#} or @samp{$} can be used to indicate immediate operands.
283 @cindex identifiers, ARM
284 @cindex ARM identifiers
285 *TODO* Explain about /data modifier on symbols.
288 @subsection Register Names
290 @cindex ARM register names
291 @cindex register names, ARM
292 *TODO* Explain about ARM register naming, and the predefined names.
294 @node ARM Floating Point
295 @section Floating Point
297 @cindex floating point, ARM (@sc{ieee})
298 @cindex ARM floating point (@sc{ieee})
299 The ARM family uses @sc{ieee} floating-point numbers.
304 @section ARM Machine Directives
306 @cindex machine directives, ARM
307 @cindex ARM machine directives
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
315 boundary). This is for compatibility with ARM's own assembler.
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
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:
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.
340 @cindex @code{code} directive, ARM
341 @item .code @code{[16|32]}
342 This directive selects the instruction set being generated. The value 16
343 selects Thumb, with the value 32 selecting ARM.
345 @cindex @code{thumb} directive, ARM
347 This performs the same action as @var{.code 16}.
349 @cindex @code{arm} directive, ARM
351 This performs the same action as @var{.code 32}.
353 @cindex @code{force_thumb} directive, ARM
355 This directive forces the selection of Thumb instructions, even if the
356 target processor does not support those instructions
358 @cindex @code{thumb_func} directive, ARM
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
364 interworking is not going to be performed. The presence of this
365 directive also implies @code{.thumb}
367 @cindex @code{thumb_set} directive, ARM
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.
375 @cindex @code{.ltorg} directive, ARM
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).
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.
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.
389 @cindex @code{.pool} directive, ARM
391 This is a synonym for .ltorg.
399 @cindex opcodes for ARM
400 @code{@value{AS}} implements all the standard ARM opcodes. It also
401 implements several pseudo opcodes, including several synthetic load
406 @cindex @code{NOP} pseudo op, ARM
412 This pseudo op will always evaluate to a legal ARM instruction that does
413 nothing. Currently it will evaluate to MOV r0, r0.
415 @cindex @code{LDR reg,=<label>} pseudo op, ARM
418 ldr <register> , = <expression>
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.
427 @cindex @code{ADR reg,<label>} pseudo op, ARM
430 adr <register> <label>
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.
440 @cindex @code{ADRL reg,<label>} pseudo op, ARM
443 adrl <register> <label>
446 This instruction will load the address of @var{label} into the indicated
447 register. The instruction will evaluate to one or two PC relative ADD
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.
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.
458 For information on the ARM or Thumb instruction sets, see @cite{ARM
459 Software Development Toolkit Reference Manual}, Advanced RISC Machines
462 @node ARM Mapping Symbols
463 @section Mapping Symbols
465 The ARM ELF specification requires that special symbols be inserted
466 into object files to mark certain features:
472 At the start of a region of code containing ARM instructions.
476 At the start of a region of code containing THUMB instructions.
480 At the start of a region of data.
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