You copied the Doc URL to your clipboard.

Data definition directives

These directives allocate memory in the current section, and define the initial contents of that memory.


.byte  expr[, expr]…
.hword  expr[, expr]…
.word  expr[, expr]…
.quad  expr[, expr]…
.octa  expr[, expr]…



An expression that has one of the following forms:

  • A absolute value, or expression (not involving labels) which evaluates to one. For example:
    .word (1<<17) | (1<<6)
    .word 42
  • An expression involving one label, which may or not be defined in the current file, plus an optional constant offset. For example:
    .word label
    .word label + 0x18
  • A place-relative expression, involving the current location in the file (or a label in the current section) subtracted from a label which may either be defined in another section in the file, or undefined in the file. For example:
        .word label - .
        .word label - foo
  • A difference between two labels, both of which are defined in the same section in the file. The section containing the labels need not be the same as the one containing the directive. For example:
        .word end - start
            // ...

The number of bytes allocated by each directive is as follows:

Table 9-9 Data definition directives

Directive Size in bytes
.byte 1
.hword 2
.word 4
.quad 8
.octa 16

If multiple arguments are specified, multiple memory locations of the specified size are allocated and initialized to the provided values in order.

The following table shows which expression types are accepted for each directive. In some cases, this varies between AArch32 and AArch64. This is because the two architectures have different relocation codes available to describe expressions involving symbols defined elsewhere. For absolute expressions, the table gives the range of values that are accepted (inclusive on both ends).

Table 9-10 Expression types supported by the data definition directives

Directive Absolute Label Place-relative Difference
.byte Within the range [-128,255] only AArch32 only Not supported AArch64 and AArch32
.hword Within the range [-0x8000,0xffff] only AArch64 and AArch32 AArch64 only AArch64 and AArch32
.word Within the range [-2^31,2^32-1] only AArch64 and AArch32 AArch64 and AArch32 AArch64 and AArch32
.quad Within the range [-2^63,2^64-1] only AArch64 only AArch64 only AArch64 only
.octa Within the range [0,2^128-1] only Not supported Not supported Not supported

Note that, while most directives accept expressions, the .octa directive only accepts literal values. In the armclang inline assembler and integrated assembler, negative values are expressions (the unary negation operator and a positive integer literal), so negative values are not accepted by the .octa directive. If negative 16-byte values are needed, they can be rewritten using two's complement representation instead.

These directives do not align the start of the memory allocated. If this is required you must use one of the alignment directives.

The following aliases for these directives are also accepted:

Table 9-11 Aliases for the data definition directives

Directive Aliases
.byte .1byte, .dc.b
.hword .2byte, .dc, .dc.w, .short, .value
.word .4byte, .long, .int, .dc.l, .dc.a (AArch32 only)
.quad .8byte, .xword (AArch64 only), .dc.a (AArch64 only)


  // 8-bit memory location, initialized to 42:
  .byte 42

  // 32-bit memory location, initialized to 15532:
  .word 15532

  // 32-bit memory location, initailized to the address of an externally defined symbol:
  .word extern_symbol

  // 16-bit memory location, initialized to the difference between the 'start' and
  // 'end' labels. They must both be defined in this assembly file, and must be
  // in the same section as each other, but not necessarily the same section as
  // this directive:
  .hword end - start

  // 32-bit memory location, containing the offset between the current location in the file and an externally defined symbol.
  .word extern_symbol - .
Was this page helpful? Yes No