From d2bb300b9bb7917d33e3bc37fca3bf6ee6e5fcc4 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Mon, 21 Dec 2015 11:49:28 -0500 Subject: Add static instance of _on_exit_args for _REENT_SMALL platforms. 2015-12-21 Freddie Chopin * libc/stdlib/on_exit_args.{c,h}: New files. * libc/stdlib/Makefile.am: Add new source file. * libc/stdlib/Makefile.in: Regenerate. * libc/stdlib/__atexit.c (__register_exitproc): Initialize _on_exit_args_ptr field of _GLOBAL_ATEXIT on first run. * libc/stdlib/on_exit.c: Force linking of static instance of _on_exit_args. * libc/stdlib/cxa_atexit.c: Likewise. --- newlib/libc/stdlib/cxa_atexit.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'newlib/libc/stdlib/cxa_atexit.c') diff --git a/newlib/libc/stdlib/cxa_atexit.c b/newlib/libc/stdlib/cxa_atexit.c index c3c0d2a17..39a59d53a 100644 --- a/newlib/libc/stdlib/cxa_atexit.c +++ b/newlib/libc/stdlib/cxa_atexit.c @@ -8,6 +8,15 @@ #include #include "atexit.h" +#ifdef _REENT_SMALL + +#include "on_exit_args.h" + +/* force linking of static instance of _on_exit_args */ +const void * const __cxa_atexit_dummy = &__on_exit_args; + +#endif /* def _REENT_SMALL */ + /* * Register a function to be performed at exit or DSO unload. */ -- cgit v1.2.3