[uClibc-cvs] uClibc/ldso/libdl dlib.c,1.25,1.26
Erik Andersen
andersen at uclibc.org
Fri Jun 27 11:45:15 UTC 2003
Update of /var/cvs/uClibc/ldso/libdl
In directory winder:/tmp/cvs-serv26780
Modified Files:
dlib.c
Log Message:
Run dlopened ctors and dtors in the correct order
Index: dlib.c
===================================================================
RCS file: /var/cvs/uClibc/ldso/libdl/dlib.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- dlib.c 1 Mar 2003 07:47:08 -0000 1.25
+++ dlib.c 27 Jun 2003 11:45:12 -0000 1.26
@@ -181,7 +181,7 @@
//tpnt->libtype = loaded_file;
dyn_chain = rpnt = (struct dyn_elf *) malloc(sizeof(struct dyn_elf));
- _dl_memset(rpnt, 0, sizeof(*rpnt));
+ _dl_memset(rpnt, 0, sizeof(struct dyn_elf));
rpnt->dyn = tpnt;
rpnt->flags = flag;
if (!tpnt->symbol_scope)
@@ -213,7 +213,7 @@
goto oops;
rpnt->next = (struct dyn_elf *) malloc(sizeof(struct dyn_elf));
- _dl_memset (rpnt->next, 0, sizeof (*(rpnt->next)));
+ _dl_memset (rpnt->next, 0, sizeof (struct dyn_elf));
rpnt = rpnt->next;
if (!tpnt1->symbol_scope) tpnt1->symbol_scope = dyn_chain;
rpnt->dyn = tpnt1;
@@ -254,8 +254,12 @@
}
#ifdef __PIC__
- for (rpnt = dyn_chain; rpnt; rpnt = rpnt->next) {
- tpnt = rpnt->dyn;
+ /* Find the last library */
+ for (tpnt = dyn_chain->dyn; tpnt->next!=NULL; tpnt = tpnt->next)
+ ;
+ /* Run the ctors and set up the dtors */
+ for (; tpnt != dyn_chain->dyn->prev; tpnt=tpnt->prev)
+ {
/* Apparently crt1 for the application is responsible for handling this.
* We only need to run the init/fini for shared libraries
*/
More information about the uClibc-cvs
mailing list