
3-4
C Cross Compiler
Some of the key options that control the compiler’s output are shown in
Table 3.2
.
The optimization levels supported by GCC are described in
Table 3.3
.
3.2 Compiler Conventions
This section describes the software conventions defined by the SDK
assembler and compiler. You must follow these conventions when writing
assembly-language routines that will be called by your C program.
Table 3.2
Output Options
-c
Compile or assemble source files but do not link. Output file is named by
replacing the suffix of the source file with ‘.o’.
-o
file
Place output in
file
. This option is applicable whether the output is preprocessed
C, assembly, an object file, or an executable.
-E
Stop after preprocessing. Output is sent to standard output.
-S
Stop after compilation. Do not assemble. Output file is named by replacing the
‘.c’ suffix with ‘.s’.
-save-temps
Store the intermediate preprocessed C, assembly, and object files permanently.
The names used for these intermediate files will be based on the name of the
input file: compiling
foo.c
with
-save-temps
will produce
foo.i
,
foo.s
, and
foo.o
.
-g
Generate debugging information for use by the debugger.
Table 3.3
Optimization Options
Option
Description
-O0
No optimization is performed. All variables are placed on the stack.
-O1
Only those optimizations that allow the debugger to behave as expected are
performed.
-O2
Only those optimizations that do not greatly increase code size are performed.
These optimizations include dead-code elimination, constant propagation, common
subexpression elimination, and loop invariant code motion.
-O3
All optimizations performed at level -
O2
are performed, as well as function inlining
and loop unrolling.