Uploaded image for project: 'Embedded Software & Tools'
  1. Embedded Software & Tools
  2. EXT_EP-10827

tiarmclang: LTO behaves differently than non-LTO with regards to how zero-initialized variables are defined

    XMLWordPrintable

Details

    • Bug
    • Status: Fixed
    • High
    • Resolution: Fixed
    • Code Generation Tools
    • CODEGEN-9997
    • ARMCLANG_2.1.0.BETA1
    • ARMCLANG_2.1.0.LTS*
    • default
    • No known workaround.

    Description

      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.

      Attachments

        Activity

          People

            syncuser TI User
            syncuser TI User
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: