-
Bug
-
Resolution: Fixed
-
High
-
Code Generation Tools
-
CODEGEN-10000
-
ARMCLANG_2.1.0.LTS
-
ARMCLANG_2.1.1.LTS*
-
default
-
Compile and link a simple main() program containing a printf() call with -mthumb option:
%> tiarmclang -mcpu=cortex-r4 -mthumb -mfloat-abi=soft -flto -O3 -v cutdown.c -o cutdown.out -Wl,-llnk.cmd,-mcutdown.map
When the resulting cutdown.out is loaded and run with load470, the simulator fails to decode an instruction at the beginning of a runtime library function that was compiled in ARM mode.
With Link-Time Optimization (LTO) turned on, the LTO generated object file contains a legitimate call from one ARM function to another ARM function that is annotated with a relocation to resolve the state and location of the callee function in the call instruction's opcode.
Unfortunately, the handling of the relocation is changing the BL instruction into a BLX instruction that will put the processor in THUMB mode before it arrives at the start of the ARM mode callee function.