You copied the Doc URL to your clipboard.

Optimizing across modules with link time optimization

Additional optimization opportunities are available at link time, because source code from different modules can be optimized together.

By default, the compiler optimizes each source module independently, translating C or C++ source code into an ELF file containing object code. At link time the linker combines all the ELF object files into an executable by resolving symbol references and relocations. Compiling each source file separately means the compiler might miss some optimization opportunities, such as cross-module inlining.

When link time optimization is enabled, the compiler translates source code into an intermediate form called bitcode. At link time, the linker collects all bitcode files together and sends them to the link time optimizer (llvm-lto) as one or more larger units. Collecting modules together means the link time optimizer can perform more optimizations because it has more information about the dependencies between modules. The link time optimizer then sends a single ELF object file back to the linker. Finally, the linker combines all object and library code to create an executable.

Figure 6-1 Link time optimization


Bitcode files and ELF object files both have the default extension .o. You can use armclang -c -o filename to specify a different filename and extension for bitcode files if desired, for example .bc.


ARM® Compiler does not support link time optimization on 32-bit Red Hat Enterprise Linux platforms.

This section contains the following subsections:

Was this page helpful? Yes No