2016-01-01 11:25:12 +00:00
|
|
|
@c Copyright (C) 2009-2016 Free Software Foundation, Inc.
|
2012-08-13 14:52:54 +00:00
|
|
|
@c Contributed by ARM Ltd.
|
|
|
|
@c This is part of the GAS manual.
|
|
|
|
@c For copying conditions, see the file as.texinfo.
|
|
|
|
@c man end
|
|
|
|
|
|
|
|
@ifset GENERIC
|
|
|
|
@page
|
|
|
|
@node AArch64-Dependent
|
|
|
|
@chapter AArch64 Dependent Features
|
|
|
|
@end ifset
|
|
|
|
|
|
|
|
@ifclear GENERIC
|
|
|
|
@node Machine Dependencies
|
|
|
|
@chapter AArch64 Dependent Features
|
|
|
|
@end ifclear
|
|
|
|
|
|
|
|
@cindex AArch64 support
|
|
|
|
@menu
|
|
|
|
* AArch64 Options:: Options
|
2014-03-13 17:10:04 +00:00
|
|
|
* AArch64 Extensions:: Extensions
|
2012-08-13 14:52:54 +00:00
|
|
|
* AArch64 Syntax:: Syntax
|
|
|
|
* AArch64 Floating Point:: Floating Point
|
|
|
|
* AArch64 Directives:: AArch64 Machine Directives
|
|
|
|
* AArch64 Opcodes:: Opcodes
|
|
|
|
* AArch64 Mapping Symbols:: Mapping Symbols
|
|
|
|
@end menu
|
|
|
|
|
|
|
|
@node AArch64 Options
|
|
|
|
@section Options
|
|
|
|
@cindex AArch64 options (none)
|
|
|
|
@cindex options for AArch64 (none)
|
|
|
|
|
|
|
|
@c man begin OPTIONS
|
|
|
|
@table @gcctabopt
|
|
|
|
|
2014-03-13 17:10:04 +00:00
|
|
|
@cindex @option{-EB} command line option, AArch64
|
2012-08-13 14:52:54 +00:00
|
|
|
@item -EB
|
|
|
|
This option specifies that the output generated by the assembler should
|
|
|
|
be marked as being encoded for a big-endian processor.
|
|
|
|
|
2014-03-13 17:10:04 +00:00
|
|
|
@cindex @option{-EL} command line option, AArch64
|
2012-08-13 14:52:54 +00:00
|
|
|
@item -EL
|
|
|
|
This option specifies that the output generated by the assembler should
|
|
|
|
be marked as being encoded for a little-endian processor.
|
|
|
|
|
2014-03-13 17:10:04 +00:00
|
|
|
@cindex @option{-mabi=} command line option, AArch64
|
2013-07-19 16:25:54 +00:00
|
|
|
@item -mabi=@var{abi}
|
|
|
|
Specify which ABI the source code uses. The recognized arguments
|
|
|
|
are: @code{ilp32} and @code{lp64}, which decides the generated object
|
|
|
|
file in ELF32 and ELF64 format respectively. The default is @code{lp64}.
|
|
|
|
|
2014-03-13 17:10:04 +00:00
|
|
|
@cindex @option{-mcpu=} command line option, AArch64
|
|
|
|
@item -mcpu=@var{processor}[+@var{extension}@dots{}]
|
|
|
|
This option specifies the target processor. The assembler will issue an error
|
|
|
|
message if an attempt is made to assemble an instruction which will not execute
|
|
|
|
on the target processor. The following processor names are recognized:
|
2015-11-12 12:04:22 +00:00
|
|
|
@code{cortex-a35},
|
2014-03-13 17:10:04 +00:00
|
|
|
@code{cortex-a53},
|
|
|
|
@code{cortex-a57},
|
2015-02-04 19:17:12 +00:00
|
|
|
@code{cortex-a72},
|
2015-03-26 20:18:08 +00:00
|
|
|
@code{exynos-m1},
|
2015-11-10 17:19:45 +00:00
|
|
|
@code{qdf24xx},
|
2014-10-20 18:39:49 +00:00
|
|
|
@code{thunderx},
|
2014-11-18 11:24:14 +00:00
|
|
|
@code{xgene1}
|
2014-03-13 17:10:04 +00:00
|
|
|
and
|
2014-11-18 11:24:14 +00:00
|
|
|
@code{xgene2}.
|
2014-03-13 17:10:04 +00:00
|
|
|
The special name @code{all} may be used to allow the assembler to accept
|
|
|
|
instructions valid for any supported processor, including all optional
|
|
|
|
extensions.
|
|
|
|
|
|
|
|
In addition to the basic instruction set, the assembler can be told to
|
|
|
|
accept, or restrict, various extension mnemonics that extend the
|
|
|
|
processor. @xref{AArch64 Extensions}.
|
|
|
|
|
|
|
|
If some implementations of a particular processor can have an
|
|
|
|
extension, then then those extensions are automatically enabled.
|
|
|
|
Consequently, you will not normally have to specify any additional
|
|
|
|
extensions.
|
|
|
|
|
|
|
|
@cindex @option{-march=} command line option, AArch64
|
|
|
|
@item -march=@var{architecture}[+@var{extension}@dots{}]
|
|
|
|
This option specifies the target architecture. The assembler will
|
|
|
|
issue an error message if an attempt is made to assemble an
|
|
|
|
instruction which will not execute on the target architecture. The
|
2015-11-19 09:12:49 +00:00
|
|
|
following architecture names are recognized: @code{armv8-a},
|
|
|
|
@code{armv8.1-a} and @code{armv8.2-a}.
|
2014-03-13 17:10:04 +00:00
|
|
|
|
|
|
|
If both @option{-mcpu} and @option{-march} are specified, the
|
|
|
|
assembler will use the setting for @option{-mcpu}. If neither are
|
|
|
|
specified, the assembler will default to @option{-mcpu=all}.
|
|
|
|
|
|
|
|
The architecture option can be extended with the same instruction set
|
|
|
|
extension options as the @option{-mcpu} option. Unlike
|
|
|
|
@option{-mcpu}, extensions are not always enabled by default,
|
|
|
|
@xref{AArch64 Extensions}.
|
|
|
|
|
2014-03-18 17:41:43 +00:00
|
|
|
@cindex @code{-mverbose-error} command line option, AArch64
|
|
|
|
@item -mverbose-error
|
|
|
|
This option enables verbose error messages for AArch64 gas. This option
|
|
|
|
is enabled by default.
|
|
|
|
|
|
|
|
@cindex @code{-mno-verbose-error} command line option, AArch64
|
|
|
|
@item -mno-verbose-error
|
|
|
|
This option disables verbose error messages in AArch64 gas.
|
|
|
|
|
2012-08-13 14:52:54 +00:00
|
|
|
@end table
|
|
|
|
@c man end
|
|
|
|
|
2014-03-13 17:10:04 +00:00
|
|
|
@node AArch64 Extensions
|
|
|
|
@section Architecture Extensions
|
|
|
|
|
|
|
|
The table below lists the permitted architecture extensions that are
|
|
|
|
supported by the assembler and the conditions under which they are
|
|
|
|
automatically enabled.
|
|
|
|
|
|
|
|
Multiple extensions may be specified, separated by a @code{+}.
|
|
|
|
Extension mnemonics may also be removed from those the assembler
|
|
|
|
accepts. This is done by prepending @code{no} to the option that adds
|
|
|
|
the extension. Extensions that are removed must be listed after all
|
|
|
|
extensions that have been added.
|
|
|
|
|
|
|
|
Enabling an extension that requires other extensions will
|
|
|
|
automatically cause those extensions to be enabled. Similarly,
|
|
|
|
disabling an extension that is required by other extensions will
|
|
|
|
automatically cause those extensions to be disabled.
|
|
|
|
|
|
|
|
@multitable @columnfractions .12 .17 .17 .54
|
|
|
|
@headitem Extension @tab Minimum Architecture @tab Enabled by default
|
|
|
|
@tab Description
|
2015-12-10 13:58:21 +00:00
|
|
|
@item @code{crc} @tab ARMv8-A @tab ARMv8.1-A or later
|
2014-03-13 17:10:04 +00:00
|
|
|
@tab Enable CRC instructions.
|
|
|
|
@item @code{crypto} @tab ARMv8-A @tab No
|
|
|
|
@tab Enable cryptographic extensions. This implies @code{fp} and @code{simd}.
|
|
|
|
@item @code{fp} @tab ARMv8-A @tab ARMv8-A or later
|
|
|
|
@tab Enable floating-point extensions.
|
|
|
|
@item @code{simd} @tab ARMv8-A @tab ARMv8-A or later
|
|
|
|
@tab Enable Advanced SIMD extensions. This implies @code{fp}.
|
2015-06-01 15:05:58 +00:00
|
|
|
@item @code{pan} @tab ARMv8-A @tab ARMv8-A or later
|
|
|
|
@tab Enable Privileged Access Never support.
|
2015-06-02 10:29:15 +00:00
|
|
|
@item @code{lor} @tab ARMv8-A @tab ARMv8-A or later
|
|
|
|
@tab Enable Limited Ordering Regions extensions.
|
2015-06-02 11:20:00 +00:00
|
|
|
@item @code{rdma} @tab ARMv8-A @tab ARMv8-A or later
|
|
|
|
@tab Enable ARMv8.1 Advanced SIMD extensions. This implies @code{simd}.
|
2015-11-27 13:19:50 +00:00
|
|
|
@item @code{fp16} @tab ARMv8.2-A @tab ARMv8.2-A or later
|
|
|
|
@tab Enable ARMv8.2 16-bit floating-point support. This implies
|
|
|
|
@code{fp}.
|
2015-12-11 09:30:26 +00:00
|
|
|
@item @code{profile} @tab ARMv8.2-A @tab No
|
|
|
|
@tab Enable statistical profiling extensions.
|
2014-03-13 17:10:04 +00:00
|
|
|
@end multitable
|
|
|
|
|
2012-08-13 14:52:54 +00:00
|
|
|
@node AArch64 Syntax
|
|
|
|
@section Syntax
|
|
|
|
@menu
|
|
|
|
* AArch64-Chars:: Special Characters
|
|
|
|
* AArch64-Regs:: Register Names
|
|
|
|
* AArch64-Relocations:: Relocations
|
|
|
|
@end menu
|
|
|
|
|
|
|
|
@node AArch64-Chars
|
|
|
|
@subsection Special Characters
|
|
|
|
|
|
|
|
@cindex line comment character, AArch64
|
|
|
|
@cindex AArch64 line comment character
|
|
|
|
The presence of a @samp{//} on a line indicates the start of a comment
|
|
|
|
that extends to the end of the current line. If a @samp{#} appears as
|
|
|
|
the first character of a line, the whole line is treated as a comment.
|
|
|
|
|
|
|
|
@cindex line separator, AArch64
|
|
|
|
@cindex statement separator, AArch64
|
|
|
|
@cindex AArch64 line separator
|
|
|
|
The @samp{;} character can be used instead of a newline to separate
|
|
|
|
statements.
|
|
|
|
|
|
|
|
@cindex immediate character, AArch64
|
|
|
|
@cindex AArch64 immediate character
|
|
|
|
The @samp{#} can be optionally used to indicate immediate operands.
|
|
|
|
|
|
|
|
@node AArch64-Regs
|
|
|
|
@subsection Register Names
|
|
|
|
|
|
|
|
@cindex AArch64 register names
|
|
|
|
@cindex register names, AArch64
|
|
|
|
Please refer to the section @samp{4.4 Register Names} of
|
|
|
|
@samp{ARMv8 Instruction Set Overview}, which is available at
|
|
|
|
@uref{http://infocenter.arm.com}.
|
|
|
|
|
|
|
|
@node AArch64-Relocations
|
|
|
|
@subsection Relocations
|
|
|
|
|
|
|
|
@cindex relocations, AArch64
|
|
|
|
@cindex AArch64 relocations
|
|
|
|
@cindex MOVN, MOVZ and MOVK group relocations, AArch64
|
|
|
|
Relocations for @samp{MOVZ} and @samp{MOVK} instructions can be generated
|
|
|
|
by prefixing the label with @samp{#:abs_g2:} etc.
|
|
|
|
For example to load the 48-bit absolute address of @var{foo} into x0:
|
|
|
|
|
|
|
|
@smallexample
|
|
|
|
movz x0, #:abs_g2:foo // bits 32-47, overflow check
|
|
|
|
movk x0, #:abs_g1_nc:foo // bits 16-31, no overflow check
|
|
|
|
movk x0, #:abs_g0_nc:foo // bits 0-15, no overflow check
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
@cindex ADRP, ADD, LDR/STR group relocations, AArch64
|
|
|
|
Relocations for @samp{ADRP}, and @samp{ADD}, @samp{LDR} or @samp{STR}
|
|
|
|
instructions can be generated by prefixing the label with
|
2014-06-06 06:29:19 +00:00
|
|
|
@samp{:pg_hi21:} and @samp{#:lo12:} respectively.
|
2012-08-13 14:52:54 +00:00
|
|
|
|
2013-01-10 19:51:55 +00:00
|
|
|
For example to use 33-bit (+/-4GB) pc-relative addressing to
|
2012-08-13 14:52:54 +00:00
|
|
|
load the address of @var{foo} into x0:
|
|
|
|
|
|
|
|
@smallexample
|
2014-06-06 06:29:19 +00:00
|
|
|
adrp x0, :pg_hi21:foo
|
2012-08-13 14:52:54 +00:00
|
|
|
add x0, x0, #:lo12:foo
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
Or to load the value of @var{foo} into x0:
|
|
|
|
|
|
|
|
@smallexample
|
2014-06-06 06:29:19 +00:00
|
|
|
adrp x0, :pg_hi21:foo
|
2012-08-13 14:52:54 +00:00
|
|
|
ldr x0, [x0, #:lo12:foo]
|
|
|
|
@end smallexample
|
|
|
|
|
2014-06-06 06:29:19 +00:00
|
|
|
Note that @samp{:pg_hi21:} is optional.
|
2012-08-13 14:52:54 +00:00
|
|
|
|
|
|
|
@smallexample
|
|
|
|
adrp x0, foo
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
is equivalent to
|
|
|
|
|
|
|
|
@smallexample
|
2014-06-06 06:29:19 +00:00
|
|
|
adrp x0, :pg_hi21:foo
|
2012-08-13 14:52:54 +00:00
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
@node AArch64 Floating Point
|
|
|
|
@section Floating Point
|
|
|
|
|
|
|
|
@cindex floating point, AArch64 (@sc{ieee})
|
|
|
|
@cindex AArch64 floating point (@sc{ieee})
|
|
|
|
The AArch64 architecture uses @sc{ieee} floating-point numbers.
|
|
|
|
|
|
|
|
@node AArch64 Directives
|
|
|
|
@section AArch64 Machine Directives
|
|
|
|
|
|
|
|
@cindex machine directives, AArch64
|
|
|
|
@cindex AArch64 machine directives
|
|
|
|
@table @code
|
|
|
|
|
|
|
|
@c AAAAAAAAAAAAAAAAAAAAAAAAA
|
2015-02-03 14:02:24 +00:00
|
|
|
|
|
|
|
@cindex @code{.arch} directive, AArch64
|
|
|
|
@item .arch @var{name}
|
|
|
|
Select the target architecture. Valid values for @var{name} are the same as
|
|
|
|
for the @option{-march} commandline option.
|
|
|
|
|
|
|
|
Specifying @code{.arch} clears any previously selected architecture
|
|
|
|
extensions.
|
|
|
|
|
|
|
|
@cindex @code{.arch_extension} directive, AArch64
|
|
|
|
@item .arch_extension @var{name}
|
|
|
|
Add or remove an architecture extension to the target architecture. Valid
|
|
|
|
values for @var{name} are the same as those accepted as architectural
|
|
|
|
extensions by the @option{-mcpu} commandline option.
|
|
|
|
|
|
|
|
@code{.arch_extension} may be used multiple times to add or remove extensions
|
|
|
|
incrementally to the architecture being compiled for.
|
|
|
|
|
2012-08-13 14:52:54 +00:00
|
|
|
@c BBBBBBBBBBBBBBBBBBBBBBBBBB
|
|
|
|
|
|
|
|
@cindex @code{.bss} directive, AArch64
|
|
|
|
@item .bss
|
|
|
|
This directive switches to the @code{.bss} section.
|
|
|
|
|
|
|
|
@c CCCCCCCCCCCCCCCCCCCCCCCCCC
|
|
|
|
@c DDDDDDDDDDDDDDDDDDDDDDDDDD
|
|
|
|
@c EEEEEEEEEEEEEEEEEEEEEEEEEE
|
|
|
|
@c FFFFFFFFFFFFFFFFFFFFFFFFFF
|
|
|
|
@c GGGGGGGGGGGGGGGGGGGGGGGGGG
|
|
|
|
@c HHHHHHHHHHHHHHHHHHHHHHHHHH
|
|
|
|
@c IIIIIIIIIIIIIIIIIIIIIIIIII
|
|
|
|
@c JJJJJJJJJJJJJJJJJJJJJJJJJJ
|
|
|
|
@c KKKKKKKKKKKKKKKKKKKKKKKKKK
|
|
|
|
@c LLLLLLLLLLLLLLLLLLLLLLLLLL
|
|
|
|
|
|
|
|
@cindex @code{.ltorg} directive, AArch64
|
|
|
|
@item .ltorg
|
|
|
|
This directive causes the current contents of the literal pool to be
|
|
|
|
dumped into the current section (which is assumed to be the .text
|
|
|
|
section) at the current location (aligned to a word boundary).
|
2014-03-13 17:10:04 +00:00
|
|
|
GAS maintains a separate literal pool for each section and each
|
2012-08-13 14:52:54 +00:00
|
|
|
sub-section. The @code{.ltorg} directive will only affect the literal
|
|
|
|
pool of the current section and sub-section. At the end of assembly
|
|
|
|
all remaining, un-empty literal pools will automatically be dumped.
|
|
|
|
|
2014-03-13 17:10:04 +00:00
|
|
|
Note - older versions of GAS would dump the current literal
|
2012-08-13 14:52:54 +00:00
|
|
|
pool any time a section change occurred. This is no longer done, since
|
|
|
|
it prevents accurate control of the placement of literal pools.
|
|
|
|
|
|
|
|
@c MMMMMMMMMMMMMMMMMMMMMMMMMM
|
|
|
|
|
|
|
|
@c NNNNNNNNNNNNNNNNNNNNNNNNNN
|
|
|
|
@c OOOOOOOOOOOOOOOOOOOOOOOOOO
|
|
|
|
|
|
|
|
@c PPPPPPPPPPPPPPPPPPPPPPPPPP
|
|
|
|
|
|
|
|
@cindex @code{.pool} directive, AArch64
|
|
|
|
@item .pool
|
|
|
|
This is a synonym for .ltorg.
|
|
|
|
|
|
|
|
@c QQQQQQQQQQQQQQQQQQQQQQQQQQ
|
|
|
|
@c RRRRRRRRRRRRRRRRRRRRRRRRRR
|
|
|
|
|
|
|
|
@cindex @code{.req} directive, AArch64
|
|
|
|
@item @var{name} .req @var{register name}
|
|
|
|
This creates an alias for @var{register name} called @var{name}. For
|
|
|
|
example:
|
|
|
|
|
|
|
|
@smallexample
|
|
|
|
foo .req w0
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
@c SSSSSSSSSSSSSSSSSSSSSSSSSS
|
|
|
|
|
|
|
|
@c TTTTTTTTTTTTTTTTTTTTTTTTTT
|
|
|
|
|
|
|
|
@c UUUUUUUUUUUUUUUUUUUUUUUUUU
|
|
|
|
|
|
|
|
@cindex @code{.unreq} directive, AArch64
|
|
|
|
@item .unreq @var{alias-name}
|
|
|
|
This undefines a register alias which was previously defined using the
|
|
|
|
@code{req} directive. For example:
|
|
|
|
|
|
|
|
@smallexample
|
|
|
|
foo .req w0
|
|
|
|
.unreq foo
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
An error occurs if the name is undefined. Note - this pseudo op can
|
|
|
|
be used to delete builtin in register name aliases (eg 'w0'). This
|
|
|
|
should only be done if it is really necessary.
|
|
|
|
|
|
|
|
@c VVVVVVVVVVVVVVVVVVVVVVVVVV
|
|
|
|
|
|
|
|
@c WWWWWWWWWWWWWWWWWWWWWWWWWW
|
|
|
|
@c XXXXXXXXXXXXXXXXXXXXXXXXXX
|
|
|
|
@c YYYYYYYYYYYYYYYYYYYYYYYYYY
|
|
|
|
@c ZZZZZZZZZZZZZZZZZZZZZZZZZZ
|
|
|
|
|
2015-07-16 09:51:04 +00:00
|
|
|
@cindex @code{.xword} directive, AArch64
|
|
|
|
@item .xword
|
|
|
|
The @code{.xword} directive produces 64 bit values.
|
|
|
|
|
2012-08-13 14:52:54 +00:00
|
|
|
@end table
|
|
|
|
|
|
|
|
@node AArch64 Opcodes
|
|
|
|
@section Opcodes
|
|
|
|
|
|
|
|
@cindex AArch64 opcodes
|
|
|
|
@cindex opcodes for AArch64
|
2014-03-13 17:10:04 +00:00
|
|
|
GAS implements all the standard AArch64 opcodes. It also
|
2012-08-13 14:52:54 +00:00
|
|
|
implements several pseudo opcodes, including several synthetic load
|
2013-01-10 19:51:55 +00:00
|
|
|
instructions.
|
2012-08-13 14:52:54 +00:00
|
|
|
|
|
|
|
@table @code
|
|
|
|
|
|
|
|
@cindex @code{LDR reg,=<expr>} pseudo op, AArch64
|
|
|
|
@item LDR =
|
|
|
|
@smallexample
|
|
|
|
ldr <register> , =<expression>
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
The constant expression will be placed into the nearest literal pool (if it not
|
|
|
|
already there) and a PC-relative LDR instruction will be generated.
|
|
|
|
|
|
|
|
@end table
|
|
|
|
|
|
|
|
For more information on the AArch64 instruction set and assembly language
|
|
|
|
notation, see @samp{ARMv8 Instruction Set Overview} available at
|
|
|
|
@uref{http://infocenter.arm.com}.
|
|
|
|
|
|
|
|
|
|
|
|
@node AArch64 Mapping Symbols
|
|
|
|
@section Mapping Symbols
|
|
|
|
|
|
|
|
The AArch64 ELF specification requires that special symbols be inserted
|
|
|
|
into object files to mark certain features:
|
|
|
|
|
|
|
|
@table @code
|
|
|
|
|
|
|
|
@cindex @code{$x}
|
|
|
|
@item $x
|
|
|
|
At the start of a region of code containing AArch64 instructions.
|
|
|
|
|
|
|
|
@cindex @code{$d}
|
|
|
|
@item $d
|
|
|
|
At the start of a region of data.
|
|
|
|
|
|
|
|
@end table
|