3.1. Managing Compiler Build Steps

By default, the c29clang compiler performs the following steps:

  1. Preprocess the C/C++ source file

  2. Compile the C/C++ source file(s) into temporary object file(s)

  3. Automatically call the linker to produce an executable image

The following command-line options control the build-process steps performed by c29clang.

cl2000 Option (and alias)

c29clang Option

--compile_only (-c)

-c

Preprocess and compile source files, but do not link object files. The output is one object file for each source file.

cl2000 Option (and alias)

c29clang Option

--preproc_only (-ppo)

-E

Run only the preprocessor. The cl2000 compiler saves the preprocessed output in a .pp file, but the preprocessed output from c29clang is streamed to stdout.

cl2000 Option (and alias)

c29clang Option

--skip_assembler (-n)

-S

Halt compilation after code generation. Both the cl2000 and c29clang compilers halt after processing a C/C++ source file and before assembling the generated code into an object file. After halting, an assembly source file containing the generated code will be present in the current working directory. For the cl2000 compiler, the default file extension for a compiler generated assembly file is ‘.asm’. For the c29clang compiler, the file extension for a compiler generated assembly file is ‘.s’.

cl2000 Option (and alias)

c29clang Option

--run_linker (-z)

linker is invoked by default

The cl2000 compiler does not run the linker unless you use the --run_linker (-z) option. By default, the c29clang compiler automatically invokes the linker after compiling source files into object files. To see details about what command is used by the c29clang compiler to invoke the linker, you can specify the ‘-v’ option on the c29clang command- line.

You can prevent c29clang from running the linker using one of these options:

  • The -S option stops the compiler after generating an assembly file for each C/C++ source file on the command line.

  • The -c option stops the compiler after generating an object file for each C/C++ source.

cl2000 Option (and alias)

c29clang Option

-z <linker options>

-Xlinker <linker option>

-Wl,<comma-separated list of linker options>

Any options specified after the -z option using cl2000 are passed to the linker.

To pass options to the linker from the c29clang command-line, use either -Xlinker or -Wl. The c29clang compiler inserts these options into the list of options used when the linker is invoked after the compilation step. The -Xlinker option can be used to specify a single linker option (with no intervening spaces). The -Wl option accepts a comma-separated list of linker options.

Note that the --rom_model (-c) linker option, which is the default for cl2000, is not set by default by the c29clang compiler when running the linker. Therefore, either the -rom_model (-c) or --ram_model (-cr) option must be passed to the linker using either -Xlinker or -Wl on the c29clang command line (or specified in the linker command file).

cl2000 Option (and alias)

c29clang Option

--help (-h)

-help (-h)

Display list of command-line options available.