4.4. Directives that Initialize Values and Strings

The following data-defining directives assemble numeric values in the current section. This has the effect of initializing space with one or more values as specified in the operand list field. The size of the space initialized for each value in the operand list is determined by the directive.

.byte expr1*[, *expr2,…] // 8-bit integer
.2byte expr1*[, *expr2,…] // 2 8-bit integers
.4byte expr1*[, *expr2,…] // 4 8-bit integers
.8byte expr1*[, *expr2,…] // 8 8-bit integers
.hword expr1*[, *expr2,…] // 16-bit integer
.short expr1*[, *expr2,…] // 16-bit integer
.int expr1*[, *expr2,…] // 32-bit integer
.word expr1*[, *expr2,…] // 32-bit integer
.long expr1*[, *expr2,…] // 32-bit integer
.quad expr1*[, *expr2,…] // 64-bit integer
.octa expr1*[, *expr2,…] // unsigned 128-bit integer
.sleb128 expressions
.uleb128 expressions
.float expr1*[, *expr2,…] // 32-bit floating-point numbers
.single expr1*[, *expr2,…] // 32-bit floating-point numbers
.double expr1*[, *expr2,…] // 64-bit floating-point numbers

The following directives assemble string values in the current section or output the contents of the literal pool to the current section.

.ascii “string”[,”string”,…]
.asciz “string”[,”string”,…]
.string[8|16|32|64] “string”[.”string”,…]

4.4.1. Operand List

The operand list for directives may contain a list of one or more expr operands separated by commas. Each expr operand is an arithmetic expression that can eventually be resolved to an integer constant by the tiarmclang assembler or the linker in the process of building a static executable.

An expr operand represented as an arithmetic expression may be in one of the following forms at assembly time:

  • For an arithmetic expression that results in an absolute value at assembly time, the assembler encodes the result of the expression in the field defined by the directive.

  • If an expression cannot be evaluated at assembly time, then the assembler generates relocations and the value will be computed at link time. For example, for an arithmetic expression that resolves to a single label symbol plus an optional integer constant, the assembler creates a relocation entry for the label symbol reference and includes the relocation entry in the object file that is written by the assembler.

If the operand list is empty, then the directive does nothing.

If the result of an expression will not fit in the size indicated by the directive, a warning message is provided and the least significant bytes of the expression’s value that fit are used.