1 This is as.info, produced by makeinfo version 4.3 from as.texinfo.
4 * As: (as). The GNU assembler.
5 * Gas: (as). The GNU assembler.
8 This file documents the GNU Assembler "as".
10 Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001, 2002
11 Free Software Foundation, Inc.
13 Permission is granted to copy, distribute and/or modify this document
14 under the terms of the GNU Free Documentation License, Version 1.1 or
15 any later version published by the Free Software Foundation; with no
16 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
17 Texts. A copy of the license is included in the section entitled "GNU
18 Free Documentation License".
21 File: as.info, Node: Word, Next: Deprecated, Prev: Weak, Up: Pseudo Ops
26 This directive expects zero or more EXPRESSIONS, of any section,
29 The size of the number emitted, and its byte order, depend on what
30 target computer the assembly is for.
32 _Warning: Special Treatment to support Compilers_
34 Machines with a 32-bit address space, but that do less than 32-bit
35 addressing, require the following special treatment. If the machine of
36 interest to you does 32-bit addressing (or doesn't require it; *note
37 Machine Dependencies::), you can ignore this issue.
39 In order to assemble compiler output into something that works, `as'
40 occasionally does strange things to `.word' directives. Directives of
41 the form `.word sym1-sym2' are often emitted by compilers as part of
42 jump tables. Therefore, when `as' assembles a directive of the form
43 `.word sym1-sym2', and the difference between `sym1' and `sym2' does
44 not fit in 16 bits, `as' creates a "secondary jump table", immediately
45 before the next label. This secondary jump table is preceded by a
46 short-jump to the first byte after the secondary table. This
47 short-jump prevents the flow of control from accidentally falling into
48 the new table. Inside the table is a long-jump to `sym2'. The
49 original `.word' contains `sym1' minus the address of the long-jump to
52 If there were several occurrences of `.word sym1-sym2' before the
53 secondary jump table, all of them are adjusted. If there was a `.word
54 sym3-sym4', that also did not fit in sixteen bits, a long-jump to
55 `sym4' is included in the secondary jump table, and the `.word'
56 directives are adjusted to contain `sym3' minus the address of the
57 long-jump to `sym4'; and so on, for as many entries in the original
58 jump table as necessary.
61 File: as.info, Node: Deprecated, Prev: Word, Up: Pseudo Ops
66 One day these directives won't work. They are included for
67 compatibility with older assemblers.
72 File: as.info, Node: Machine Dependencies, Next: Reporting Bugs, Prev: Pseudo Ops, Up: Top
74 Machine Dependent Features
75 **************************
77 The machine instruction sets are (almost by definition) different on
78 each machine where `as' runs. Floating point representations vary as
79 well, and `as' often supports a few additional directives or
80 command-line options for compatibility with other assemblers on a
81 particular platform. Finally, some versions of `as' support special
82 pseudo-instructions for branch optimization.
84 This chapter discusses most of these differences, though it does not
85 include details on any machine's instruction set. For details on that
86 subject, see the hardware manufacturer's manual.
91 * AMD29K-Dependent:: AMD 29K Dependent Features
93 * Alpha-Dependent:: Alpha Dependent Features
95 * ARC-Dependent:: ARC Dependent Features
97 * ARM-Dependent:: ARM Dependent Features
99 * CRIS-Dependent:: CRIS Dependent Features
101 * D10V-Dependent:: D10V Dependent Features
103 * D30V-Dependent:: D30V Dependent Features
105 * H8/300-Dependent:: Hitachi H8/300 Dependent Features
107 * H8/500-Dependent:: Hitachi H8/500 Dependent Features
109 * HPPA-Dependent:: HPPA Dependent Features
111 * ESA/390-Dependent:: IBM ESA/390 Dependent Features
113 * i386-Dependent:: Intel 80386 and AMD x86-64 Dependent Features
115 * i860-Dependent:: Intel 80860 Dependent Features
117 * i960-Dependent:: Intel 80960 Dependent Features
119 * M32R-Dependent:: M32R Dependent Features
121 * M68K-Dependent:: M680x0 Dependent Features
123 * M68HC11-Dependent:: M68HC11 and 68HC12 Dependent Features
125 * M88K-Dependent:: M880x0 Dependent Features
127 * MIPS-Dependent:: MIPS Dependent Features
129 * MMIX-Dependent:: MMIX Dependent Features
131 * SH-Dependent:: Hitachi SH Dependent Features
132 * SH64-Dependent:: Hitachi SH64 Dependent Features
134 * PDP-11-Dependent:: PDP-11 Dependent Features
136 * PJ-Dependent:: picoJava Dependent Features
138 * PPC-Dependent:: PowerPC Dependent Features
140 * Sparc-Dependent:: SPARC Dependent Features
142 * V850-Dependent:: V850 Dependent Features
144 * Z8000-Dependent:: Z8000 Dependent Features
146 * Vax-Dependent:: VAX Dependent Features
149 File: as.info, Node: AMD29K-Dependent, Next: Alpha-Dependent, Up: Machine Dependencies
151 AMD 29K Dependent Features
152 ==========================
156 * AMD29K Options:: Options
157 * AMD29K Syntax:: Syntax
158 * AMD29K Floating Point:: Floating Point
159 * AMD29K Directives:: AMD 29K Machine Directives
160 * AMD29K Opcodes:: Opcodes
163 File: as.info, Node: AMD29K Options, Next: AMD29K Syntax, Up: AMD29K-Dependent
168 `as' has no additional command-line options for the AMD 29K family.
171 File: as.info, Node: AMD29K Syntax, Next: AMD29K Floating Point, Prev: AMD29K Options, Up: AMD29K-Dependent
178 * AMD29K-Macros:: Macros
179 * AMD29K-Chars:: Special Characters
180 * AMD29K-Regs:: Register Names
183 File: as.info, Node: AMD29K-Macros, Next: AMD29K-Chars, Up: AMD29K Syntax
188 The macro syntax used on the AMD 29K is like that described in the
189 AMD 29K Family Macro Assembler Specification. Normal `as' macros
193 File: as.info, Node: AMD29K-Chars, Next: AMD29K-Regs, Prev: AMD29K-Macros, Up: AMD29K Syntax
198 `;' is the line comment character.
200 The character `?' is permitted in identifiers (but may not begin an
204 File: as.info, Node: AMD29K-Regs, Prev: AMD29K-Chars, Up: AMD29K Syntax
209 General-purpose registers are represented by predefined symbols of
210 the form `GRNNN' (for global registers) or `LRNNN' (for local
211 registers), where NNN represents a number between `0' and `127',
212 written with no leading zeros. The leading letters may be in either
213 upper or lower case; for example, `gr13' and `LR7' are both valid
216 You may also refer to general-purpose registers by specifying the
217 register number as the result of an expression (prefixed with `%%' to
218 flag the expression as a register number):
221 --where EXPRESSION must be an absolute expression evaluating to a
222 number between `0' and `255'. The range [0, 127] refers to global
223 registers, and the range [128, 255] to local registers.
225 In addition, `as' understands the following protected
226 special-purpose register names for the AMD 29K family:
234 These unprotected special-purpose register names are also recognized:
241 File: as.info, Node: AMD29K Floating Point, Next: AMD29K Directives, Prev: AMD29K Syntax, Up: AMD29K-Dependent
246 The AMD 29K family uses IEEE floating-point numbers.
249 File: as.info, Node: AMD29K Directives, Next: AMD29K Opcodes, Prev: AMD29K Floating Point, Up: AMD29K-Dependent
251 AMD 29K Machine Directives
252 --------------------------
255 This directive emits SIZE bytes, each of value FILL. Both SIZE
256 and FILL are absolute expressions. If the comma and FILL are
257 omitted, FILL is assumed to be zero.
259 In other versions of the GNU assembler, this directive is called
263 This directive is ignored; it is accepted for compatibility with
264 other AMD 29K assemblers.
267 This directive is ignored; it is accepted for compatibility with
268 other AMD 29K assemblers.
270 _Warning:_ in other versions of the GNU assembler, `.file' is
271 used for the directive called `.app-file' in the AMD 29K
275 This directive is ignored; it is accepted for compatibility with
276 other AMD 29K assemblers.
279 This directive is ignored; it is accepted for compatibility with
280 other AMD 29K assemblers.
283 Establishes the section and subsection for the following code;
284 SECTION NAME may be one of `.text', `.data', `.data1', or `.lit'.
285 With one of the first three SECTION NAME options, `.use' is
286 equivalent to the machine directive SECTION NAME; the remaining
287 case, `.use .lit', is the same as `.data 200'.
290 File: as.info, Node: AMD29K Opcodes, Prev: AMD29K Directives, Up: AMD29K-Dependent
295 `as' implements all the standard AMD 29K opcodes. No additional
296 pseudo-instructions are needed on this family.
298 For information on the 29K machine instruction set, see `Am29000
299 User's Manual', Advanced Micro Devices, Inc.
302 File: as.info, Node: Alpha-Dependent, Next: ARC-Dependent, Prev: AMD29K-Dependent, Up: Machine Dependencies
304 Alpha Dependent Features
305 ========================
309 * Alpha Notes:: Notes
310 * Alpha Options:: Options
311 * Alpha Syntax:: Syntax
312 * Alpha Floating Point:: Floating Point
313 * Alpha Directives:: Alpha Machine Directives
314 * Alpha Opcodes:: Opcodes
317 File: as.info, Node: Alpha Notes, Next: Alpha Options, Up: Alpha-Dependent
322 The documentation here is primarily for the ELF object format. `as'
323 also supports the ECOFF and EVAX formats, but features specific to
324 these formats are not yet documented.
327 File: as.info, Node: Alpha Options, Next: Alpha Syntax, Prev: Alpha Notes, Up: Alpha-Dependent
333 This option specifies the target processor. If an attempt is made
334 to assemble an instruction which will not execute on the target
335 processor, the assembler may either expand the instruction as a
336 macro or issue an error message. This option is equivalent to the
339 The following processor names are recognized: `21064', `21064a',
340 `21066', `21068', `21164', `21164a', `21164pc', `21264', `21264a',
341 `21264b', `ev4', `ev5', `lca45', `ev5', `ev56', `pca56', `ev6',
342 `ev67', `ev68'. The special name `all' may be used to allow the
343 assembler to accept instructions valid for any Alpha processor.
345 In order to support existing practice in OSF/1 with respect to
346 `.arch', and existing practice within `MILO' (the Linux ARC
347 bootloader), the numbered processor names (e.g. 21064) enable the
348 processor-specific PALcode instructions, while the
349 "electro-vlasic" names (e.g. `ev4') do not.
353 Enables or disables the generation of `.mdebug' encapsulation for
354 stabs directives and procedure descriptors. The default is to
355 automatically enable `.mdebug' when the first stabs directive is
359 This option forces all relocations to be put into the object file,
360 instead of saving space and resolving some relocations at assembly
361 time. Note that this option does not propagate all symbol
362 arithmetic into the object file, because not all symbol arithmetic
363 can be represented. However, the option can still be useful in
364 specific applications.
367 This option is used when the compiler generates debug information.
368 When `gcc' is using `mips-tfile' to generate debug information
369 for ECOFF, local labels must be passed through to the object file.
370 Otherwise this option has no effect.
373 A local common symbol larger than SIZE is placed in `.bss', while
374 smaller symbols are placed in `.sbss'.
378 These options are ignored for backward compatibility.
381 File: as.info, Node: Alpha Syntax, Next: Alpha Floating Point, Prev: Alpha Options, Up: Alpha-Dependent
386 The assembler syntax closely follow the Alpha Reference Manual;
387 assembler directives and general syntax closely follow the OSF/1 and
388 OpenVMS syntax, with a few differences for ELF.
392 * Alpha-Chars:: Special Characters
393 * Alpha-Regs:: Register Names
394 * Alpha-Relocs:: Relocations
397 File: as.info, Node: Alpha-Chars, Next: Alpha-Regs, Up: Alpha Syntax
402 `#' is the line comment character.
404 `;' can be used instead of a newline to separate statements.
407 File: as.info, Node: Alpha-Regs, Next: Alpha-Relocs, Prev: Alpha-Chars, Up: Alpha Syntax
412 The 32 integer registers are refered to as `$N' or `$rN'. In
413 addition, registers 15, 28, 29, and 30 may be refered to by the symbols
414 `$fp', `$at', `$gp', and `$sp' respectively.
416 The 32 floating-point registers are refered to as `$fN'.
419 File: as.info, Node: Alpha-Relocs, Prev: Alpha-Regs, Up: Alpha Syntax
424 Some of these relocations are available for ECOFF, but mostly only
425 for ELF. They are modeled after the relocation format introduced in
426 Digial Unix 4.0, but there are additions.
428 The format is `!TAG' or `!TAG!NUMBER' where TAG is the name of the
429 relocation. In some cases NUMBER is used to relate specific
432 The relocation is placed at the end of the instruction like so:
434 ldah $0,a($29) !gprelhigh
435 lda $0,a($0) !gprellow
436 ldq $1,b($29) !literal!100
437 ldl $2,0($1) !lituse_base!100
441 Used with an `ldq' instruction to load the address of a symbol
444 A sequence number N is optional, and if present is used to pair
445 `lituse' relocations with this `literal' relocation. The `lituse'
446 relocations are used by the linker to optimize the code based on
447 the final location of the symbol.
449 Note that these optimizations are dependent on the data flow of the
450 program. Therefore, if _any_ `lituse' is paired with a `literal'
451 relocation, then _all_ uses of the register set by the `literal'
452 instruction must also be marked with `lituse' relocations. This
453 is because the original `literal' instruction may be deleted or
454 transformed into another instruction.
456 Also note that there may be a one-to-many relationship between
457 `literal' and `lituse', but not a many-to-one. That is, if there
458 are two code paths that load up the same address and feed the
459 value to a single use, then the use may not use a `lituse'
463 Used with any memory format instruction (e.g. `ldl') to indicate
464 that the literal is used for an address load. The offset field of
465 the instruction must be zero. During relaxation, the code may be
466 altered to use a gp-relative load.
469 Used with a register branch format instruction (e.g. `jsr') to
470 indicate that the literal is used for a call. During relaxation,
471 the code may be altered to use a direct branch (e.g. `bsr').
474 Used with a byte mask instruction (e.g. `extbl') to indicate that
475 only the low 3 bits of the address are relevant. During
476 relaxation, the code may be altered to use an immediate instead of
480 Used with any other instruction to indicate that the original
481 address is in fact used, and the original `ldq' instruction may
482 not be altered or deleted. This is useful in conjunction with
483 `lituse_jsr' to test whether a weak symbol is defined.
485 ldq $27,foo($29) !literal!1
486 beq $27,is_undef !lituse_addr!1
487 jsr $26,($27),foo !lituse_jsr!1
490 Used with a register branch format instruction to indicate that the
491 literal is the call to `__tls_get_addr' used to compute the
492 address of the thread-local storage variable whose descriptor was
493 loaded with `!tlsgd!N'.
496 Used with a register branch format instruction to indicate that the
497 literal is the call to `__tls_get_addr' used to compute the
498 address of the base of the thread-local storage block for the
499 current module. The descriptor for the module must have been
500 loaded with `!tlsldm!N'.
503 Used with `ldah' and `lda' to load the GP from the current
504 address, a-la the `ldgp' macro. The source register for the
505 `ldah' instruction must contain the address of the `ldah'
506 instruction. There must be exactly one `lda' instruction paired
507 with the `ldah' instruction, though it may appear anywhere in the
508 instruction stream. The immediate operands must be zero.
511 ldah $29,0($26) !gpdisp!1
512 lda $29,0($29) !gpdisp!1
515 Used with an `ldah' instruction to add the high 16 bits of a
516 32-bit displacement from the GP.
519 Used with any memory format instruction to add the low 16 bits of a
520 32-bit displacement from the GP.
523 Used with any memory format instruction to add a 16-bit
524 displacement from the GP.
527 Used with any branch format instruction to skip the GP load at the
528 target address. The referenced symbol must have the same GP as the
529 source object file, and it must be declared to either not use `$27'
530 or perform a standard GP load in the first two instructions via the
531 `.prologue' directive.
535 Used with an `lda' instruction to load the address of a TLS
536 descriptor for a symbol in the GOT.
538 The sequence number N is optional, and if present it used to pair
539 the descriptor load with both the `literal' loading the address of
540 the `__tls_get_addr' function and the `lituse_tlsgd' marking the
541 call to that function.
543 For proper relaxation, both the `tlsgd', `literal' and `lituse'
544 relocations must be in the same extended basic block. That is,
545 the relocation with the lowest address must be executed first at
550 Used with an `lda' instruction to load the address of a TLS
551 descriptor for the current module in the GOT.
553 Similar in other respects to `tlsgd'.
556 Used with an `ldq' instruction to load the offset of the TLS
557 symbol within its module's thread-local storage block. Also known
558 as the dynamic thread pointer offset or dtp-relative offset.
563 Like `gprel' relocations except they compute dtp-relative offsets.
566 Used with an `ldq' instruction to load the offset of the TLS
567 symbol from the thread pointer. Also known as the tp-relative
573 Like `gprel' relocations except they compute tp-relative offsets.
576 File: as.info, Node: Alpha Floating Point, Next: Alpha Directives, Prev: Alpha Syntax, Up: Alpha-Dependent
581 The Alpha family uses both IEEE and VAX floating-point numbers.
584 File: as.info, Node: Alpha Directives, Next: Alpha Opcodes, Prev: Alpha Floating Point, Up: Alpha-Dependent
586 Alpha Assembler Directives
587 --------------------------
589 `as' for the Alpha supports many additional directives for
590 compatibility with the native assembler. This section describes them
593 These are the additional directives in `as' for the Alpha:
596 Specifies the target processor. This is equivalent to the `-mCPU'
597 command-line option. *Note Options: Alpha Options, for a list of
601 Mark the beginning of FUNCTION. An optional number may follow for
602 compatibility with the OSF/1 assembler, but is ignored. When
603 generating `.mdebug' information, this will create a procedure
604 descriptor for the function. In ELF, it will mark the symbol as a
605 function a-la the generic `.type' directive.
608 Mark the end of FUNCTION. In ELF, it will set the size of the
609 symbol a-la the generic `.size' directive.
612 Indicate which of the integer registers are saved in the current
613 function's stack frame. MASK is interpreted a bit mask in which
614 bit N set indicates that register N is saved. The registers are
615 saved in a block located OFFSET bytes from the "canonical frame
616 address" (CFA) which is the value of the stack pointer on entry to
617 the function. The registers are saved sequentially, except that
618 the return address register (normally `$26') is saved first.
620 This and the other directives that describe the stack frame are
621 currently only used when generating `.mdebug' information. They
622 may in the future be used to generate DWARF2 `.debug_frame' unwind
623 information for hand written assembly.
625 `.fmask MASK, OFFSET'
626 Indicate which of the floating-point registers are saved in the
627 current stack frame. The MASK and OFFSET parameters are
628 interpreted as with `.mask'.
630 `.frame FRAMEREG, FRAMEOFFSET, RETREG[, ARGOFFSET]'
631 Describes the shape of the stack frame. The frame pointer in use
632 is FRAMEREG; normally this is either `$fp' or `$sp'. The frame
633 pointer is FRAMEOFFSET bytes below the CFA. The return address is
634 initially located in RETREG until it is saved as indicated in
635 `.mask'. For compatibility with OSF/1 an optional ARGOFFSET
636 parameter is accepted and ignored. It is believed to indicate the
637 offset from the CFA to the saved argument registers.
640 Indicate that the stack frame is set up and all registers have been
641 spilled. The argument N indicates whether and how the function
642 uses the incoming "procedure vector" (the address of the called
643 function) in `$27'. 0 indicates that `$27' is not used; 1
644 indicates that the first two instructions of the function use `$27'
645 to perform a load of the GP register; 2 indicates that `$27' is
646 used in some non-standard way and so the linker cannot elide the
647 load of the procedure vector during relaxation.
649 `.gprel32 EXPRESSION'
650 Computes the difference between the address in EXPRESSION and the
651 GP for the current object file, and stores it in 4 bytes. In
652 addition to being smaller than a full 8 byte address, this also
653 does not require a dynamic relocation when used in a shared
656 `.t_floating EXPRESSION'
657 Stores EXPRESSION as an IEEE double precision value.
659 `.s_floating EXPRESSION'
660 Stores EXPRESSION as an IEEE single precision value.
662 `.f_floating EXPRESSION'
663 Stores EXPRESSION as a VAX F format value.
665 `.g_floating EXPRESSION'
666 Stores EXPRESSION as a VAX G format value.
668 `.d_floating EXPRESSION'
669 Stores EXPRESSION as a VAX D format value.
672 Enables or disables various assembler features. Using the positive
673 name of the feature enables while using `noFEATURE' disables.
676 Indicates that macro expansions may clobber the "assembler
677 temporary" (`$at' or `$28') register. Some macros may not be
678 expanded without this and will generate an error message if
679 `noat' is in effect. When `at' is in effect, a warning will
680 be generated if `$at' is used by the programmer.
683 Enables the expasion of macro instructions. Note that
684 variants of real instructions, such as `br label' vs `br
685 $31,label' are considered alternate forms and not macros.
690 These control whether and how the assembler may re-order
691 instructions. Accepted for compatibility with the OSF/1
692 assembler, but `as' does not do instruction scheduling, so
693 these features are ignored.
695 The following directives are recognized for compatibility with the
696 OSF/1 assembler but are ignored.
705 File: as.info, Node: Alpha Opcodes, Prev: Alpha Directives, Up: Alpha-Dependent
710 For detailed information on the Alpha machine instruction set, see
711 the Alpha Architecture Handbook
712 (ftp://ftp.digital.com/pub/Digital/info/semiconductor/literature/alphaahb.pdf).
715 File: as.info, Node: ARC-Dependent, Next: ARM-Dependent, Prev: Alpha-Dependent, Up: Machine Dependencies
717 ARC Dependent Features
718 ======================
722 * ARC Options:: Options
723 * ARC Syntax:: Syntax
724 * ARC Floating Point:: Floating Point
725 * ARC Directives:: ARC Machine Directives
726 * ARC Opcodes:: Opcodes
729 File: as.info, Node: ARC Options, Next: ARC Syntax, Up: ARC-Dependent
735 This option selects the core processor variant. Using `-marc' is
736 the same as `-marc6', which is also the default.
739 Base instruction set.
742 Jump-and-link (jl) instruction. No requirement of an
743 instruction between setting flags and conditional jump. For
750 Break (brk) and sleep (sleep) instructions.
753 Software interrupt (swi) instruction.
755 Note: the `.option' directive can to be used to select a core
756 variant from within assembly code.
759 This option specifies that the output generated by the assembler
760 should be marked as being encoded for a big-endian processor.
763 This option specifies that the output generated by the assembler
764 should be marked as being encoded for a little-endian processor -
768 File: as.info, Node: ARC Syntax, Next: ARC Floating Point, Prev: ARC Options, Up: ARC-Dependent
775 * ARC-Chars:: Special Characters
776 * ARC-Regs:: Register Names
779 File: as.info, Node: ARC-Chars, Next: ARC-Regs, Up: ARC Syntax
787 File: as.info, Node: ARC-Regs, Prev: ARC-Chars, Up: ARC Syntax
795 File: as.info, Node: ARC Floating Point, Next: ARC Directives, Prev: ARC Syntax, Up: ARC-Dependent
800 The ARC core does not currently have hardware floating point
801 support. Software floating point support is provided by `GCC' and uses
802 IEEE floating-point numbers.
805 File: as.info, Node: ARC Directives, Next: ARC Opcodes, Prev: ARC Floating Point, Up: ARC-Dependent
807 ARC Machine Directives
808 ----------------------
810 The ARC version of `as' supports the following additional machine
822 `.extAuxRegister NAME,ADDRESS,MODE'
825 .extAuxRegister mulhi,0x12,w
827 `.extCondCode SUFFIX,VALUE'
830 .extCondCode is_busy,0x14
832 `.extCoreRegister NAME,REGNUM,MODE,SHORTCUT'
835 .extCoreRegister mlo,57,r,can_shortcut
837 `.extInstruction NAME,OPCODE,SUBOPCODE,SUFFIXCLASS,SYNTAXCLASS'
840 .extInstruction mul64,0x14,0x0,SUFFIX_COND,SYNTAX_3OP|OP1_MUST_BE_IMM
848 `.option ARC|ARC5|ARC6|ARC7|ARC8'
849 The `.option' directive must be followed by the desired core
850 version. Again `arc' is an alias for `arc6'.
852 Note: the `.option' directive overrides the command line option
853 `-marc'; a warning is emitted when the version is not consistent
854 between the two - even for the implicit default core version
864 File: as.info, Node: ARC Opcodes, Prev: ARC Directives, Up: ARC-Dependent
869 For information on the ARC instruction set, see `ARC Programmers
870 Reference Manual', ARC Cores Ltd.
873 File: as.info, Node: ARM-Dependent, Next: CRIS-Dependent, Prev: ARC-Dependent, Up: Machine Dependencies
875 ARM Dependent Features
876 ======================
880 * ARM Options:: Options
881 * ARM Syntax:: Syntax
882 * ARM Floating Point:: Floating Point
883 * ARM Directives:: ARM Machine Directives
884 * ARM Opcodes:: Opcodes
887 File: as.info, Node: ARM Options, Next: ARM Syntax, Up: ARM-Dependent
892 `-mcpu=PROCESSOR[+EXTENSION...]'
893 This option specifies the target processor. The assembler will
894 issue an error message if an attempt is made to assemble an
895 instruction which will not execute on the target processor. The
896 following processor names are recognized: `arm1', `arm2', `arm250',
897 `arm3', `arm6', `arm60', `arm600', `arm610', `arm620', `arm7',
898 `arm7m', `arm7d', `arm7dm', `arm7di', `arm7dmi', `arm70', `arm700',
899 `arm700i', `arm710', `arm710t', `arm720', `arm720t', `arm740t',
900 `arm710c', `arm7100', `arm7500', `arm7500fe', `arm7t', `arm7tdmi',
901 `arm8', `arm810', `strongarm', `strongarm1', `strongarm110',
902 `strongarm1100', `strongarm1110', `arm9', `arm920', `arm920t',
903 `arm922t', `arm940t', `arm9tdmi', `arm9e', `arm946e-r0', `arm946e',
904 `arm966e-r0', `arm966e', `arm10t', `arm10e', `arm1020', `arm1020t',
905 `arm1020e', `ep9312' (ARM920 with Cirrus Maverick coprocessor),
906 `i80200' (Intel XScale processor) and `xscale'. The special name
907 `all' may be used to allow the assembler to accept instructions
908 valid for any ARM processor.
910 In addition to the basic instruction set, the assembler can be
911 told to accept various extension mnemonics that extend the
912 processor using the co-processor instruction space. For example,
913 `-mcpu=arm920+maverick' is equivalent to specifying
914 `-mcpu=ep9312'. The following extensions are currently supported:
915 `+maverick' and `+xscale'.
917 `-march=ARCHITECTURE[+EXTENSION...]'
918 This option specifies the target architecture. The assembler will
919 issue an error message if an attempt is made to assemble an
920 instruction which will not execute on the target architecture.
921 The following architecture names are recognized: `armv1', `armv2',
922 `armv2a', `armv2s', `armv3', `armv3m', `armv4', `armv4xm',
923 `armv4t', `armv4txm', `armv5', `armv5t', `armv5txm', `armv5te',
924 `armv5texp' and `xscale'. If both `-mcpu' and `-march' are
925 specified, the assembler will use the setting for `-mcpu'.
927 The architecture option can be extended with the same instruction
928 set extension options as the `-mcpu' option.
930 `-mfpu=FLOATING-POINT-FORMAT'
931 This option specifies the floating point format to assemble for.
932 The assembler will issue an error message if an attempt is made to
933 assemble an instruction which will not execute on the target
934 floating point unit. The following format options are recognized:
935 `softfpa', `fpe', `fpe2', `fpe3', `fpa', `fpa10', `fpa11',
936 `arm7500fe', `softvfp', `softvfp+vfp', `vfp', `vfp10', `vfp10-r0',
937 `vfp9', `vfpxd', `arm1020t' and `arm1020e'.
939 In addition to determining which instructions are assembled, this
940 option also affects the way in which the `.double' assembler
941 directive behaves when assembling little-endian code.
943 The default is dependent on the processor selected. For
944 Architecture 5 or later, the default is to assembler for VFP
945 instructions; for earlier architectures the default is to assemble
946 for FPA instructions.
949 This option specifies that the assembler should start assembling
950 Thumb instructions; that is, it should behave as though the file
951 starts with a `.code 16' directive.
954 This option specifies that the output generated by the assembler
955 should be marked as supporting interworking.
958 This option specifies that the output generated by the assembler
959 should be marked as supporting the indicated version of the Arm
960 Procedure. Calling Standard.
963 This option specifies that the output generated by the assembler
964 should be marked as supporting the Arm/Thumb Procedure Calling
965 Standard. If enabled this option will cause the assembler to
966 create an empty debugging section in the object file called
967 .arm.atpcs. Debuggers can use this to determine the ABI being
971 This indicates the the floating point variant of the APCS should be
972 used. In this variant floating point arguments are passed in FP
973 registers rather than integer registers.
976 This indicates that the reentrant variant of the APCS should be
977 used. This variant supports position independent code.
980 This option specifies that the output generated by the assembler
981 should be marked as being encoded for a big-endian processor.
984 This option specifies that the output generated by the assembler
985 should be marked as being encoded for a little-endian processor.
988 This option specifies that the output of the assembler should be
989 marked as position-independent code (PIC).
992 This indicates that the code should be assembled using the old ARM
993 ELF conventions, based on a beta release release of the ARM-ELF
994 specifications, rather than the default conventions which are
995 based on the final release of the ARM-ELF specifications.
998 File: as.info, Node: ARM Syntax, Next: ARM Floating Point, Prev: ARM Options, Up: ARM-Dependent
1005 * ARM-Chars:: Special Characters
1006 * ARM-Regs:: Register Names
1009 File: as.info, Node: ARM-Chars, Next: ARM-Regs, Up: ARM Syntax
1014 The presence of a `@' on a line indicates the start of a comment
1015 that extends to the end of the current line. If a `#' appears as the
1016 first character of a line, the whole line is treated as a comment.
1018 The `;' character can be used instead of a newline to separate
1021 Either `#' or `$' can be used to indicate immediate operands.
1023 *TODO* Explain about /data modifier on symbols.
1026 File: as.info, Node: ARM-Regs, Prev: ARM-Chars, Up: ARM Syntax
1031 *TODO* Explain about ARM register naming, and the predefined names.
1034 File: as.info, Node: ARM Floating Point, Next: ARM Directives, Prev: ARM Syntax, Up: ARM-Dependent
1039 The ARM family uses IEEE floating-point numbers.
1042 File: as.info, Node: ARM Directives, Next: ARM Opcodes, Prev: ARM Floating Point, Up: ARM-Dependent
1044 ARM Machine Directives
1045 ----------------------
1047 `.align EXPRESSION [, EXPRESSION]'
1048 This is the generic .ALIGN directive. For the ARM however if the
1049 first argument is zero (ie no alignment is needed) the assembler
1050 will behave as if the argument had been 2 (ie pad to the next four
1051 byte boundary). This is for compatability with ARM's own
1054 `NAME .req REGISTER NAME'
1055 This creates an alias for REGISTER NAME called NAME. For example:
1060 This directive selects the instruction set being generated. The
1061 value 16 selects Thumb, with the value 32 selecting ARM.
1064 This performs the same action as .CODE 16.
1067 This performs the same action as .CODE 32.
1070 This directive forces the selection of Thumb instructions, even if
1071 the target processor does not support those instructions
1074 This directive specifies that the following symbol is the name of a
1075 Thumb encoded function. This information is necessary in order to
1076 allow the assembler and linker to generate correct code for
1077 interworking between Arm and Thumb instructions and should be used
1078 even if interworking is not going to be performed. The presence
1079 of this directive also implies `.thumb'
1082 This performs the equivalent of a `.set' directive in that it
1083 creates a symbol which is an alias for another symbol (possibly
1084 not yet defined). This directive also has the added property in
1085 that it marks the aliased symbol as being a thumb function entry
1086 point, in the same way that the `.thumb_func' directive does.
1089 This directive causes the current contents of the literal pool to
1090 be dumped into the current section (which is assumed to be the
1091 .text section) at the current location (aligned to a word
1095 This is a synonym for .ltorg.
1098 File: as.info, Node: ARM Opcodes, Prev: ARM Directives, Up: ARM-Dependent
1103 `as' implements all the standard ARM opcodes. It also implements
1104 several pseudo opcodes, including several synthetic load instructions.
1109 This pseudo op will always evaluate to a legal ARM instruction
1110 that does nothing. Currently it will evaluate to MOV r0, r0.
1113 ldr <register> , = <expression>
1115 If expression evaluates to a numeric constant then a MOV or MVN
1116 instruction will be used in place of the LDR instruction, if the
1117 constant can be generated by either of these instructions.
1118 Otherwise the constant will be placed into the nearest literal
1119 pool (if it not already there) and a PC relative LDR instruction
1123 adr <register> <label>
1125 This instruction will load the address of LABEL into the indicated
1126 register. The instruction will evaluate to a PC relative ADD or
1127 SUB instruction depending upon where the label is located. If the
1128 label is out of range, or if it is not defined in the same file
1129 (and section) as the ADR instruction, then an error will be
1130 generated. This instruction will not make use of the literal pool.
1133 adrl <register> <label>
1135 This instruction will load the address of LABEL into the indicated
1136 register. The instruction will evaluate to one or two PC relative
1137 ADD or SUB instructions depending upon where the label is located.
1138 If a second instruction is not needed a NOP instruction will be
1139 generated in its place, so that this instruction is always 8 bytes
1142 If the label is out of range, or if it is not defined in the same
1143 file (and section) as the ADRL instruction, then an error will be
1144 generated. This instruction will not make use of the literal pool.
1146 For information on the ARM or Thumb instruction sets, see `ARM
1147 Software Development Toolkit Reference Manual', Advanced RISC Machines
1151 File: as.info, Node: CRIS-Dependent, Next: D10V-Dependent, Prev: ARM-Dependent, Up: Machine Dependencies
1153 CRIS Dependent Features
1154 =======================
1158 * CRIS-Opts:: Command-line Options
1159 * CRIS-Expand:: Instruction expansion
1160 * CRIS-Syntax:: Syntax
1163 File: as.info, Node: CRIS-Opts, Next: CRIS-Expand, Up: CRIS-Dependent
1165 Command-line Options
1166 --------------------
1168 The CRIS version of `as' has these machine-dependent command-line
1171 The format of the generated object files can be either ELF or a.out,
1172 specified by the command-line options `--emulation=crisaout' and
1173 `--emulation=criself'. The default is ELF (criself), unless `as' has
1174 been configured specifically for a.out by using the configuration name
1177 There are two different link-incompatible ELF object file variants
1178 for CRIS, for use in environments where symbols are expected to be
1179 prefixed by a leading `_' character and for environments without such a
1180 symbol prefix. The variant used for GNU/Linux port has no symbol
1181 prefix. Which variant to produce is specified by either of the options
1182 `--underscore' and `--no-underscore'. The default is `--underscore'.
1183 Since symbols in CRIS a.out objects are expected to have a `_' prefix,
1184 specifying `--no-underscore' when generating a.out objects is an error.
1185 Besides the object format difference, the effect of this option is to
1186 parse register names differently (*note crisnous::). The
1187 `--no-underscore' option makes a `$' register prefix mandatory.
1189 The option `--pic' must be passed to `as' in order to recognize the
1190 symbol syntax used for ELF (SVR4 PIC) position-independent-code (*note
1191 crispic::). This will also affect expansion of instructions. The
1192 expansion with `--pic' will use PC-relative rather than (slightly
1193 faster) absolute addresses in those expansions.
1195 When `-N' is specified, `as' will emit a warning when a 16-bit
1196 branch instruction is expanded into a 32-bit multiple-instruction
1197 construct (*note CRIS-Expand::).
1200 File: as.info, Node: CRIS-Expand, Next: CRIS-Syntax, Prev: CRIS-Opts, Up: CRIS-Dependent
1202 Instruction expansion
1203 ---------------------
1205 `as' will silently choose an instruction that fits the operand size
1206 for `[register+constant]' operands. For example, the offset `127' in
1207 `move.d [r3+127],r4' fits in an instruction using a signed-byte offset.
1208 Similarly, `move.d [r2+32767],r1' will generate an instruction using a
1209 16-bit offset. For symbolic expressions and constants that do not fit
1210 in 16 bits including the sign bit, a 32-bit offset is generated.
1212 For branches, `as' will expand from a 16-bit branch instruction into
1213 a sequence of instructions that can reach a full 32-bit address. Since
1214 this does not correspond to a single instruction, such expansions can
1215 optionally be warned about. *Note CRIS-Opts::.
1218 File: as.info, Node: CRIS-Syntax, Prev: CRIS-Expand, Up: CRIS-Dependent
1223 There are different aspects of the CRIS assembly syntax.
1227 * CRIS-Chars:: Special Characters
1228 * CRIS-Pic:: Position-Independent Code Symbols
1229 * CRIS-Regs:: Register Names
1230 * CRIS-Pseudos:: Assembler Directives
1233 File: as.info, Node: CRIS-Chars, Next: CRIS-Pic, Up: CRIS-Syntax
1238 The character `#' is a line comment character. It starts a comment
1239 if and only if it is placed at the beginning of a line.
1241 A `;' character starts a comment anywhere on the line, causing all
1242 characters up to the end of the line to be ignored.
1244 A `@' character is handled as a line separator equivalent to a
1245 logical new-line character (except in a comment), so separate
1246 instructions can be specified on a single line.
1249 File: as.info, Node: CRIS-Pic, Next: CRIS-Regs, Prev: CRIS-Chars, Up: CRIS-Syntax
1251 Symbols in position-independent code
1252 ....................................
1254 When generating position-independent code (SVR4 PIC) for use in
1255 cris-axis-linux-gnu shared libraries, symbol suffixes are used to
1256 specify what kind of run-time symbol lookup will be used, expressed in
1257 the object as different _relocation types_. Usually, all absolute
1258 symbol values must be located in a table, the _global offset table_,
1259 leaving the code position-independent; independent of values of global
1260 symbols and independent of the address of the code. The suffix
1261 modifies the value of the symbol, into for example an index into the
1262 global offset table where the real symbol value is entered, or a
1263 PC-relative value, or a value relative to the start of the global
1264 offset table. All symbol suffixes start with the character `:'
1265 (omitted in the list below). Every symbol use in code or a read-only
1266 section must therefore have a PIC suffix to enable a useful shared
1267 library to be created. Usually, these constructs must not be used with
1268 an additive constant offset as is usually allowed, i.e. no 4 as in
1269 `symbol + 4' is allowed. This restriction is checked at link-time, not
1273 Attaching this suffix to a symbol in an instruction causes the
1274 symbol to be entered into the global offset table. The value is a
1275 32-bit index for that symbol into the global offset table. The
1276 name of the corresponding relocation is `R_CRIS_32_GOT'. Example:
1277 `move.d [$r0+extsym:GOT],$r9'
1280 Same as for `GOT', but the value is a 16-bit index into the global
1281 offset table. The corresponding relocation is `R_CRIS_16_GOT'.
1282 Example: `move.d [$r0+asymbol:GOT16],$r10'
1285 This suffix is used for function symbols. It causes a _procedure
1286 linkage table_, an array of code stubs, to be created at the time
1287 the shared object is created or linked against, together with a
1288 global offset table entry. The value is a pc-relative offset to
1289 the corresponding stub code in the procedure linkage table. This
1290 arrangement causes the run-time symbol resolver to be called to
1291 look up and set the value of the symbol the first time the
1292 function is called (at latest; depending environment variables).
1293 It is only safe to leave the symbol unresolved this way if all
1294 references are function calls. The name of the relocation is
1295 `R_CRIS_32_PLT_PCREL'. Example: `add.d fnname:PLT,$pc'
1298 Like PLT, but the value is relative to the beginning of the global
1299 offset table. The relocation is `R_CRIS_32_PLT_GOTREL'. Example:
1300 `move.d fnname:PLTG,$r3'
1303 Similar to `PLT', but the value of the symbol is a 32-bit index
1304 into the global offset table. This is somewhat of a mix between
1305 the effect of the `GOT' and the `PLT' suffix; the difference to
1306 `GOT' is that there will be a procedure linkage table entry
1307 created, and that the symbol is assumed to be a function entry and
1308 will be resolved by the run-time resolver as with `PLT'. The
1309 relocation is `R_CRIS_32_GOTPLT'. Example: `jsr
1310 [$r0+fnname:GOTPLT]'
1313 A variant of `GOTPLT' giving a 16-bit value. Its relocation name
1314 is `R_CRIS_16_GOTPLT'. Example: `jsr [$r0+fnname:GOTPLT16]'
1317 This suffix must only be attached to a local symbol, but may be
1318 used in an expression adding an offset. The value is the address
1319 of the symbol relative to the start of the global offset table.
1320 The relocation name is `R_CRIS_32_GOTREL'. Example: `move.d
1321 [$r0+localsym:GOTOFF],r3'
1324 File: as.info, Node: CRIS-Regs, Next: CRIS-Pseudos, Prev: CRIS-Pic, Up: CRIS-Syntax
1329 A `$' character may always prefix a general or special register name
1330 in an instruction operand but is mandatory when the option
1331 `--no-underscore' is specified or when the `.syntax register_prefix'
1332 directive is in effect (*note crisnous::). Register names are
1336 File: as.info, Node: CRIS-Pseudos, Prev: CRIS-Regs, Up: CRIS-Syntax
1338 Assembler Directives
1339 ....................
1341 There are a few CRIS-specific pseudo-directives in addition to the
1342 generic ones. *Note Pseudo Ops::. Constants emitted by
1343 pseudo-directives are in little-endian order for CRIS. There is no
1344 support for floating-point-specific directives for CRIS.
1346 `.dword EXPRESSIONS'
1347 The `.dword' directive is a synonym for `.int', expecting zero or
1348 more EXPRESSIONS, separated by commas. For each expression, a
1349 32-bit little-endian constant is emitted.
1352 The `.syntax' directive takes as ARGUMENT one of the following
1353 case-sensitive choices.
1355 `no_register_prefix'
1356 The `.syntax no_register_prefix' directive makes a `$'
1357 character prefix on all registers optional. It overrides a
1358 previous setting, including the corresponding effect of the
1359 option `--no-underscore'. If this directive is used when
1360 ordinary symbols do not have a `_' character prefix, care
1361 must be taken to avoid ambiguities whether an operand is a
1362 register or a symbol; using symbols with names the same as
1363 general or special registers then invoke undefined behavior.
1366 This directive makes a `$' character prefix on all registers
1367 mandatory. It overrides a previous setting, including the
1368 corresponding effect of the option `--underscore'.
1370 `leading_underscore'
1371 This is an assertion directive, emitting an error if the
1372 `--no-underscore' option is in effect.
1374 `no_leading_underscore'
1375 This is the opposite of the `.syntax leading_underscore'
1376 directive and emits an error if the option `--underscore' is
1380 File: as.info, Node: D10V-Dependent, Next: D30V-Dependent, Prev: CRIS-Dependent, Up: Machine Dependencies
1382 D10V Dependent Features
1383 =======================
1387 * D10V-Opts:: D10V Options
1388 * D10V-Syntax:: Syntax
1389 * D10V-Float:: Floating Point
1390 * D10V-Opcodes:: Opcodes
1393 File: as.info, Node: D10V-Opts, Next: D10V-Syntax, Up: D10V-Dependent
1398 The Mitsubishi D10V version of `as' has a few machine dependent
1402 The D10V can often execute two sub-instructions in parallel. When
1403 this option is used, `as' will attempt to optimize its output by
1404 detecting when instructions can be executed in parallel.
1407 To optimize execution performance, `as' will sometimes swap the
1408 order of instructions. Normally this generates a warning. When
1409 this option is used, no warning will be generated when
1410 instructions are swapped.
1414 `--no-gstabs-packing'
1415 `as' packs adjacent short instructions into a single packed
1416 instruction. `--no-gstabs-packing' turns instruction packing off if
1417 `--gstabs' is specified as well; `--gstabs-packing' (the default)
1418 turns instruction packing on even when `--gstabs' is specified.