2.2. Managing Compiler Build Steps

By default, the tiarmclang 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 tiarmclang.

armcl Option (and alias)

tiarmclang 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.

armcl Option (and alias)

tiarmclang Option

--preproc_only (-ppo)

-E

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

armcl Option (and alias)

tiarmclang Option

--skip_assembler (-n)

-S

Halt compilation after code generation. Both the armcl and tiarmclang 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 armcl compiler, the default file extension for a compiler generated assembly file is ‘.asm’. For the tiarmclang compiler, the file extension for a compiler generated assembly file is ‘.s’.

armcl Option (and alias)

tiarmclang Option

--run_linker (-z)

linker is invoked by default

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

You can prevent tiarmclang 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.

armcl Option (and alias)

tiarmclang Option

-z <linker options>

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

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

To pass options to the linker from the tiarmclang command-line, use either -Xlinker or -Wl. The tiarmclang 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 armcl, is not set by default by the tiarmclang 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 tiarmclang command line (or specified in the linker command file).

armcl Option (and alias)

tiarmclang Option

--help (-h)

-help (-h)

Display list of command-line options available.