This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Removing atexit code from rt-library on msp430



In an effort to reduce code size I would like to remove the __TI_atexit() functionality from the rt-library and thus also remove malloc/free code. This should also remove all destructors for static objects that will never be called due to the design of the codebase.

The problem is I can't redirect those functions to my code because the compiler complains, and there seems no way to disable them short of modifying the rt-library code itself.

Any suggestions? This is for an msp430.

  • There is no way to control the fact that the parser will generate a call to an atexit-related destructor registration routine for each global object with a destructor.  However, you could minimize the added code by adding to your project a replacement function that does nothing.  Are you using COFF ABI or EABI?  If COFF ABI, the function is named _add_dtor; if EABI, the function is named __cxa_atexit.  Note: this method is untested and unsupported.