Literal Directive - Using as

Next: Literal Position Directive, Previous: Transform Directive, Up: Xtensa Directives

##### 8.34.5.4 literal

The `.literal` directive is used to define literal pool data, i.e., read-only 32-bit data accessed via `L32R` instructions.

             .literal label, value[, value...]

This directive is similar to the standard `.word` directive, except that the actual location of the literal data is determined by the assembler and linker, not by the position of the `.literal` directive. Using this directive gives the assembler freedom to locate the literal data in the most appropriate place and possibly to combine identical literals. For example, the code:

             entry sp, 40
             .literal .L1, sym
             l32r    a4, .L1

can be used to load a pointer to the symbol `sym` into register `a4`. The value of `sym` will not be placed between the `ENTRY` and `L32R` instructions; instead, the assembler puts the data in a literal pool.

Literal pools for absolute mode `L32R` instructions (see Absolute Literals Directive) are placed in a seperate `.lit4` section. By default literal pools for PC-relative mode `L32R` instructions are placed in a separate `.literal` section; however, when using the --text-section-literals option (see Command Line Options), the literal pools are placed in the current section. These text section literal pools are created automatically before `ENTRY` instructions and manually after .literal_position directives (see literal_position). If there are no preceding `ENTRY` instructions, explicit `.literal_position` directives must be used to place the text section literal pools; otherwise, as will report an error.