From dae8a4ede6fec3e6f87f101c2708c2669c4075fa Mon Sep 17 00:00:00 2001 From: Joakim Tjernlund Date: Sat, 31 Mar 2007 13:42:48 +0000 Subject: Bernd Schmidt writes: Currently a static libdl.a doesn't run all the constructors or destructors of the libraries it loads. I can't see a good reason for that, and it does cause aborts in the destructors it does run for things like libgcc.so on the Blackfin. Fixed with the patch below - untested in mainline, but the equivalent has been in our Blackfin tree for a while now. --- ldso/libdl/libdl.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'ldso/libdl') diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c index e8a916c84..f018c0a0d 100644 --- a/ldso/libdl/libdl.c +++ b/ldso/libdl/libdl.c @@ -90,6 +90,7 @@ size_t _dl_pagesize = PAGE_SIZE; /* Store the page size for use later /* This global variable is also to communicate with debuggers such as gdb. */ struct r_debug *_dl_debug_addr = NULL; #define _dl_malloc malloc +#include "../ldso/dl-array.c" #include "../ldso/dl-debug.c" #include LDSO_ELFINTERP #include "../ldso/dl-hash.c" @@ -395,7 +396,6 @@ void *dlopen(const char *libname, int flag) } } -#ifdef SHARED /* Run the ctors and setup the dtors */ for (i = nlist; i; --i) { tpnt = init_fini_list[i-1]; @@ -415,7 +415,6 @@ void *dlopen(const char *libname, int flag) _dl_run_init_array(tpnt); } -#endif /* SHARED */ _dl_unmap_cache(); return (void *) dyn_chain; @@ -535,9 +534,7 @@ static int do_dlclose(void *vhandle, int need_fini) && need_fini && !(tpnt->init_flag & FINI_FUNCS_CALLED)) { tpnt->init_flag |= FINI_FUNCS_CALLED; -#ifdef SHARED _dl_run_fini_array(tpnt); -#endif if (tpnt->dynamic_info[DT_FINI]) { dl_elf_fini = (int (*)(void)) DL_RELOC_ADDR(tpnt->loadaddr, tpnt->dynamic_info[DT_FINI]); -- cgit v1.2.3