[uClibc-cvs] uClibc/libc/misc/internals __uClibc_main.c,1.26,1.27
Erik Andersen
andersen at codepoet.org
Thu Jan 23 14:03:06 UTC 2003
Update of /var/cvs/uClibc/libc/misc/internals
In directory winder:/tmp/cvs-serv4443/libc/misc/internals
Modified Files:
__uClibc_main.c
Log Message:
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
Index: __uClibc_main.c
===================================================================
RCS file: /var/cvs/uClibc/libc/misc/internals/__uClibc_main.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- __uClibc_main.c 1 Oct 2002 05:30:05 -0000 1.26
+++ __uClibc_main.c 23 Jan 2003 14:03:02 -0000 1.27
@@ -12,6 +12,7 @@
*/
#define _ERRNO_H
+#include <features.h>
#include <unistd.h>
#include <stdlib.h>
@@ -23,7 +24,6 @@
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_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
More information about the uClibc-cvs
mailing list