summaryrefslogtreecommitdiffstats
path: root/newlib/libc/stdlib
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/stdlib')
-rw-r--r--newlib/libc/stdlib/__atexit.c10
-rw-r--r--newlib/libc/stdlib/__call_atexit.c4
2 files changed, 8 insertions, 6 deletions
diff --git a/newlib/libc/stdlib/__atexit.c b/newlib/libc/stdlib/__atexit.c
index 1caf2e56b..a095313d3 100644
--- a/newlib/libc/stdlib/__atexit.c
+++ b/newlib/libc/stdlib/__atexit.c
@@ -15,6 +15,8 @@ void * malloc(size_t) _ATTRIBUTE((__weak__));
extern _LOCK_RECURSIVE_T __atexit_lock;
#endif
+#define _GLOBAL_ATEXIT0 (&_GLOBAL_REENT->_atexit0)
+
/*
* Register a function to be performed at exit or on shared library unload.
*/
@@ -34,9 +36,9 @@ _DEFUN (__register_exitproc,
__lock_acquire_recursive(__atexit_lock);
#endif
- p = _GLOBAL_REENT->_atexit;
+ p = _GLOBAL_ATEXIT;
if (p == NULL)
- _GLOBAL_REENT->_atexit = p = &_GLOBAL_REENT->_atexit0;
+ _GLOBAL_ATEXIT = p = _GLOBAL_ATEXIT0;
if (p->_ind >= _ATEXIT_SIZE)
{
#ifndef _ATEXIT_DYNAMIC_ALLOC
@@ -56,8 +58,8 @@ _DEFUN (__register_exitproc,
return -1;
}
p->_ind = 0;
- p->_next = _GLOBAL_REENT->_atexit;
- _GLOBAL_REENT->_atexit = p;
+ p->_next = _GLOBAL_ATEXIT;
+ _GLOBAL_ATEXIT = p;
#ifndef _REENT_SMALL
p->_on_exit_args._fntypes = 0;
p->_on_exit_args._is_cxa = 0;
diff --git a/newlib/libc/stdlib/__call_atexit.c b/newlib/libc/stdlib/__call_atexit.c
index a21dd5733..76d3f1223 100644
--- a/newlib/libc/stdlib/__call_atexit.c
+++ b/newlib/libc/stdlib/__call_atexit.c
@@ -76,8 +76,8 @@ _DEFUN (__call_exitprocs, (code, d),
restart:
- p = _GLOBAL_REENT->_atexit;
- lastp = &_GLOBAL_REENT->_atexit;
+ p = _GLOBAL_ATEXIT;
+ lastp = &_GLOBAL_ATEXIT;
while (p)
{
#ifdef _REENT_SMALL