
Controlling the Linking Process
4-8
4.5 Controlling the Linking Process
Regardless of the method you choose for invoking the linker, special require-
ments apply when linking C programs. You must:
-
Include the compiler’s run-time-support library
-
Specify the type of initialization
-
Determine how you want to allocate your program into memory
This section discusses how these factors are controlled and provides an
example of the standard default linker command file.
For more information about how to operate the linker, see the
TMS320C1x/
C2x/C2xx/C5x Assembly Language Tools User’s Guide.
4.5.1 Linking With Run-Time-Support Libraries
You must link all C programs with a run-time-support library. The library con-
tains standard C functions as well as functions used by the compiler to manage
the C environment. You must use the
−
l linker option to specify which
TMS320C2x/C2xx/C5x run-time-support library to use. The
−
l option also tells
the linker to look at the
−
i options and then the C_DIR environment variable
to find an archive path or object file. To use the
−
l linker option, type on the com-
mand line:
dsplnk
{
−
c
|
−
cr
}
filenames
−
l
libraryname
Generally, you should specify the library as the last name on the command line
because the linker searches libraries for unresolved references in the order
that files are specified on the command line. If any object files follow a library,
references from those object files to that library are not resolved. You can use
the
−
x linker option to force the linker to reread all libraries until references are
resolved. Whenever you specify a library as linker input, the linker includes and
links only those library members that resolve undefined references.
Three versions of the standard run-time-support library are included with the
compiler: rts25.lib for TMS320C2x programs, rts2xx.lib for TMS320C2xx
programs, and rts50.lib for TMS320C5x programs.
You must link all C programs with an object module called
boot.obj
. When a
C program begins running, it must execute boot.obj first. The boot.obj file con-
tains code and data to initialize the run-time environment; the linker automati-
cally extracts boot.obj and links it when you use
−
c or
−
cr and include rts25.lib,
rts2xx.lib or rts50.lib in the link.
Содержание TMS320C2x
Страница 8: ...viii...
Страница 69: ...2 47 C Compiler Description...
Страница 159: ...6 36...
Страница 226: ...8 6...
Страница 250: ...Index Index 14 Z z shell option 2 2 2 4 2 14 overriding with c option 4 5 overriding with n option 2 13...