Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2013-05-09 03:13:51 +0400
committerJeff Johnston <jjohnstn@redhat.com>2013-05-09 03:13:51 +0400
commit1b7ad41e50ce327c3258d5a33e2cb86f2c855192 (patch)
treea1822c535879d5dc3ecbdbf0c15fd11b3cb354f6 /newlib/libc/stdlib
parentad48b1b79c64baafaa029f67ce83ed5e47286c0b (diff)
2013-05-07 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libc/include/sys/config.h (_REENT_GLOBAL_ATEXIT): Define for RTEMS. * libc/include/sys/reent.h (_reent): Use _REENT_GLOBAL_ATEXIT. (_global_atexit): Declare if _REENT_GLOBAL_ATEXIT is defined. * libc/reent/reent.c (_reclaim_reent): Remove atexit cleanup if _REENT_GLOBAL_ATEXIT is defined. (_wrapup_reent): Remove atexit handling if _REENT_GLOBAL_ATEXIT is defined. * libc/stdlib/__atexit.c (_global_atexit0): Define if _REENT_GLOBAL_ATEXIT is defined. * libc/stdlib/__call_atexit.c (_global_atexit): Define if _REENT_GLOBAL_ATEXIT is defined.
Diffstat (limited to 'newlib/libc/stdlib')
-rw-r--r--newlib/libc/stdlib/__atexit.c7
-rw-r--r--newlib/libc/stdlib/__call_atexit.c4
2 files changed, 10 insertions, 1 deletions
diff --git a/newlib/libc/stdlib/__atexit.c b/newlib/libc/stdlib/__atexit.c
index a095313d3..f04f00d8e 100644
--- a/newlib/libc/stdlib/__atexit.c
+++ b/newlib/libc/stdlib/__atexit.c
@@ -15,7 +15,12 @@ void * malloc(size_t) _ATTRIBUTE((__weak__));
extern _LOCK_RECURSIVE_T __atexit_lock;
#endif
-#define _GLOBAL_ATEXIT0 (&_GLOBAL_REENT->_atexit0)
+#ifdef _REENT_GLOBAL_ATEXIT
+static struct _atexit _global_atexit0 = _ATEXIT_INIT;
+# define _GLOBAL_ATEXIT0 (&_global_atexit0)
+#else
+# define _GLOBAL_ATEXIT0 (&_GLOBAL_REENT->_atexit0)
+#endif
/*
* Register a function to be performed at exit or on shared library unload.
diff --git a/newlib/libc/stdlib/__call_atexit.c b/newlib/libc/stdlib/__call_atexit.c
index 76d3f1223..1e6e71044 100644
--- a/newlib/libc/stdlib/__call_atexit.c
+++ b/newlib/libc/stdlib/__call_atexit.c
@@ -13,6 +13,10 @@ void free(void *) _ATTRIBUTE((__weak__));
__LOCK_INIT_RECURSIVE(, __atexit_lock);
+#ifdef _REENT_GLOBAL_ATEXIT
+struct _atexit *_global_atexit = _NULL;
+#endif
+
#ifdef _WANT_REGISTER_FINI
/* If "__libc_fini" is defined, finalizers (either