--lto, --no_lto
Enables link time optimization.
Caution
Link Time Optimization performs aggressive optimizations by analyzing the dependencies between bitcode format objects. This can result in the removal of unused variables and functions in the source code.Note
When you specify the -flto
option, armclang produces ELF files that
contain bitcode in a .llvmbc
section.
With the --no_lto
option, armlink gives an error message if it encounters any
.llvmbc
sections.
Default
The default is --no_lto
.
Dependencies
Link time optimization requires the dependent library libLTO
.
Table 11-4 Link time optimization dependencies
Dependency | Windows filename | Linux filename |
---|---|---|
libLTO |
LTO.dll |
libLTO.so |
By default, the dependent library libLTO
is present in the same directory as armlink.
The search order for these dependencies is as follows.
LTO.dll
:
- The same directory as the armlink executable.
- The directories in the current directory search path.
libLTO.so
:
- The same directory as the armlink executable.
- The directories in the
LD_LIBRARY_PATH
environment variable. - The cache file
/etc/ld.so.cache
. -
The directories
/lib
and/usr/lib
.These directories might have the suffix
64
on some 64-bit Linux systems. For example, on 64-bit Red Hat Enterprise Linux the directories are/lib64
and/usr/lib64
.
Note
The armclang executables and thelibLTO
library must come from the same Arm® Compiler 6 installation.
Any use of libLTO
other than that supplied with Arm Compiler 6 is
unsupported.Note
Link Time Optimization does not honor thearmclang -mexecute-only
option. If you use the armclang -flto
or -Omax
options, then the compiler cannot generate execute-only code and produces a warning.