[uClibc-cvs] svn commit: trunk/uClibc/libc: misc/internals stdlib

jocke at uclibc.org jocke at uclibc.org
Sun Mar 20 17:45:03 UTC 2005


Author: jocke
Date: 2005-03-20 10:45:03 -0700 (Sun, 20 Mar 2005)
New Revision: 10045

Log:
Prepare for moving ldso FINI handling into libc.
#define _DL_DO_FINI_IN_LIBC to enable(the arch specific part needs to be in place first).


Modified:
   trunk/uClibc/libc/misc/internals/__uClibc_main.c
   trunk/uClibc/libc/stdlib/atexit.c


Changeset:
Modified: trunk/uClibc/libc/misc/internals/__uClibc_main.c
===================================================================
--- trunk/uClibc/libc/misc/internals/__uClibc_main.c	2005-03-20 17:29:58 UTC (rev 10044)
+++ trunk/uClibc/libc/misc/internals/__uClibc_main.c	2005-03-20 17:45:03 UTC (rev 10045)
@@ -155,16 +155,18 @@
 }
 
 #ifdef __UCLIBC_CTOR_DTOR__
-void (*__app_fini)(void) = NULL;
+void attribute_hidden (*__app_fini)(void) = NULL;
 #endif
 
+void attribute_hidden (*__rtld_fini)(void) = NULL;
+
 /* __uClibc_start_main is the new main stub for uClibc. This function is
  * called from crt0 (version 0.9.16 or newer), after ALL shared libraries
  * are initialized, just before we call the application's main function.
  */
 void __attribute__ ((__noreturn__))
 __uClibc_start_main(int argc, char **argv, char **envp,
-	void (*app_init)(void), void (*app_fini)(void))
+	void (*app_init)(void), void (*app_fini)(void), void (*rtld_fini)(void))
 {
 #ifdef __ARCH_HAS_MMU__
     unsigned long *aux_dat;
@@ -176,6 +178,8 @@
      * __uClibc_init() regardless, to be sure the right thing happens. */
     __uClibc_init();
 
+    __rtld_fini = rtld_fini;
+
     /* If we are dynamically linked, then ldso already did this for us. */
     if (__environ==NULL) {
 	/* Statically linked. */
@@ -260,6 +264,6 @@
 void __attribute__ ((__noreturn__))
 __uClibc_main(int argc, char **argv, char ** envp)
 {
-    __uClibc_start_main(argc, argv, envp, NULL, NULL);
+    __uClibc_start_main(argc, argv, envp, NULL, NULL, NULL);
 }
 

Modified: trunk/uClibc/libc/stdlib/atexit.c
===================================================================
--- trunk/uClibc/libc/stdlib/atexit.c	2005-03-20 17:29:58 UTC (rev 10044)
+++ trunk/uClibc/libc/stdlib/atexit.c	2005-03-20 17:45:03 UTC (rev 10045)
@@ -222,6 +222,7 @@
 extern void (*__app_fini)(void);
 #endif
 
+extern void (*__rtld_fini)(void);
 /*
  * Normal program termination
  */
@@ -238,6 +239,11 @@
 	if (__app_fini != NULL)
 		(__app_fini)();
 #endif
+#ifdef _DL_DO_FINI_IN_LIBC
+/* arches that has moved their ldso FINI handling should #define _DL_DO_FINI_IN_LIBC */
+	if (__rtld_fini != NULL)
+		(__rtld_fini)();
+#endif
 
     /* If we are using stdio, try to shut it down.  At the very least,
 	 * this will attempt to commit all buffered writes.  It may also




More information about the uClibc-cvs mailing list