SPRU513Y August 2001 – June 2022 SM320F28335-EP
The assembler treats each section as if it began at address 0. Of course, all sections cannot actually begin at address 0 in memory, so the linker must relocate sections. For COFF, all relocations are relative to address 0 in their sections. For EABI, relocations are symbol-relative rather than section-relative.
The linker can relocate sections by:
The linker uses relocation entries to adjust references to symbol values. The assembler creates a relocation entry each time a relocatable symbol is referenced. The linker then uses these entries to patch the references after the symbols are relocated. The following example contains a code fragment for a TMS320C28x device for which the assembler generates relocation entries.
1 .global X
2 00000000 .text
3 00000000 0080' LC Y ; Generates a relocation entry
00000001 0004
4 00000002 28A1! MOV AR1,#X ; Generates a relocation entry
00000003 0000
5 00000004 7621 Y: IDLE