Literal Prefix Directive - Using as

Next: Absolute Literals Directive, Previous: Literal Position Directive, Up: Xtensa Directives

##### 8.34.5.6 literal_prefix

The `literal_prefix` directive allows you to specify different sections to hold literals from different portions of an assembly file. With this directive, a single assembly file can be used to generate code into multiple sections, including literals generated by the assembler.

             .begin literal_prefix [name]
             .end literal_prefix

By default the assembler places literal pools in sections separate from the instructions, using the default literal section names of `.literal` for PC-relative mode `L32R` instructions and `.lit4` for absolute mode `L32R` instructions (see Absolute Literals Directive). The `literal_prefix` directive causes different literal sections to be used for the code inside the delimited region. The new literal sections are determined by including name as a prefix to the default literal section names. If the name argument is omitted, the literal sections revert to the defaults. This directive has no effect when using the --text-section-literals option (see Command Line Options).

Except for two special cases, the assembler determines the new literal sections by simply prepending name to the default section names, resulting in name`.literal` and name`.lit4` sections. The `literal_prefix` directive is often used with the name of the current text section as the prefix argument. To facilitate this usage, the assembler uses special case rules when it recognizes name as a text section name. First, if name ends with `.text`, that suffix is not included in the literal section name. For example, if name is `.iram0.text`, then the literal sections will be `.iram0.literal` and `.iram0.lit4`. Second, if name begins with `.gnu.linkonce.t.`, then the literal section names are formed by replacing the `.t` substring with `.literal` and `.lit4`. For example, if name is `.gnu.linkonce.t.func`, the literal sections will be `.gnu.linkonce.literal.func` and `.gnu.linkonce.lit4.func`.