You copied the Doc URL to your clipboard.

Instruction and directive relocations

A relocation is a directive embedded in the object file that enables source code to refer to a label whose target address is unknown or cannot be calculated at assembly time. The assembler will emit a relocation in the object file, and the linker resolves this to the address where the target is placed.

The assembler relocates the data directives DCB, DCW, DCWU, DCD, and DCDU if their syntax contains an external symbol, that is a symbol declared using IMPORT or EXTERN. This causes the bottom 8, 16, or 32 bits of the address to be used at link-time.

The REQUIRE directive emits a relocation to signal to the linker that the target label must be present if the current section is present.

The assembler is permitted to emit a relocation for these instructions:

LDR (PC-relative)

All ARM and Thumb instructions, except the Thumb doubleword instruction, can be relocated.


All ARM and Thumb instructions can be relocated.

B, BL, and BLX

All ARM and Thumb instructions can be relocated.


All Thumb instructions can be relocated but this is discouraged because of the limited branch range of these instructions.

LDC and LDC2

Only ARM instructions can be relocated.


Only ARM instructions can be relocated.

Wireless MMX load instructions

Only ARM word and doubleword load instructions can be relocated.

The assembler emits a relocation for the instructions listed above if the label used meets any of the following requirements, as appropriate for the instruction type:

  • the label is WEAK

  • the label is not in the same AREA

  • the label is external to the object (IMPORT or EXTERN).

For B, BL, and BX instructions, the assembler emits relocation also if:

  • the label is a function

  • the label is function exported using EXPORT or GLOBAL.


The RELOC directive can be used to control the relocation at a finer level, but this needs knowledge of the ABI.


    IMPORT sym    ; sym is an external symbol
    DCW sym       ; Because DCW only outputs 16 bits, only the lower 16 bits
                  ; of the address of sym are inserted at link-time.
Was this page helpful? Yes No