summaryrefslogtreecommitdiff
path: root/ldso/libdl/libdl.c
diff options
context:
space:
mode:
authorJoakim Tjernlund <joakim.tjernlund@transmode.se>2007-03-31 13:42:48 +0000
committerJoakim Tjernlund <joakim.tjernlund@transmode.se>2007-03-31 13:42:48 +0000
commitdae8a4ede6fec3e6f87f101c2708c2669c4075fa (patch)
tree4cbe358ff1e21a00108eb01520b252395e90b663 /ldso/libdl/libdl.c
parent39d1a8c871a46e603a60f210b6aa19bf7d1eedc4 (diff)
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.
Diffstat (limited to 'ldso/libdl/libdl.c')
-rw-r--r--ldso/libdl/libdl.c5
1 files changed, 1 insertions, 4 deletions
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]);