Non-Confidential | ![]() | 100067_0609_00_en | ||
| ||||
Home > armclang Command-line Options > -O |
Specifies the level of optimization to use when compiling source files.
-O
level
Where
is one of the following:level
0
Minimum optimization for the performance of the compiled binary. Turns off most optimizations. When debugging is enabled, this option generates code that directly corresponds to the source code. Therefore, this might result in a significantly larger image.
This is the default optimization level.
1
2
3
fast
3
including those performed with the -ffp-mode=fast
armclang option. This level also performs
other aggressive optimizations that might violate strict compliance with
language standards.max
fast
, together with other aggressive
optimizations.-Omax
automatically enables the armclang
-flto
option and the generated object
files are not suitable for creating static libraries. When -flto
is enabled, you cannot build ROPI or
RWPI images.When using -Omax
:
-flto
option is enabled, which is turned on by default at -Omax
, because this generates
files containing bitcode.-Omax
and have separate compile and
link steps, then also include -Omax
on your armlink command line.armclang
-mexecute-only
option. If you use the armclang
-flto
or -Omax
options, then the compiler cannot generate execute-only code and produces a warning.
s
z
If you do not specify -O
, the compiler assumes level
-O0
. For the best debug view, Arm recommends -O1
rather than -O0
for the best trade-off between image size, performance, and debug.