Relocation specifiers

The relocation specifiers are used after symbol names or QualNames.

In general, the assembler generates the proper relocations based on expression types and usage. In some cases, however, multiple relocation types are possible, and an explicit relocation specifier is required.

An explicit relocation specifier can be used after symbol names or QualNames. It consists of the @ (at sign) character, and a 1- or 2-character relocation type. Relocation types can be specified in uppercase or lowercase letters, but not mixed case.

The following table lists the valid relocation types:
Type RLD name Usage
u R_TOCU Large TOC relocation
l R_TOCL Large TOC relocation
gd R_TLS Thread-Local Storage
ie R_TLS_IE Thread-Local Storage
le R_TLS_LE Thread-Local Storage
ld R_TLS_LD Thread-Local Storage
m R_TLSM Thread-Local Storage
ml R_TLSML Thread-Local Storage
tr R_TRL TOC references
tc R_TOC TOC references
p R_POS General

The large-TOC relocation types are used by default with the XMC_TE storage-mapping class, but they can also be used when TOC-relative instructions are used with XMC_TC symbols.

The thread-local storage relocation types are generally used with TOC references to thread-local symbols. The @gd relocation specifier is used by default. If other TLS access methods are used, an explicit specifier is needed.

The @tr relocation specifier enables the R_TRL relocation type to be used with TOC-relative loads. This relocation type prevents the linker from transforming the load instruction to an add-immediate instruction.

The @tc and @p relocation specifiers are never needed, but are provided for completeness.