Chapter 6 Using Linker
84 Purpose of This Chapter
6.1 Purpose of This Chapter
This chapter explains how to use all the options provided by the linker. The linker reads relocatable
object files output by the assembler, outputs an executable format file, and if specified by option
outputs a map file containing link information. If optimization was specified at the assembly stage, the
linker will also adjust code such that it outputs optimal code for conditional and unconditional branch
instructions. In addition, the linker also resolves forward references.
For programs in section address format, the start address of each section is specified when linking. The
linker links relocatable object files by section in the order specified by the link command, and outputs
an executable format file.
Figure: 6-1 Link Model of Section Address Format
sectionA
sectionC
sectionA
sectionA
sectionA
sectionC
0x40000000
0x00000000
0x80000000
P
ROGRAM1.RF
P
ROGRAM2.RF
P
ROGRAM3.RF
PROGRAM1
PROGRAM3
PROGRAM1
PROGRAM2
PROGRAM3
PROGRAM2
sectionB
sectionB
sectionB
sectionB
sectionB
sectionB
Relocatable Object Files Executable Format Fi
le
Linker
Start Addresses
sectionA=0x00000000
sectionB=0x00000000
sectionC=0x00000000