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

Compiler ignores __attribute__((used))

    XMLWordPrintable

Details

    • Bug
    • Status: Fixed
    • Medium
    • Resolution: Fixed
    • Code Generation Tools
    • CODEGEN-9834
    • ARMCLANG_2.0.0.STS
    • ARMCLANG_2.1.0.LTS*
    • default
    • use __attribute__((retain)) This does the same thing on tiarmclang.

    Description

      Extract the attached zip file to an empty directory.  The source file keep.c has this line ...

      static const int KEEP_VAR __attribute__((used)) = 0;
      

      Make changes to the Makefile as needed for path, or the host system, etc. Then build ...

      % gmake
      C:\ti\compilers\ti-cgt-armllvm_1.3.0.LTS\bin\tiarmclang -O3 -mcpu=cortex-m0 -Xlinker linker.cmd main.c keep.c -o old.out
      C:\ti\compilers\ti-cgt-armllvm_1.3.0.LTS\bin\tiarmobjdump --syms old.out | findstr KEEP_VAR
      00000064 l     O .rodata        00000004 KEEP_VAR
      C:\ti\compilers\ti-cgt-armllvm_2.0.0.STS\bin\tiarmclang -O3 -mcpu=cortex-m0 -Xlinker linker.cmd main.c keep.c -o new.out
      C:\ti\compilers\ti-cgt-armllvm_2.0.0.STS\bin\tiarmobjdump --syms new.out | findstr KEEP_VAR
      makefile:16: recipe for target 'check_new' failed
      gmake: *** [check_new] Error 1
      

      The build with version 1.3.0.LTS keeps the variable KEEP_VAR. The build with version 2.0.0.STS does not.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: