The function __attribute__((destructor)) is silently ignored

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Medium
    • Code Generation Tools
    • CODEGEN-14222
    • Hide
      C29_1.0.0.LTS
      ARMCLANG_5.0.0.STS*
      ARMCLANG_4.0.0.LTS
      C29_2.0.0.STS
      ARMCLANG_3.2.0.LTS
      Show
      C29_1.0.0.LTS ARMCLANG_5.0.0.STS* ARMCLANG_4.0.0.LTS C29_2.0.0.STS ARMCLANG_3.2.0.LTS
    • Hide
      ARMCLANG_5.0.0.STS*
      C29_1.0.2.LTS*
      ARMCLANG_3.2.4.LTS*
      ARMCLANG_4.0.4.LTS
      C29_2.1.0.LTS*
      Show
      ARMCLANG_5.0.0.STS* C29_1.0.2.LTS* ARMCLANG_3.2.4.LTS* ARMCLANG_4.0.4.LTS C29_2.1.0.LTS*
    • default
    • Hide
      Use the standard RTS function atexit. For example:

          atexit(function_name_here); /* declared in <stdlib.h> */
      Show
      Use the standard RTS function atexit. For example:     atexit(function_name_here); /* declared in <stdlib.h> */

      The attached file has these lines ...

      __attribute__((destructor))
      void stub() {}
      
      int main()
      {
          return 0;
      }
      

      Build it down to assembly code ...

      tiarmclang -S file.c
      

      Inspect the assembly to see ...

      	.section	.fini_array,"a",%fini_array
      	.p2align	2
      	.long	stub(target1)
      

      An entry is made in the section .fini_array. But the startup and cleanup code in the compiler RTS library ignores this entry.

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

              Created:
              Updated:
              Resolved:

                Connection: Intermediate to External PROD System
                EXTSYNC-5684 - The function __attribute__((destruc...
                SYNCHRONIZED
                • Last Sync Date: