Using Linker Command Files

Top  Previous  Next

The following three sections deal with more advanced uses of the linker. If you want to build only fairly simple programs for now, you can skip to the section on running programs.

 

Sometimes you may have more object files to link than is convenient or possible to include on the command line. In this case, you have to use a linker command file. In its simplest form, a linker command file is a text file containing a list of object file names, all of which are to be included in the executable file. For example:

 

» 3L t myprog.ind

 

This causes the linker to find the file myprog.ind, and link together all the object files specified in it, include the necessary modules from the run-time library, and generate a task image file called myprog.tsk.

 

The contents of myprog.ind might be as follows (assuming you have created the relevant files):

 

main

fns

-i grafpack.ind

 

This links the object files main.obj and fns.obj, together with all the object files specified in yet another command file, grafpack.ind.

 

Further details about the linker, and linker command files, may be found in the TI documentation.

 

Note that Diamond users should never use the linker’s MEMORY or SECTIONS directives. There is actually one exception to this rule where a SECTIONS directive has been used to work round difficulties caused by unfortunate changes Texas Instruments made to the linker, but this is usually hidden in Diamond commands.

 

Linking is performed automatically when you build using the IDE.