Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: HelloWorld_CCA01M1 HelloWorld_CCA02M1 CI-data-logger-server HelloWorld_CCA02M1 ... more
This is a fork of the events subdirectory of https://github.com/ARMmbed/mbed-os.
Note, you must import this library with import name: events!!!
Diff: hal/common/retarget.cpp
- Revision:
- 7987:0474ba76d193
- Parent:
- 7985:90dbfa1a67e6
- Child:
- 8147:c2e43990f039
--- a/hal/common/retarget.cpp Mon Sep 19 13:54:50 2016 +0100
+++ b/hal/common/retarget.cpp Mon Sep 19 15:17:39 2016 +0100
@@ -629,7 +629,7 @@
} //namespace std
#endif
-#if defined(TOOLCHAIN_ARM)
+#if defined(TOOLCHAIN_ARM) || defined(TOOLCHAIN_GCC)
// This series of function disable the registration of global destructors
// in a dynamic table which will be called when the application exit.
@@ -650,6 +650,39 @@
} // end of extern "C"
+#endif
+
+
+#if defined(TOOLCHAIN_GCC)
+
+/*
+ * Depending on how newlib is configured, it is often not enough to define
+ * __aeabi_atexit, __cxa_atexit and __cxa_finalize in order to override the
+ * behavior regarding the registration of handlers with atexit.
+ *
+ * To overcome this limitation, exit and atexit are overriden here.
+ */
+extern "C"{
+
+/**
+ * @brief Retarget of exit for GCC.
+ * @details Unlike the standard version, this function doesn't call any function
+ * registered with atexit before calling _exit.
+ */
+void __wrap_exit(int return_code) {
+ _exit(return_code);
+}
+
+/**
+ * @brief Retarget atexit from GCC.
+ * @details This function will always fail and never register any handler to be
+ * called at exit.
+ */
+int __wrap_atexit(void (*func)()) {
+ return 1;
+}
+
+}
#endif