summaryrefslogtreecommitdiffstats
path: root/newlib/libc/stdlib/__atexit.c
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/stdlib/__atexit.c')
-rw-r--r--newlib/libc/stdlib/__atexit.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/newlib/libc/stdlib/__atexit.c b/newlib/libc/stdlib/__atexit.c
index a3d5bdfbf..23eab29a9 100644
--- a/newlib/libc/stdlib/__atexit.c
+++ b/newlib/libc/stdlib/__atexit.c
@@ -79,7 +79,14 @@ _DEFUN (__register_exitproc,
p = _GLOBAL_ATEXIT;
if (p == NULL)
- _GLOBAL_ATEXIT = p = _GLOBAL_ATEXIT0;
+ {
+ _GLOBAL_ATEXIT = p = _GLOBAL_ATEXIT0;
+#ifdef _REENT_SMALL
+ extern struct _on_exit_args * const __on_exit_args _ATTRIBUTE ((weak));
+ if (&__on_exit_args != NULL)
+ p->_on_exit_args_ptr = __on_exit_args;
+#endif /* def _REENT_SMALL */
+ }
if (p->_ind >= _ATEXIT_SIZE)
{
#ifndef _ATEXIT_DYNAMIC_ALLOC