You copied the Doc URL to your clipboard.

21.57 RELOC

The RELOC directive explicitly encodes an ELF relocation in an object file.

Syntax

RELOC n, symbol

RELOC n

where:

n

must be an integer in the range 0 to 255 or oneof the relocation names defined in the Application Binary Interfacefor the ARM Architecture.

symbol

can be any PC-relative label.

Usage

Use RELOC n, symbol tocreate a relocation with respect to the address labeled by symbol.

If used immediately after an ARM or Thumb instruction, RELOC resultsin a relocation at that instruction. If used immediately after a DCB, DCW,or DCD, or any other data generating directive, RELOC resultsin a relocation at the start of the data. Any addend to be appliedmust be encoded in the instruction or in the data.

If the assembler has already emitted a relocation at thatplace, the relocation is updated with the details in the RELOC directive,for example:

DCD     sym2 ; R_ARM_ABS32 to sym32RELOC   55   ; ... makes it R_ARM_ABS32_NOI

RELOC is faulted in all other cases,for example, after any non-data generating directive, LTORG, ALIGN,or as the first thing in an AREA.

Use RELOC n tocreate a relocation with respect to the anonymous symbol, that is,symbol 0 of the symbol table. If you use RELOC n withouta preceding assembler generated relocation, the relocation is withrespect to the anonymous symbol.

Examples

IMPORT  impsymLDR     r0,[pc,#-8]RELOC   4, impsymDCD     0RELOC   2, symDCD     0,1,2,3,4       ; the final word is relocatedRELOC   38,sym2         ; R_ARM_TARGET1DCD     impsymRELOC   R_ARM_TARGET1   ; relocation code 38
Was this page helpful? Yes No