Table of Contents
Previous topic Next topic
LINKER->Overview and Command Line Operation
The linker combines object modules created with the assembler to create the final code that will run on your target system. It carries out the following functions:
The target program can be produced in a number of different formats including Motorola 'S' record, Intel hex, HP/Microtec IEEE695 format or as a binary rom image. No conversion utility has to be used - the linker directly outputs the program in the specified format.
- scans each module to collect segment and variable information
- arranges and positions segments at appropriate memory locations to suit the memory organisation of the target system and any specific location information supplied by the user
- finalises the values of all variables and calculates the results of any incomplete expressions
- extracts and relocates the code from each module to produce the final target program
An optional link map will show the final location and sizes of all segments and the values of all global variables.
The linker can be automatically invoked when the CL command is used. However, the linker can also be run separately with the command line:
LINK [ofiles], [pfile], [mfile], [lfiles] [/options]
where [ofiles] is a list (separated by spaces) of the object files to be linked
[pfile] is the name of the file in which the program code will be placed
[mfile] is the name of the file in which the link map will be placed
[lfiles] is a list (separated by spaces) of the library files which should be searched for unresolved references
[/options] is a list (separated by spaces) of linker options.
A semicolon placed after a file name causes default filenames to be used for the remaining filenames.