Comments
Comments are treated as equivalent to whitespace, their contents are ignored by the
assembler.
There are two ways to include comments in an assembly file:
// single-line comment
@ single-line comment in AArch32 state only
/* multi-line
comment */
In single-line comments, the //
marker starts a comment that runs to
the end of the source line. Unlike when compiling C and C++ source, the end of the
line cannot be escaped with \
to continue the comment.
@
starts a single-line comment in AArch32 state. @
is not a comment character in AArch64 state.
In multi-line comments, the /*
marker starts a comment that runs to
the first occurrence of */
, even if that is on a later line. Like
in C and C++ source, the comment always ends at the first */
, so
comments cannot be nested. This style of comments can be used anywhere within an
assembly statement where whitespace is valid.
Note:
Comments inside source files and header files that are provided by Arm might not be accurate and must not be treated as documentation about the product.
Examples
// Instruction on it's own line:
add r0, r1, r2
// Label and directive:
lab: .word 42
// Multiple labels on one line:
lab1: lab2:
/* Multiple instructions, directives or macro-invocations
must be separated by ';' */
add r0, r1, r2; bx lr
// Multi-line comments can be used anywhere whitespace can:
add /*dst*/r0, /*lhs*/r1, /*rhs*/r2