Disable registration of atexit handlers on ARMCC.

This prevent destructors for global C++ objects to be invoked at exit.
By default atexit handlers registration involved dynamic allocation.
pull/2745/head
Vincent Coubard 2016-09-19 13:29:29 +01:00
parent 2f0b772c77
commit b67d863c0a
1 changed files with 25 additions and 0 deletions

View File

@ -629,6 +629,31 @@ extern "C" void exit(int return_code) {
} //namespace std
#endif
#if defined(TOOLCHAIN_ARM)
// This series of function disable the registration of global destructors
// in a dynamic table which will be called when the application exit.
// In mbed, program never exit properly, it dies.
// More informations about this topic for ARMCC here:
// http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/6449.html
extern "C" {
int __aeabi_atexit(void *object, void (*dtor)(void* /*this*/), void *handle) {
return 1;
}
int __cxa_atexit(void (*dtor)(void* /*this*/), void *object, void *handle) {
return 1;
}
void __cxa_finalize(void *handle) {
}
} // end of extern "C"
#endif
namespace mbed {