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

C2000 compiler ignores retain attribute/pragma for CLA functions

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Medium Medium
    • Code Generation Tools
    • CODEGEN-12560
    • Hide
      C2000_22.6.0.LTS
      C2000_21.6.0.LTS
      C2000_18.12.0.LTS
      C2000_20.2.0.LTS
      Show
      C2000_22.6.0.LTS C2000_21.6.0.LTS C2000_18.12.0.LTS C2000_20.2.0.LTS
    • Hide
      C2000_25.3.0.LTS*
      C2000_22.6.2.LTS*
      C2000_21.6.2.LTS*
      Show
      C2000_25.3.0.LTS* C2000_22.6.2.LTS* C2000_21.6.2.LTS*
    • default
    • Hide
      Either of below will retain cla_func_to_retain():
      - Use below linker option:
        --undef_sym=cla_func_to_retain
      - Or place below in file.cla prior to definition of function cla_func_to_retain:
        NOTE: Cla1Prog is the output section for CLA code in linker cmd file:
        __asm("\t .retain "Cla1Prog:cla_func_to_retain"\n");
      Show
      Either of below will retain cla_func_to_retain(): - Use below linker option:   --undef_sym=cla_func_to_retain - Or place below in file.cla prior to definition of function cla_func_to_retain:   NOTE: Cla1Prog is the output section for CLA code in linker cmd file:   __asm("\t .retain "Cla1Prog:cla_func_to_retain"\n");

      The attached f1.c has these lines ...

      int main()
      {
         return 0;
      }
      

      The attached f2.cla has these lines ...

      __attribute__((retain))
      void cla_function_not_called()
      {
         __mdebugstop();
      }
      

      Build it for EABI. Test for whether the CLA function is present.

      % cl2000 --abi=eabi --cla_support=cla2 f1.c
      % cl2000 --abi=eabi --cla_support=cla2 f2.cla
      % cl2000 -z f1.obj f2.obj -o test.out -c
      <Linking>
      % nm2000 test.out | findstr cla_function_not_called
      
      

      The retain function is not present.

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

              Created:
              Updated: