When using ‘--text-section-literals’ to place literals inline in the section being assembled, the
.literal_position directive can be used to mark a potential location for a literal pool.
.literal_position directive is ignored when the ‘--text-section-literals’ option is not used or when
L32R instructions use the absolute addressing mode.
The assembler will automatically place text section literal pools before
ENTRY instructions, so the
.literal_position directive is only needed to specify some other location for a literal pool. You may need to add an explicit jump instruction to skip over an inline literal pool.
For example, an interrupt vector does not begin with an
ENTRY instruction so the assembler will be unable to automatically find a good place to put a literal pool. Moreover, the code for the interrupt vector must be at a specific starting address, so the literal pool cannot come before the start of the code. The literal pool for the vector must be explicitly positioned in the middle of the vector (before any uses of the literals, due to the negative offsets used by PC-relative
L32R instructions). The
.literal_position directive can be used to do this. In the following code, the literal for ‘M’ will automatically be aligned correctly and is placed after the unconditional jump.
.global M code_start:
j continue .literal_position .align 4
continue: movi a4, M