diff options
author | Eric Andersen <andersen@codepoet.org> | 2003-01-23 14:03:02 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2003-01-23 14:03:02 +0000 |
commit | 72c3d34323756a765ba4c635abf997c2c2584489 (patch) | |
tree | 9e9389f70950e7c250a464c8672fb49c9319744f /libc/misc | |
parent | a81c2218a2c2eaa35559ea83338f2c30140a4810 (diff) |
Making atexit weak does nothing for dynamicly linked apps. And for
staticly linked apps it entirely prevents destructors from running
unless atexit is called for some other reason. So if they enabled
ctor/dtor support we need to have a call to the real atexit for
dtors to work properly. If people don't want the extra 4k or so
of junk in their static apps, they should leave ctor/dtor support
disabled.
-Erik
Diffstat (limited to 'libc/misc')
-rw-r--r-- | libc/misc/internals/__uClibc_main.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c index aa4655cec..9561ac492 100644 --- a/libc/misc/internals/__uClibc_main.c +++ b/libc/misc/internals/__uClibc_main.c @@ -12,6 +12,7 @@ */ #define _ERRNO_H +#include <features.h> #include <unistd.h> #include <stdlib.h> @@ -23,7 +24,6 @@ extern int main(int argc, char **argv, char **envp); extern void weak_function _stdio_init(void); extern int *weak_const_function __errno_location(void); extern int *weak_const_function __h_errno_location(void); -extern int weak_function atexit(void (*function)(void)); #ifdef __UCLIBC_HAS_LOCALE__ extern void weak_function _locale_init(void); #endif @@ -123,15 +123,17 @@ __uClibc_start_main(int argc, char **argv, char **envp, * __uClibc_init() regardless, to be sure the right thing happens. */ __uClibc_init(); +#ifdef __UCLIBC_CTOR_DTOR__ /* Arrange for the application's dtors to run before we exit. */ - if (app_fini!=NULL && atexit) { - atexit (app_fini); + if (app_fini!=NULL) { + atexit(app_fini); } /* Run all the application's ctors now. */ if (app_init!=NULL) { app_init(); } +#endif /* Note: It is possible that any initialization done above could * have resulted in errno being set nonzero, so set it to 0 before |