SPRUI04F july 2015 – april 2023
This is the general syntax for linking C/C++ programs as part of the compile step:
cl6xfilenames [options] --run_linker [--rom_model | --ram_model] filenames | |
[options] [--output_file=name.out] --library=library [lnk.cmd] |
The --run_linker option divides the command line into the compiler options (the options before --run_linker) and the linker options (the options following --run_linker). The --run_linker option must follow all source files and compiler options on the command line.
All arguments that follow --run_linker on the command line are passed to the linker. These arguments can be linker command files, additional object files, linker options, or libraries. These arguments are the same as described in Section 6.1.1.
All arguments that precede --run_linker on the command line are compiler arguments. These arguments can be C/C++ source files, assembly files, linear assembly files, or compiler options. These arguments are described in Section 3.2.
You can compile and link a C/C++ program consisting of object files prog1.c, prog2.c, and prog3.c, with an executable object file filename of prog.out with the command:
cl6x prog1.c prog2.c prog3.c --run_linker --rom_model --output_file=prog.out --library=rts6600.lib
When you use cl6x --run_linker after listing at least one C/C++ file to be compiled on the same command line, by default the --rom_model is used for automatic variable initialization at run time. See Section 6.3.4 for details about using the --rom_model and --ram_model options.
Order of Processing Arguments in the Linker: The order in which the linker processes arguments is important. The compiler passes arguments to the linker in the following order: