-
Bug
-
Resolution: Fixed
-
High
-
Code Generation Tools
-
CODEGEN-9997
-
ARMCLANG_2.1.0.BETA1
-
ARMCLANG_2.1.0.LTS*
-
default
-
No known workaround.
Compiling a simple application without LTO enabled and the default settings for the -fdef-uninit-in-bss and -fno-zero-initialized-in-bss compiler options will define zero-initialized variables in an initialized section.
However, if LTO is enabled for the build of the same application, the -fno-zero-initialized-in-bss compiler option is not propagated to the LTO recompile that happens at link-time. This results in zero-initialized variables being defined in uninitialized section since, by default, the LLVM LTO code generation will assume that the loader has zero-initialized BSS.
This is not the default behavior for the tiarmclang compiler tools. The default behavior for the tiarmclang tools is -fno-zero-initialized-in-bss (so that tiarmclang's default behavior mimics the default behavior for the TI proprietary Arm compiler (armcl)). To fix this issue, the tiarmclang compiler must communicate the state of the -f[no-]zero-initialized-in-bss compiler option to the linker so that this information can be passed on to the LTO recompile.