Chapter 6 Using Linker

6.1Purpose 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.

Relocatable Object Files

Executable Format File

sectionA

PROGRAM1.RF

sectionB

sectionC

PROGRAM2.RF

sectionB

sectionB

PROGRAM3.RF

sectionA

0x00000000

Start Addresses

sectionA=0x00000000

sectionB=0x00000000

sectionC=0x00000000

0x40000000

Linker

0x80000000

sectionA

PROGRAM1

sectionA

PROGRAM3

sectionB

PROGRAM1

sectionB

PROGRAM2

sectionB

PROGRAM3

sectionC

PROGRAM2

Figure: 6-1 Link Model of Section Address Format

84 Purpose of This Chapter

Page 96
Image 96
Panasonic MN1030 user manual Link Model of Section Address Format