]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gas/doc/c-arm.texi
2008-03-09 Paul Brook <paul@codesourcery.com>
[thirdparty/binutils-gdb.git] / gas / doc / c-arm.texi
CommitLineData
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
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},
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
116and
117@code{xscale}.
118The special name @code{all} may be used to allow the
119assembler to accept instructions valid for any ARM processor.
120
121In addition to the basic instruction set, the assembler can be told to
122accept various extension mnemonics that extend the processor using the
123co-processor instruction space. For example, @code{-mcpu=arm920+maverick}
124is equivalent to specifying @code{-mcpu=ep9312}. The following extensions
125are currently supported:
126@code{+maverick}
e16bb312 127@code{+iwmmxt}
03b1477f
RE
128and
129@code{+xscale}.
130
131@cindex @code{-march=} command line option, ARM
92081f48 132@item -march=@var{architecture}[+@var{extension}@dots{}]
252b5132
RH
133This option specifies the target architecture. The assembler will issue
134an error message if an attempt is made to assemble an instruction which
03b1477f
RE
135will not execute on the target architecture. The following architecture
136names 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 157@code{armv7},
c450d570
PB
158@code{armv7-a},
159@code{armv7-r},
160@code{armv7-m},
e16bb312 161@code{iwmmxt}
03b1477f
RE
162and
163@code{xscale}.
164If both @code{-mcpu} and
165@code{-march} are specified, the assembler will use
166the setting for @code{-mcpu}.
167
168The architecture option can be extended with the same instruction set
169extension options as the @code{-mcpu} option.
170
171@cindex @code{-mfpu=} command line option, ARM
172@item -mfpu=@var{floating-point-format}
173
174This option specifies the floating point format to assemble for. The
175assembler will issue an error message if an attempt is made to assemble
176an instruction which will not execute on the target floating point unit.
177The 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},
b1cc4aeb
PB
193@code{vfpv2}
194@code{vfpv3}
195@code{vfpv3-d16}
09d92015
MM
196@code{arm1020t},
197@code{arm1020e},
b1cc4aeb
PB
198@code{arm1136jf-s},
199@code{maverick}
03b1477f 200and
b1cc4aeb 201@code{neon}.
03b1477f
RE
202
203In addition to determining which instructions are assembled, this option
204also affects the way in which the @code{.double} assembler directive behaves
205when assembling little-endian code.
206
207The default is dependent on the processor selected. For Architecture 5 or
208later, the default is to assembler for VFP instructions; for earlier
209architectures the default is to assemble for FPA instructions.
adcf07e6 210
252b5132
RH
211@cindex @code{-mthumb} command line option, ARM
212@item -mthumb
03b1477f
RE
213This option specifies that the assembler should start assembling Thumb
214instructions; that is, it should behave as though the file starts with a
215@code{.code 16} directive.
adcf07e6 216
252b5132
RH
217@cindex @code{-mthumb-interwork} command line option, ARM
218@item -mthumb-interwork
219This option specifies that the output generated by the assembler should
220be marked as supporting interworking.
adcf07e6 221
252b5132 222@cindex @code{-mapcs} command line option, ARM
0ac658b8 223@item -mapcs @code{[26|32]}
252b5132
RH
224This option specifies that the output generated by the assembler should
225be marked as supporting the indicated version of the Arm Procedure.
226Calling Standard.
adcf07e6 227
077b8428
NC
228@cindex @code{-matpcs} command line option, ARM
229@item -matpcs
230This option specifies that the output generated by the assembler should
231be marked as supporting the Arm/Thumb Procedure Calling Standard. If
232enabled this option will cause the assembler to create an empty
233debugging section in the object file called .arm.atpcs. Debuggers can
234use this to determine the ABI being used by.
235
adcf07e6 236@cindex @code{-mapcs-float} command line option, ARM
252b5132 237@item -mapcs-float
1be59579 238This indicates the floating point variant of the APCS should be
252b5132 239used. In this variant floating point arguments are passed in FP
550262c4 240registers rather than integer registers.
adcf07e6
NC
241
242@cindex @code{-mapcs-reentrant} command line option, ARM
252b5132
RH
243@item -mapcs-reentrant
244This indicates that the reentrant variant of the APCS should be used.
245This variant supports position independent code.
adcf07e6 246
33a392fb
PB
247@cindex @code{-mfloat-abi=} command line option, ARM
248@item -mfloat-abi=@var{abi}
249This option specifies that the output generated by the assembler should be
250marked as using specified floating point ABI.
251The following values are recognized:
252@code{soft},
253@code{softfp}
254and
255@code{hard}.
256
d507cf36
PB
257@cindex @code{-eabi=} command line option, ARM
258@item -meabi=@var{ver}
259This option specifies which EABI version the produced object files should
260conform to.
b45619c0 261The following values are recognized:
3a4a14e9
PB
262@code{gnu},
263@code{4}
d507cf36 264and
3a4a14e9 265@code{5}.
d507cf36 266
252b5132
RH
267@cindex @code{-EB} command line option, ARM
268@item -EB
269This option specifies that the output generated by the assembler should
270be marked as being encoded for a big-endian processor.
adcf07e6 271
252b5132
RH
272@cindex @code{-EL} command line option, ARM
273@item -EL
274This option specifies that the output generated by the assembler should
275be marked as being encoded for a little-endian processor.
adcf07e6 276
252b5132
RH
277@cindex @code{-k} command line option, ARM
278@cindex PIC code generation for ARM
279@item -k
a349d9dd
PB
280This option specifies that the output of the assembler should be marked
281as position-independent code (PIC).
adcf07e6 282
845b51d6
PB
283@cindex @code{--fix-v4bx} command line option, ARM
284@item --fix-v4bx
285Allow @code{BX} instructions in ARMv4 code. This is intended for use with
286the linker option of the same name.
287
252b5132
RH
288@end table
289
290
291@node ARM Syntax
292@section Syntax
293@menu
294* ARM-Chars:: Special Characters
295* ARM-Regs:: Register Names
b6895b4f 296* ARM-Relocations:: Relocations
252b5132
RH
297@end menu
298
299@node ARM-Chars
300@subsection Special Characters
301
302@cindex line comment character, ARM
303@cindex ARM line comment character
550262c4
NC
304The presence of a @samp{@@} on a line indicates the start of a comment
305that extends to the end of the current line. If a @samp{#} appears as
306the first character of a line, the whole line is treated as a comment.
307
308@cindex line separator, ARM
309@cindex statement separator, ARM
310@cindex ARM line separator
a349d9dd
PB
311The @samp{;} character can be used instead of a newline to separate
312statements.
550262c4
NC
313
314@cindex immediate character, ARM
315@cindex ARM immediate character
316Either @samp{#} or @samp{$} can be used to indicate immediate operands.
252b5132
RH
317
318@cindex identifiers, ARM
319@cindex ARM identifiers
320*TODO* Explain about /data modifier on symbols.
321
322@node ARM-Regs
323@subsection Register Names
324
325@cindex ARM register names
326@cindex register names, ARM
327*TODO* Explain about ARM register naming, and the predefined names.
328
329@node ARM Floating Point
330@section Floating Point
331
332@cindex floating point, ARM (@sc{ieee})
333@cindex ARM floating point (@sc{ieee})
334The ARM family uses @sc{ieee} floating-point numbers.
335
b6895b4f
PB
336@node ARM-Relocations
337@subsection ARM relocation generation
338
339@cindex data relocations, ARM
340@cindex ARM data relocations
341Specific data relocations can be generated by putting the relocation name
342in parentheses after the symbol name. For example:
343
344@smallexample
345 .word foo(TARGET1)
346@end smallexample
347
348This will generate an @samp{R_ARM_TARGET1} relocation against the symbol
349@var{foo}.
350The following relocations are supported:
351@code{GOT},
352@code{GOTOFF},
353@code{TARGET1},
354@code{TARGET2},
355@code{SBREL},
356@code{TLSGD},
357@code{TLSLDM},
358@code{TLSLDO},
359@code{GOTTPOFF}
360and
361@code{TPOFF}.
362
363For compatibility with older toolchains the assembler also accepts
364@code{(PLT)} after branch targets. This will generate the deprecated
365@samp{R_ARM_PLT32} relocation.
366
367@cindex MOVW and MOVT relocations, ARM
368Relocations for @samp{MOVW} and @samp{MOVT} instructions can be generated
369by prefixing the value with @samp{#:lower16:} and @samp{#:upper16}
b45619c0 370respectively. For example to load the 32-bit address of foo into r0:
252b5132 371
b6895b4f
PB
372@smallexample
373 MOVW r0, #:lower16:foo
374 MOVT r0, #:upper16:foo
375@end smallexample
252b5132
RH
376
377@node ARM Directives
378@section ARM Machine Directives
379
380@cindex machine directives, ARM
381@cindex ARM machine directives
382@table @code
383
adcf07e6
NC
384@cindex @code{align} directive, ARM
385@item .align @var{expression} [, @var{expression}]
386This is the generic @var{.align} directive. For the ARM however if the
387first argument is zero (ie no alignment is needed) the assembler will
388behave as if the argument had been 2 (ie pad to the next four byte
062b7c0c 389boundary). This is for compatibility with ARM's own assembler.
adcf07e6 390
252b5132
RH
391@cindex @code{req} directive, ARM
392@item @var{name} .req @var{register name}
393This creates an alias for @var{register name} called @var{name}. For
394example:
395
396@smallexample
397 foo .req r0
398@end smallexample
399
0bbf2aa4
NC
400@cindex @code{unreq} directive, ARM
401@item .unreq @var{alias-name}
402This undefines a register alias which was previously defined using the
23753660 403@code{req}, @code{dn} or @code{qn} directives. For example:
0bbf2aa4
NC
404
405@smallexample
406 foo .req r0
407 .unreq foo
408@end smallexample
409
410An error occurs if the name is undefined. Note - this pseudo op can
411be used to delete builtin in register name aliases (eg 'r0'). This
412should only be done if it is really necessary.
413
23753660 414@cindex @code{dn} and @code{qn} directives, ARM
f467aa98
BE
415@item @var{name} .dn @var{register name} [@var{.type}] [[@var{index}]]
416@item @var{name} .qn @var{register name} [@var{.type}] [[@var{index}]]
23753660
JB
417
418The @code{dn} and @code{qn} directives are used to create typed
419and/or indexed register aliases for use in Advanced SIMD Extension
420(Neon) instructions. The former should be used to create aliases
421of double-precision registers, and the latter to create aliases of
422quad-precision registers.
423
424If these directives are used to create typed aliases, those aliases can
425be used in Neon instructions instead of writing types after the mnemonic
426or after each operand. For example:
427
428@smallexample
429 x .dn d2.f32
430 y .dn d3.f32
431 z .dn d4.f32[1]
432 vmul x,y,z
433@end smallexample
434
435This is equivalent to writing the following:
436
437@smallexample
438 vmul.f32 d2,d3,d4[1]
439@end smallexample
440
441Aliases created using @code{dn} or @code{qn} can be destroyed using
442@code{unreq}.
443
252b5132 444@cindex @code{code} directive, ARM
0ac658b8 445@item .code @code{[16|32]}
252b5132
RH
446This directive selects the instruction set being generated. The value 16
447selects Thumb, with the value 32 selecting ARM.
448
449@cindex @code{thumb} directive, ARM
450@item .thumb
451This performs the same action as @var{.code 16}.
452
453@cindex @code{arm} directive, ARM
454@item .arm
455This performs the same action as @var{.code 32}.
456
457@cindex @code{force_thumb} directive, ARM
458@item .force_thumb
459This directive forces the selection of Thumb instructions, even if the
460target processor does not support those instructions
461
462@cindex @code{thumb_func} directive, ARM
463@item .thumb_func
464This directive specifies that the following symbol is the name of a
465Thumb encoded function. This information is necessary in order to allow
466the assembler and linker to generate correct code for interworking
467between Arm and Thumb instructions and should be used even if
1994a7c7
NC
468interworking is not going to be performed. The presence of this
469directive also implies @code{.thumb}
252b5132 470
e1da3f5b
PB
471This directive is not neccessary when generating EABI objects. On these
472targets the encoding is implicit when generating Thumb code.
473
5395a469
NC
474@cindex @code{thumb_set} directive, ARM
475@item .thumb_set
476This performs the equivalent of a @code{.set} directive in that it
477creates a symbol which is an alias for another symbol (possibly not yet
478defined). This directive also has the added property in that it marks
479the aliased symbol as being a thumb function entry point, in the same
480way that the @code{.thumb_func} directive does.
481
252b5132
RH
482@cindex @code{.ltorg} directive, ARM
483@item .ltorg
484This directive causes the current contents of the literal pool to be
485dumped into the current section (which is assumed to be the .text
486section) at the current location (aligned to a word boundary).
3d0c9500
NC
487@code{GAS} maintains a separate literal pool for each section and each
488sub-section. The @code{.ltorg} directive will only affect the literal
489pool of the current section and sub-section. At the end of assembly
490all remaining, un-empty literal pools will automatically be dumped.
491
492Note - older versions of @code{GAS} would dump the current literal
493pool any time a section change occurred. This is no longer done, since
494it prevents accurate control of the placement of literal pools.
252b5132
RH
495
496@cindex @code{.pool} directive, ARM
497@item .pool
498This is a synonym for .ltorg.
499
7ed4c4c5
NC
500@cindex @code{.fnstart} directive, ARM
501@item .unwind_fnstart
502Marks the start of a function with an unwind table entry.
503
504@cindex @code{.fnend} directive, ARM
505@item .unwind_fnend
506Marks the end of a function with an unwind table entry. The unwind index
507table entry is created when this directive is processed.
508
509If no personality routine has been specified then standard personality
510routine 0 or 1 will be used, depending on the number of unwind opcodes
511required.
512
513@cindex @code{.cantunwind} directive, ARM
514@item .cantunwind
515Prevents unwinding through the current function. No personality routine
516or exception table data is required or permitted.
517
518@cindex @code{.personality} directive, ARM
519@item .personality @var{name}
520Sets the personality routine for the current function to @var{name}.
521
522@cindex @code{.personalityindex} directive, ARM
523@item .personalityindex @var{index}
524Sets the personality routine for the current function to the EABI standard
525routine number @var{index}
526
527@cindex @code{.handlerdata} directive, ARM
528@item .handlerdata
529Marks the end of the current function, and the start of the exception table
530entry for that function. Anything between this directive and the
531@code{.fnend} directive will be added to the exception table entry.
532
533Must be preceded by a @code{.personality} or @code{.personalityindex}
534directive.
535
536@cindex @code{.save} directive, ARM
537@item .save @var{reglist}
538Generate unwinder annotations to restore the registers in @var{reglist}.
539The format of @var{reglist} is the same as the corresponding store-multiple
540instruction.
541
542@smallexample
543@exdent @emph{core registers}
544 .save @{r4, r5, r6, lr@}
545 stmfd sp!, @{r4, r5, r6, lr@}
546@exdent @emph{FPA registers}
547 .save f4, 2
548 sfmfd f4, 2, [sp]!
549@exdent @emph{VFP registers}
550 .save @{d8, d9, d10@}
fa073d69 551 fstmdx sp!, @{d8, d9, d10@}
7ed4c4c5
NC
552@exdent @emph{iWMMXt registers}
553 .save @{wr10, wr11@}
554 wstrd wr11, [sp, #-8]!
555 wstrd wr10, [sp, #-8]!
556or
557 .save wr11
558 wstrd wr11, [sp, #-8]!
559 .save wr10
560 wstrd wr10, [sp, #-8]!
561@end smallexample
562
fa073d69
MS
563@cindex @code{.vsave} directive, ARM
564@item .vsave @var{vfp-reglist}
565Generate unwinder annotations to restore the VFP registers in @var{vfp-reglist}
566using FLDMD. Also works for VFPv3 registers
567that are to be restored using VLDM.
568The format of @var{vfp-reglist} is the same as the corresponding store-multiple
569instruction.
570
571@smallexample
572@exdent @emph{VFP registers}
573 .vsave @{d8, d9, d10@}
574 fstmdd sp!, @{d8, d9, d10@}
575@exdent @emph{VFPv3 registers}
576 .vsave @{d15, d16, d17@}
577 vstm sp!, @{d15, d16, d17@}
578@end smallexample
579
580Since FLDMX and FSTMX are now deprecated, this directive should be
581used in favour of @code{.save} for saving VFP registers for ARMv6 and above.
582
7ed4c4c5
NC
583@cindex @code{.pad} directive, ARM
584@item .pad #@var{count}
585Generate unwinder annotations for a stack adjustment of @var{count} bytes.
586A positive value indicates the function prologue allocated stack space by
587decrementing the stack pointer.
588
589@cindex @code{.movsp} directive, ARM
4fa3602b
PB
590@item .movsp @var{reg} [, #@var{offset}]
591Tell the unwinder that @var{reg} contains an offset from the current
592stack pointer. If @var{offset} is not specified then it is assumed to be
593zero.
7ed4c4c5
NC
594
595@cindex @code{.setfp} directive, ARM
596@item .setfp @var{fpreg}, @var{spreg} [, #@var{offset}]
597Make all unwinder annotations relaive to a frame pointer. Without this
598the unwinder will use offsets from the stack pointer.
599
600The syntax of this directive is the same as the @code{sub} or @code{mov}
601instruction used to set the frame pointer. @var{spreg} must be either
602@code{sp} or mentioned in a previous @code{.movsp} directive.
603
604@smallexample
605.movsp ip
606mov ip, sp
607@dots{}
608.setfp fp, ip, #4
609sub fp, ip, #4
610@end smallexample
611
612@cindex @code{.unwind_raw} directive, ARM
613@item .raw @var{offset}, @var{byte1}, @dots{}
614Insert one of more arbitary unwind opcode bytes, which are known to adjust
615the stack pointer by @var{offset} bytes.
616
617For example @code{.unwind_raw 4, 0xb1, 0x01} is equivalent to
618@code{.save @{r0@}}
619
ee065d83
PB
620@cindex @code{.cpu} directive, ARM
621@item .cpu @var{name}
622Select the target processor. Valid values for @var{name} are the same as
623for the @option{-mcpu} commandline option.
624
625@cindex @code{.arch} directive, ARM
626@item .arch @var{name}
627Select the target architecture. Valid values for @var{name} are the same as
628for the @option{-march} commandline option.
629
7a1d4c38
PB
630@cindex @code{.object_arch} directive, ARM
631@item .object_arch @var{name}
632Override the architecture recorded in the EABI object attribute section.
633Valid values for @var{name} are the same as for the @code{.arch} directive.
634Typically this is useful when code uses runtime detection of CPU features.
635
ee065d83
PB
636@cindex @code{.fpu} directive, ARM
637@item .fpu @var{name}
638Select the floating point unit to assemble for. Valid values for @var{name}
639are the same as for the @option{-mfpu} commandline option.
640
641@cindex @code{.eabi_attribute} directive, ARM
642@item .eabi_attribute @var{tag}, @var{value}
643Set the EABI object attribute number @var{tag} to @var{value}. The value
644is either a @code{number}, @code{"string"}, or @code{number, "string"}
645depending on the tag.
646
252b5132
RH
647@end table
648
649@node ARM Opcodes
650@section Opcodes
651
652@cindex ARM opcodes
653@cindex opcodes for ARM
49a5575c
NC
654@code{@value{AS}} implements all the standard ARM opcodes. It also
655implements several pseudo opcodes, including several synthetic load
656instructions.
252b5132 657
49a5575c
NC
658@table @code
659
660@cindex @code{NOP} pseudo op, ARM
661@item NOP
662@smallexample
663 nop
664@end smallexample
252b5132 665
49a5575c
NC
666This pseudo op will always evaluate to a legal ARM instruction that does
667nothing. Currently it will evaluate to MOV r0, r0.
252b5132 668
49a5575c
NC
669@cindex @code{LDR reg,=<label>} pseudo op, ARM
670@item LDR
252b5132
RH
671@smallexample
672 ldr <register> , = <expression>
673@end smallexample
674
675If expression evaluates to a numeric constant then a MOV or MVN
676instruction will be used in place of the LDR instruction, if the
677constant can be generated by either of these instructions. Otherwise
678the constant will be placed into the nearest literal pool (if it not
679already there) and a PC relative LDR instruction will be generated.
680
49a5575c
NC
681@cindex @code{ADR reg,<label>} pseudo op, ARM
682@item ADR
683@smallexample
684 adr <register> <label>
685@end smallexample
686
687This instruction will load the address of @var{label} into the indicated
688register. The instruction will evaluate to a PC relative ADD or SUB
689instruction depending upon where the label is located. If the label is
690out of range, or if it is not defined in the same file (and section) as
691the ADR instruction, then an error will be generated. This instruction
692will not make use of the literal pool.
693
694@cindex @code{ADRL reg,<label>} pseudo op, ARM
695@item ADRL
696@smallexample
697 adrl <register> <label>
698@end smallexample
699
700This instruction will load the address of @var{label} into the indicated
a349d9dd 701register. The instruction will evaluate to one or two PC relative ADD
49a5575c
NC
702or SUB instructions depending upon where the label is located. If a
703second instruction is not needed a NOP instruction will be generated in
704its place, so that this instruction is always 8 bytes long.
705
706If the label is out of range, or if it is not defined in the same file
707(and section) as the ADRL instruction, then an error will be generated.
708This instruction will not make use of the literal pool.
709
710@end table
711
252b5132
RH
712For information on the ARM or Thumb instruction sets, see @cite{ARM
713Software Development Toolkit Reference Manual}, Advanced RISC Machines
714Ltd.
715
6057a28f
NC
716@node ARM Mapping Symbols
717@section Mapping Symbols
718
719The ARM ELF specification requires that special symbols be inserted
720into object files to mark certain features:
721
722@table @code
723
724@cindex @code{$a}
725@item $a
726At the start of a region of code containing ARM instructions.
727
728@cindex @code{$t}
729@item $t
730At the start of a region of code containing THUMB instructions.
731
732@cindex @code{$d}
733@item $d
734At the start of a region of data.
735
736@end table
737
738The assembler will automatically insert these symbols for you - there
739is no need to code them yourself. Support for tagging symbols ($b,
740$f, $p and $m) which is also mentioned in the current ARM ELF
741specification is not implemented. This is because they have been
742dropped from the new EABI and so tools cannot rely upon their
743presence.
744