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 are placed by default in separate literal sections;
however, when using the --text-section-literals
option (see Command Line Options), the literal
pools for PC-relative mode L32R
instructions
are placed in the current section.1
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.
When literals are placed in separate sections, the literal section names
are derived from the names of the sections where the literals are
defined. The base literal section names are .literal
for
PC-relative mode L32R
instructions and .lit4
for absolute
mode L32R
instructions (see absolute-literals). These base names are used for literals defined in
the default .text
section. For literals defined in other
sections or within the scope of a literal_prefix
directive
(see literal_prefix), the following rules
determine the literal section name:
.literal
or .lit4
name, with a period to separate the base
name and group name. The literal section is also made a member of the
group.
literal_prefix
value) begins with
“.gnu.linkonce.
kind.
”, the literal section name is formed
by replacing “.
kind” with the base .literal
or
.lit4
name. For example, for literals defined in a section named
.gnu.linkonce.t.func
, the literal section will be
.gnu.linkonce.literal.func
or .gnu.linkonce.lit4.func
.
literal_prefix
value) ends with
.text
, the literal section name is formed by replacing that
suffix with the base .literal
or .lit4
name. For example,
for literals defined in a section named .iram0.text
, the literal
section will be .iram0.literal
or .iram0.lit4
.
.literal
or .lit4
name as a
suffix to the current section name (or literal_prefix
value).
[1] Literals for the
.init
and .fini
sections are always placed in separate
sections, even when --text-section-literals is enabled.