Download TMS320C6000 Optimizing Compiler v 7.4

Transcript
Controlling the Linking Process
www.ti.com
5.3
Controlling the Linking Process
Regardless of the method you choose for invoking the linker, special requirements apply when linking
C/C++ programs. You must:
• Include the compiler's run-time-support library
• Specify the type of boot-time 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 linker description in the TMS320C6000
Assembly Language Tools User's Guide
5.3.1 Including the Run-Time-Support Library
You must link all C/C++ programs with a run-time-support library. The library contains standard C/C++
functions as well as functions used by the compiler to manage the C/C++ environment. The following
sections describe two methods for including the run-time-support library.
5.3.1.1
Automatic Run-Time-Support Library Selection
If the --rom_model or --ram_model option is specified during the linker and the entry point for the program
(normally c_int00) is not resolved by any specified object file or library, the linker attempts to automatically
include the best compatible run-time-support library for your program. The chosen run-time-support library
is linked in after any other libraries specified with the --library option on the command line. Alternatively,
you can force the linker to choose an appropriate run-time-support library by specifying “libc.a” as an
argument to the --library option, or when specifying the run-time-support library name explicitly in a linker
command file.
The automatic selection of a run-time-support library can be disabled with the --disable_auto_rts option.
If the --issue_remarks option is specified before the --run_linker option during the linker, a remark is
generated indicating which run-time support library was linked in. If a different run-time-support library is
desired, you must specify the name of the desired run-time-support library using the --library option and in
your linker command files when necessary.
Example 5-1. Using the --issue_remarks Option
cl6x --silicon_version=6400+ --issue_remarks main.c --run_linker --rom_model
<Linking>
remark: linking in "libc.a"
remark: linking in "rts64plus.lib" in place of "libc.a"
5.3.1.2
Manual Run-Time-Support Library Selection
You should use the --library linker option to specify which C6000 run-time-support library to use. The -library option also tells the linker to look at the --search_path options and then the C6X_C_DIR
environment variable to find an archive path or object file. To use the --library linker option, type on the
command line:
cl6x --run_linker {--rom_model | --ram_model} filenames --library= libraryname
SPRU187U – July 2012
Submit Documentation Feedback
Linking C/C++ Code
Copyright © 2012, Texas Instruments Incorporated
141