Restrictions with link time optimization
Link time optimization has a few restrictions in ARM® Compiler 6. Future releases might have fewer restrictions and more features. The user interface to link time optimization might change in future releases.
- No bitcode libraries
armlinkonly supports bitcode objects on the command line. It does not support bitcode objects coming from libraries.
armlinkgives an error message if it encounters a file containing bitcode while loading from a library.
Although armar silently accepts ELF files that are produced with armclang -flto, these files currently do not have a proper symbol table. Therefore, the generated archive has incorrect index information and armlink cannot find any symbols in this archive.
- Partial linking
--partialonly works with ELF files. The linker gives an error message if it detects a file containing bitcode.
The output of the link time optimizer is a single ELF object file that by default is given a temporary filename. This ELF object file contains sections and symbols just like any other ELF object file, and these are matched by input section selectors as normal.
Use theARM recommends that link time optimization is only performed on code and data that does not require precise placement in the scatter file, with general input section selectors such as
--lto_intermediate_filenameto name the ELF object file output. You can reference this ELF file name in the scatter file.
.ANY(+RO)used to select sections generated by link time optimization.
It is not possible to match bitcode in
.llvmbcsections by name in a scatter file.
NoteThe scatter-loading interface is subject to change in future versions of ARM Compiler 6.
- Executable and library compatibility
armclangexecutable and the
libLTOlibrary must come from the same ARM Compiler 6 installation. Any use of
libLTOother than that supplied with ARM Compiler 6 is unsupported.
- Other restrictions
- You cannot currently use link time optimization for building ROPI/RWPI images.
- Object files that are produced by the link time
optimization contain build attributes that are the default for the
target architecture. If you use the armlink options
--fpuwhen link time optimization is enabled, armlink can incorrectly report that the attributes in the file produced by the link time optimizer are incompatible with the provided attributes.
- Link Time Optimization does not honor armclang options
Link Time Optimization does not
-mexecute-onlyoption. If you use the
-Omaxoptions, then the compiler cannot generate execute-only code.