-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Medium
-
Code Generation Tools
-
CODEGEN-15251
-
ARMCLANG_5.1.0.LTS
-
ARMCLANG_5.1.1.LTS*
-
default
In the tiarmclang libc.a runtime library, divdf3_fast.c and muldf3_fast.c are forced to be compiled with FPU disabled to ensure calling convention consistency with the small assembly implementations of divdf3 and muldf3. However, the divdf3_fast and muldf3_fast object files are still combined with other objects that assume FPU is enabled for targets that use FPU.
This triggers an issue (see attachment email picture) when building an application with link-time optimization (LTO) and FPU enabled. The tiarmclang tools will invoke an IR linker to collect all available embedded IR into a combined IR that is then fed as input into the LTO re-compile. The IR linker will detect that the target triple for the divdf3_fast and muldf3_fast embedded IR are not compatible with the embedded IR from other object files in the application and emit a warning diagnostic.
For example, given a simple "Hello World!" program, the following tiarmclang command will yield the linker warning:
%> tiarmclang -mcpu=cortex-m4 -mfloat-abi=hard -O3 -flto hello.c -o hello.out -Wl,-llnk.cmd
warning: llvm-lto: Linking two modules of different target triples:
'/tmp/TIQZF9iSADT' is 'thumbv7em-ti-none-eabi' whereas 'ld-temp.o' is
'thumbv7em-ti-none-eabihf'
warning: llvm-lto: Linking two modules of different target triples:
'/tmp/TIQZFCkz1ft' is 'thumbv7em-ti-none-eabi' whereas 'ld-temp.o' is
'thumbv7em-ti-none-eabihf'
To resolve this, the divdf3_fast.c and muldf3_fast.c files should be compiled with LTO disabled (using the -fno-lto option) so that the resulting object files do not contain embedded IR and the linker will not try to add the divdf3_fast and muldf3_fast IR to the combined IR for the application.