]>
Commit | Line | Data |
---|---|---|
2571583a | 1 | @c Copyright (C) 2009-2017 Free Software Foundation, Inc. |
a06ea964 NC |
2 | @c Contributed by ARM Ltd. |
3 | @c This is part of the GAS manual. | |
4 | @c For copying conditions, see the file as.texinfo. | |
5 | @c man end | |
6 | ||
7 | @ifset GENERIC | |
8 | @page | |
9 | @node AArch64-Dependent | |
10 | @chapter AArch64 Dependent Features | |
11 | @end ifset | |
12 | ||
13 | @ifclear GENERIC | |
14 | @node Machine Dependencies | |
15 | @chapter AArch64 Dependent Features | |
16 | @end ifclear | |
17 | ||
18 | @cindex AArch64 support | |
a06ea964 NC |
19 | @menu |
20 | * AArch64 Options:: Options | |
df359aa7 | 21 | * AArch64 Extensions:: Extensions |
a06ea964 NC |
22 | * AArch64 Syntax:: Syntax |
23 | * AArch64 Floating Point:: Floating Point | |
24 | * AArch64 Directives:: AArch64 Machine Directives | |
25 | * AArch64 Opcodes:: Opcodes | |
26 | * AArch64 Mapping Symbols:: Mapping Symbols | |
27 | @end menu | |
28 | ||
29 | @node AArch64 Options | |
30 | @section Options | |
31 | @cindex AArch64 options (none) | |
32 | @cindex options for AArch64 (none) | |
33 | ||
34 | @c man begin OPTIONS | |
35 | @table @gcctabopt | |
36 | ||
df359aa7 | 37 | @cindex @option{-EB} command line option, AArch64 |
a06ea964 NC |
38 | @item -EB |
39 | This option specifies that the output generated by the assembler should | |
40 | be marked as being encoded for a big-endian processor. | |
41 | ||
df359aa7 | 42 | @cindex @option{-EL} command line option, AArch64 |
a06ea964 NC |
43 | @item -EL |
44 | This option specifies that the output generated by the assembler should | |
45 | be marked as being encoded for a little-endian processor. | |
46 | ||
df359aa7 | 47 | @cindex @option{-mabi=} command line option, AArch64 |
69091a2c YZ |
48 | @item -mabi=@var{abi} |
49 | Specify which ABI the source code uses. The recognized arguments | |
50 | are: @code{ilp32} and @code{lp64}, which decides the generated object | |
51 | file in ELF32 and ELF64 format respectively. The default is @code{lp64}. | |
52 | ||
df359aa7 RE |
53 | @cindex @option{-mcpu=} command line option, AArch64 |
54 | @item -mcpu=@var{processor}[+@var{extension}@dots{}] | |
55 | This option specifies the target processor. The assembler will issue an error | |
56 | message if an attempt is made to assemble an instruction which will not execute | |
57 | on the target processor. The following processor names are recognized: | |
9c352f1c | 58 | @code{cortex-a35}, |
df359aa7 | 59 | @code{cortex-a53}, |
1e292627 | 60 | @code{cortex-a55}, |
df359aa7 | 61 | @code{cortex-a57}, |
2abdd192 | 62 | @code{cortex-a72}, |
1aa70332 | 63 | @code{cortex-a73}, |
1e292627 | 64 | @code{cortex-a75}, |
2412d878 | 65 | @code{exynos-m1}, |
2fe9c2a0 | 66 | @code{falkor}, |
6b21c2bf | 67 | @code{qdf24xx}, |
7605d944 | 68 | @code{saphira}, |
55fbd992 | 69 | @code{thunderx}, |
0a8be2fe | 70 | @code{vulcan}, |
0a9ce86d | 71 | @code{xgene1} |
df359aa7 | 72 | and |
0a9ce86d | 73 | @code{xgene2}. |
df359aa7 RE |
74 | The special name @code{all} may be used to allow the assembler to accept |
75 | instructions valid for any supported processor, including all optional | |
76 | extensions. | |
77 | ||
78 | In addition to the basic instruction set, the assembler can be told to | |
79 | accept, or restrict, various extension mnemonics that extend the | |
80 | processor. @xref{AArch64 Extensions}. | |
81 | ||
82 | If some implementations of a particular processor can have an | |
83 | extension, then then those extensions are automatically enabled. | |
84 | Consequently, you will not normally have to specify any additional | |
85 | extensions. | |
86 | ||
87 | @cindex @option{-march=} command line option, AArch64 | |
88 | @item -march=@var{architecture}[+@var{extension}@dots{}] | |
89 | This option specifies the target architecture. The assembler will | |
90 | issue an error message if an attempt is made to assemble an | |
91 | instruction which will not execute on the target architecture. The | |
acb787b0 | 92 | following architecture names are recognized: @code{armv8-a}, |
1924ff75 | 93 | @code{armv8.1-a}, @code{armv8.2-a} and @code{armv8.3-a}. |
df359aa7 RE |
94 | |
95 | If both @option{-mcpu} and @option{-march} are specified, the | |
96 | assembler will use the setting for @option{-mcpu}. If neither are | |
97 | specified, the assembler will default to @option{-mcpu=all}. | |
98 | ||
99 | The architecture option can be extended with the same instruction set | |
100 | extension options as the @option{-mcpu} option. Unlike | |
101 | @option{-mcpu}, extensions are not always enabled by default, | |
102 | @xref{AArch64 Extensions}. | |
103 | ||
a52e6fd3 YZ |
104 | @cindex @code{-mverbose-error} command line option, AArch64 |
105 | @item -mverbose-error | |
106 | This option enables verbose error messages for AArch64 gas. This option | |
107 | is enabled by default. | |
108 | ||
109 | @cindex @code{-mno-verbose-error} command line option, AArch64 | |
110 | @item -mno-verbose-error | |
111 | This option disables verbose error messages in AArch64 gas. | |
112 | ||
a06ea964 NC |
113 | @end table |
114 | @c man end | |
115 | ||
df359aa7 RE |
116 | @node AArch64 Extensions |
117 | @section Architecture Extensions | |
118 | ||
119 | The table below lists the permitted architecture extensions that are | |
120 | supported by the assembler and the conditions under which they are | |
121 | automatically enabled. | |
122 | ||
123 | Multiple extensions may be specified, separated by a @code{+}. | |
124 | Extension mnemonics may also be removed from those the assembler | |
125 | accepts. This is done by prepending @code{no} to the option that adds | |
126 | the extension. Extensions that are removed must be listed after all | |
127 | extensions that have been added. | |
128 | ||
129 | Enabling an extension that requires other extensions will | |
130 | automatically cause those extensions to be enabled. Similarly, | |
131 | disabling an extension that is required by other extensions will | |
132 | automatically cause those extensions to be disabled. | |
133 | ||
134 | @multitable @columnfractions .12 .17 .17 .54 | |
135 | @headitem Extension @tab Minimum Architecture @tab Enabled by default | |
136 | @tab Description | |
f482d304 RS |
137 | @item @code{compnum} @tab ARMv8.2-A @tab ARMv8.3-A or later |
138 | @tab Enable the complex number SIMD extensions. This implies | |
139 | @code{fp16} and @code{simd}. | |
af117b3c | 140 | @item @code{crc} @tab ARMv8-A @tab ARMv8.1-A or later |
df359aa7 RE |
141 | @tab Enable CRC instructions. |
142 | @item @code{crypto} @tab ARMv8-A @tab No | |
143 | @tab Enable cryptographic extensions. This implies @code{fp} and @code{simd}. | |
144 | @item @code{fp} @tab ARMv8-A @tab ARMv8-A or later | |
145 | @tab Enable floating-point extensions. | |
87018195 MW |
146 | @item @code{fp16} @tab ARMv8.2-A @tab ARMv8.2-A or later |
147 | @tab Enable ARMv8.2 16-bit floating-point support. This implies | |
148 | @code{fp}. | |
b607cde1 JG |
149 | @item @code{lor} @tab ARMv8-A @tab ARMv8.1-A or later |
150 | @tab Enable Limited Ordering Regions extensions. | |
151 | @item @code{lse} @tab ARMv8-A @tab ARMv8.1-A or later | |
152 | @tab Enable Large System extensions. | |
153 | @item @code{pan} @tab ARMv8-A @tab ARMv8.1-A or later | |
154 | @tab Enable Privileged Access Never support. | |
73af8ed6 MW |
155 | @item @code{profile} @tab ARMv8.2-A @tab No |
156 | @tab Enable statistical profiling extensions. | |
50cc854c MW |
157 | @item @code{ras} @tab ARMv8-A @tab ARMv8.2-A or later |
158 | @tab Enable the Reliability, Availability and Serviceability | |
159 | extension. | |
01cca2f9 SN |
160 | @item @code{rcpc} @tab ARMv8.2-A @tab ARMv8.3-A or later |
161 | @tab Enable the weak release consistency extension. | |
b607cde1 JG |
162 | @item @code{rdma} @tab ARMv8-A @tab ARMv8.1-A or later |
163 | @tab Enable ARMv8.1 Advanced SIMD extensions. This implies @code{simd}. | |
164 | @item @code{simd} @tab ARMv8-A @tab ARMv8-A or later | |
165 | @tab Enable Advanced SIMD extensions. This implies @code{fp}. | |
582e12bf RS |
166 | @item @code{sve} @tab ARMv8.2-A @tab No |
167 | @tab Enable the Scalable Vector Extensions. This implies @code{fp16}, | |
168 | @code{simd} and @code{compnum}. | |
65a55fbb TC |
169 | @item @code{dotprod} @tab ARMv8.2-A @tab No |
170 | @tab Enable the Dot Product extension. This implies @code{simd}. | |
df359aa7 RE |
171 | @end multitable |
172 | ||
a06ea964 NC |
173 | @node AArch64 Syntax |
174 | @section Syntax | |
175 | @menu | |
176 | * AArch64-Chars:: Special Characters | |
177 | * AArch64-Regs:: Register Names | |
178 | * AArch64-Relocations:: Relocations | |
179 | @end menu | |
180 | ||
181 | @node AArch64-Chars | |
182 | @subsection Special Characters | |
183 | ||
184 | @cindex line comment character, AArch64 | |
185 | @cindex AArch64 line comment character | |
186 | The presence of a @samp{//} on a line indicates the start of a comment | |
187 | that extends to the end of the current line. If a @samp{#} appears as | |
188 | the first character of a line, the whole line is treated as a comment. | |
189 | ||
190 | @cindex line separator, AArch64 | |
191 | @cindex statement separator, AArch64 | |
192 | @cindex AArch64 line separator | |
193 | The @samp{;} character can be used instead of a newline to separate | |
194 | statements. | |
195 | ||
196 | @cindex immediate character, AArch64 | |
197 | @cindex AArch64 immediate character | |
198 | The @samp{#} can be optionally used to indicate immediate operands. | |
199 | ||
200 | @node AArch64-Regs | |
201 | @subsection Register Names | |
202 | ||
203 | @cindex AArch64 register names | |
204 | @cindex register names, AArch64 | |
205 | Please refer to the section @samp{4.4 Register Names} of | |
206 | @samp{ARMv8 Instruction Set Overview}, which is available at | |
207 | @uref{http://infocenter.arm.com}. | |
208 | ||
209 | @node AArch64-Relocations | |
210 | @subsection Relocations | |
211 | ||
212 | @cindex relocations, AArch64 | |
213 | @cindex AArch64 relocations | |
214 | @cindex MOVN, MOVZ and MOVK group relocations, AArch64 | |
215 | Relocations for @samp{MOVZ} and @samp{MOVK} instructions can be generated | |
216 | by prefixing the label with @samp{#:abs_g2:} etc. | |
217 | For example to load the 48-bit absolute address of @var{foo} into x0: | |
218 | ||
219 | @smallexample | |
220 | movz x0, #:abs_g2:foo // bits 32-47, overflow check | |
221 | movk x0, #:abs_g1_nc:foo // bits 16-31, no overflow check | |
222 | movk x0, #:abs_g0_nc:foo // bits 0-15, no overflow check | |
223 | @end smallexample | |
224 | ||
225 | @cindex ADRP, ADD, LDR/STR group relocations, AArch64 | |
226 | Relocations for @samp{ADRP}, and @samp{ADD}, @samp{LDR} or @samp{STR} | |
227 | instructions can be generated by prefixing the label with | |
34fd659b | 228 | @samp{:pg_hi21:} and @samp{#:lo12:} respectively. |
a06ea964 | 229 | |
34bca508 | 230 | For example to use 33-bit (+/-4GB) pc-relative addressing to |
a06ea964 NC |
231 | load the address of @var{foo} into x0: |
232 | ||
233 | @smallexample | |
34fd659b | 234 | adrp x0, :pg_hi21:foo |
a06ea964 NC |
235 | add x0, x0, #:lo12:foo |
236 | @end smallexample | |
237 | ||
238 | Or to load the value of @var{foo} into x0: | |
239 | ||
240 | @smallexample | |
34fd659b | 241 | adrp x0, :pg_hi21:foo |
a06ea964 NC |
242 | ldr x0, [x0, #:lo12:foo] |
243 | @end smallexample | |
244 | ||
34fd659b | 245 | Note that @samp{:pg_hi21:} is optional. |
a06ea964 NC |
246 | |
247 | @smallexample | |
248 | adrp x0, foo | |
249 | @end smallexample | |
250 | ||
251 | is equivalent to | |
252 | ||
253 | @smallexample | |
34fd659b | 254 | adrp x0, :pg_hi21:foo |
a06ea964 NC |
255 | @end smallexample |
256 | ||
257 | @node AArch64 Floating Point | |
258 | @section Floating Point | |
259 | ||
260 | @cindex floating point, AArch64 (@sc{ieee}) | |
261 | @cindex AArch64 floating point (@sc{ieee}) | |
262 | The AArch64 architecture uses @sc{ieee} floating-point numbers. | |
263 | ||
264 | @node AArch64 Directives | |
265 | @section AArch64 Machine Directives | |
266 | ||
267 | @cindex machine directives, AArch64 | |
268 | @cindex AArch64 machine directives | |
269 | @table @code | |
270 | ||
271 | @c AAAAAAAAAAAAAAAAAAAAAAAAA | |
8e02d7f5 JW |
272 | |
273 | @cindex @code{.arch} directive, AArch64 | |
274 | @item .arch @var{name} | |
275 | Select the target architecture. Valid values for @var{name} are the same as | |
276 | for the @option{-march} commandline option. | |
277 | ||
278 | Specifying @code{.arch} clears any previously selected architecture | |
279 | extensions. | |
280 | ||
281 | @cindex @code{.arch_extension} directive, AArch64 | |
282 | @item .arch_extension @var{name} | |
283 | Add or remove an architecture extension to the target architecture. Valid | |
284 | values for @var{name} are the same as those accepted as architectural | |
285 | extensions by the @option{-mcpu} commandline option. | |
286 | ||
287 | @code{.arch_extension} may be used multiple times to add or remove extensions | |
288 | incrementally to the architecture being compiled for. | |
289 | ||
a06ea964 NC |
290 | @c BBBBBBBBBBBBBBBBBBBBBBBBBB |
291 | ||
292 | @cindex @code{.bss} directive, AArch64 | |
293 | @item .bss | |
294 | This directive switches to the @code{.bss} section. | |
295 | ||
296 | @c CCCCCCCCCCCCCCCCCCCCCCCCCC | |
30fab421 NC |
297 | |
298 | @cindex @code{.cpu} directive, AArch64 | |
299 | @item .cpu @var{name} | |
300 | Set the target processor. Valid values for @var{name} are the same as | |
301 | those accepted by the @option{-mcpu=} command line option. | |
302 | ||
a06ea964 | 303 | @c DDDDDDDDDDDDDDDDDDDDDDDDDD |
30fab421 NC |
304 | |
305 | @cindex @code{.dword} directive, AArch64 | |
306 | @item .dword @var{expressions} | |
307 | The @code{.dword} directive produces 64 bit values. | |
308 | ||
a06ea964 | 309 | @c EEEEEEEEEEEEEEEEEEEEEEEEEE |
30fab421 NC |
310 | |
311 | @cindex @code{.even} directive, AArch64 | |
312 | @item .even | |
313 | The @code{.even} directive aligns the output on the next even byte | |
314 | boundary. | |
315 | ||
a06ea964 NC |
316 | @c FFFFFFFFFFFFFFFFFFFFFFFFFF |
317 | @c GGGGGGGGGGGGGGGGGGGGGGGGGG | |
318 | @c HHHHHHHHHHHHHHHHHHHHHHHHHH | |
319 | @c IIIIIIIIIIIIIIIIIIIIIIIIII | |
30fab421 NC |
320 | |
321 | @cindex @code{.inst} directive, AArch64 | |
322 | @item .inst @var{expressions} | |
323 | Inserts the expressions into the output as if they were instructions, | |
324 | rather than data. | |
325 | ||
a06ea964 NC |
326 | @c JJJJJJJJJJJJJJJJJJJJJJJJJJ |
327 | @c KKKKKKKKKKKKKKKKKKKKKKKKKK | |
328 | @c LLLLLLLLLLLLLLLLLLLLLLLLLL | |
329 | ||
330 | @cindex @code{.ltorg} directive, AArch64 | |
331 | @item .ltorg | |
332 | This directive causes the current contents of the literal pool to be | |
333 | dumped into the current section (which is assumed to be the .text | |
334 | section) at the current location (aligned to a word boundary). | |
df359aa7 | 335 | GAS maintains a separate literal pool for each section and each |
a06ea964 NC |
336 | sub-section. The @code{.ltorg} directive will only affect the literal |
337 | pool of the current section and sub-section. At the end of assembly | |
338 | all remaining, un-empty literal pools will automatically be dumped. | |
339 | ||
df359aa7 | 340 | Note - older versions of GAS would dump the current literal |
a06ea964 NC |
341 | pool any time a section change occurred. This is no longer done, since |
342 | it prevents accurate control of the placement of literal pools. | |
343 | ||
344 | @c MMMMMMMMMMMMMMMMMMMMMMMMMM | |
345 | ||
346 | @c NNNNNNNNNNNNNNNNNNNNNNNNNN | |
347 | @c OOOOOOOOOOOOOOOOOOOOOOOOOO | |
348 | ||
349 | @c PPPPPPPPPPPPPPPPPPPPPPPPPP | |
350 | ||
351 | @cindex @code{.pool} directive, AArch64 | |
352 | @item .pool | |
353 | This is a synonym for .ltorg. | |
354 | ||
355 | @c QQQQQQQQQQQQQQQQQQQQQQQQQQ | |
356 | @c RRRRRRRRRRRRRRRRRRRRRRRRRR | |
357 | ||
358 | @cindex @code{.req} directive, AArch64 | |
359 | @item @var{name} .req @var{register name} | |
360 | This creates an alias for @var{register name} called @var{name}. For | |
361 | example: | |
362 | ||
363 | @smallexample | |
364 | foo .req w0 | |
365 | @end smallexample | |
366 | ||
8975f864 RR |
367 | ip0, ip1, lr and fp are automatically defined to |
368 | alias to X16, X17, X30 and X29 respectively. | |
369 | ||
a06ea964 NC |
370 | @c SSSSSSSSSSSSSSSSSSSSSSSSSS |
371 | ||
372 | @c TTTTTTTTTTTTTTTTTTTTTTTTTT | |
373 | ||
30fab421 NC |
374 | @cindex @code{.tlsdescadd} directive, AArch64 |
375 | @item @code{.tlsdescadd} | |
376 | Emits a TLSDESC_ADD reloc on the next instruction. | |
377 | ||
378 | @cindex @code{.tlsdesccall} directive, AArch64 | |
379 | @item @code{.tlsdesccall} | |
380 | Emits a TLSDESC_CALL reloc on the next instruction. | |
381 | ||
382 | @cindex @code{.tlsdescldr} directive, AArch64 | |
383 | @item @code{.tlsdescldr} | |
384 | Emits a TLSDESC_LDR reloc on the next instruction. | |
385 | ||
a06ea964 NC |
386 | @c UUUUUUUUUUUUUUUUUUUUUUUUUU |
387 | ||
388 | @cindex @code{.unreq} directive, AArch64 | |
389 | @item .unreq @var{alias-name} | |
390 | This undefines a register alias which was previously defined using the | |
391 | @code{req} directive. For example: | |
392 | ||
393 | @smallexample | |
394 | foo .req w0 | |
395 | .unreq foo | |
396 | @end smallexample | |
397 | ||
398 | An error occurs if the name is undefined. Note - this pseudo op can | |
399 | be used to delete builtin in register name aliases (eg 'w0'). This | |
400 | should only be done if it is really necessary. | |
401 | ||
402 | @c VVVVVVVVVVVVVVVVVVVVVVVVVV | |
403 | ||
404 | @c WWWWWWWWWWWWWWWWWWWWWWWWWW | |
405 | @c XXXXXXXXXXXXXXXXXXXXXXXXXX | |
a06ea964 | 406 | |
edc66de9 | 407 | @cindex @code{.xword} directive, AArch64 |
30fab421 NC |
408 | @item .xword @var{expressions} |
409 | The @code{.xword} directive produces 64 bit values. This is the same | |
410 | as the @code{.dword} directive. | |
411 | ||
412 | @c YYYYYYYYYYYYYYYYYYYYYYYYYY | |
413 | @c ZZZZZZZZZZZZZZZZZZZZZZZZZZ | |
edc66de9 | 414 | |
a06ea964 NC |
415 | @end table |
416 | ||
417 | @node AArch64 Opcodes | |
418 | @section Opcodes | |
419 | ||
420 | @cindex AArch64 opcodes | |
421 | @cindex opcodes for AArch64 | |
df359aa7 | 422 | GAS implements all the standard AArch64 opcodes. It also |
a06ea964 | 423 | implements several pseudo opcodes, including several synthetic load |
34bca508 | 424 | instructions. |
a06ea964 NC |
425 | |
426 | @table @code | |
427 | ||
428 | @cindex @code{LDR reg,=<expr>} pseudo op, AArch64 | |
429 | @item LDR = | |
430 | @smallexample | |
431 | ldr <register> , =<expression> | |
432 | @end smallexample | |
433 | ||
434 | The constant expression will be placed into the nearest literal pool (if it not | |
435 | already there) and a PC-relative LDR instruction will be generated. | |
436 | ||
437 | @end table | |
438 | ||
439 | For more information on the AArch64 instruction set and assembly language | |
440 | notation, see @samp{ARMv8 Instruction Set Overview} available at | |
441 | @uref{http://infocenter.arm.com}. | |
442 | ||
443 | ||
444 | @node AArch64 Mapping Symbols | |
445 | @section Mapping Symbols | |
446 | ||
447 | The AArch64 ELF specification requires that special symbols be inserted | |
448 | into object files to mark certain features: | |
449 | ||
450 | @table @code | |
451 | ||
452 | @cindex @code{$x} | |
453 | @item $x | |
454 | At the start of a region of code containing AArch64 instructions. | |
455 | ||
456 | @cindex @code{$d} | |
457 | @item $d | |
458 | At the start of a region of data. | |
459 | ||
460 | @end table |