diff options
Diffstat (limited to 'newlib/libc/stdlib')
-rw-r--r-- | newlib/libc/stdlib/__atexit.c | 7 | ||||
-rw-r--r-- | newlib/libc/stdlib/__call_atexit.c | 4 |
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 |