The precise optimizations performed by the compiler depend
both on the level of optimization chosen, and whether you are optimizing
for performance or code size.
The compiler supports the following optimization levels:
-O0
Minimum optimization. The compiler performs simple
optimizations that do not impair the debug view.
When debugging is enabled, this option gives the best possible
debug view.
-O1
Restricted
optimization.
When debugging is enabled, this option gives a generally satisfactory
debug view with good code density.
-O2
High
optimization. This is the default optimization level.
When debugging is enabled, this option might give a less satisfactory
debug view.
-O3
Maximum
optimization. This is the most aggressive form of optimization available.
Specifying this option enables multifile compilation by default
where multiple files are specified on the command line.
When debugging is enabled, this option typically gives a poor
debug view.
Because optimization affects the mapping of object code to
source code, the choice of optimization level with -Ospace and -Otime generally
impacts the debug view.
The option -O0 is the best option to use
if a simple debug view is needed. Selecting -O0 typically increases
the size of the ELF image by 7 to 15%. To reduce the size of your
debug tables, use the --remove_unneeded_entities option.
This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.
ARM websites use two types of cookie: (1) those that enable the site to function and perform as required; and (2) analytical cookies which anonymously track visitors only while using the site. If you are not happy with this use of these cookies please review our Privacy Policy to learn how they can be disabled. By disabling cookies some features of the site will not work.