From deec524084aa2faad66f7aae7e8b5ba1ab6789fd Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Sat, 14 Feb 2004 11:30:39 +0000 Subject: Joakim Tjernlund writes: Hi it is me again. This is the latest ldso patch. the NEW weak symbol handling works now with a little special handling in _dl_find_hash(). You get to chose if you want the new or old handling :) There was 2 missing _dl_check_if_named_library_is_loaded() calls in _dlopen(). I then disabled the _dl_check_if_named_library_is_loaded() in dl-elf.c since it is rendundant. Question, why does some _dl_linux_resolver(), like i386, have 2 calls to _dl_find_hash()? I think that is wrong, isn't it? I really hope you can check this out soon ... --- ldso/libdl/libdl.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'ldso/libdl/libdl.c') diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c index f3bc89abd..5d7c22b85 100644 --- a/ldso/libdl/libdl.c +++ b/ldso/libdl/libdl.c @@ -30,7 +30,7 @@ static void __attribute__ ((unused)) foobar(void) static int __attribute__ ((unused)) foobar1 = (int) foobar; /* Use as pointer */ extern void _dl_dprintf(int, const char *, ...) __attribute__ ((__weak__, __alias__ ("foobar"))); -extern char *_dl_find_hash(const char *, struct dyn_elf *, struct elf_resolve *, enum caller_type) +extern char *_dl_find_hash(const char *, struct dyn_elf *, int) __attribute__ ((__weak__, __alias__ ("foobar"))); extern struct elf_resolve * _dl_load_shared_library(int, struct dyn_elf **, struct elf_resolve *, char *, int) __attribute__ ((__weak__, __alias__ ("foobar"))); @@ -179,6 +179,7 @@ void *_dlopen(const char *libname, int flag) if(_dl_debug) _dl_dprintf(_dl_debug_file, "Trying to dlopen '%s'\n", (char*)libname); #endif + if (!(tpnt = _dl_check_if_named_library_is_loaded((char *)libname, 0))) tpnt = _dl_load_shared_library(0, &rpnt, tfrom, (char*)libname, 0); if (tpnt == NULL) { _dl_unmap_cache(); @@ -220,6 +221,9 @@ void *_dlopen(const char *libname, int flag) dpnt->d_un.d_val); name = _dl_get_last_path_component(lpntstr); + if ((tpnt1 = _dl_check_if_named_library_is_loaded(name, 0))) + continue; + #ifdef __SUPPORT_LD_DEBUG__ if(_dl_debug) _dl_dprintf(_dl_debug_file, "Trying to load '%s', needed by '%s'\n", @@ -381,7 +385,7 @@ void *_dlsym(void *vhandle, const char *name) } } - ret = _dl_find_hash((char*)name, handle, NULL, copyrel); + ret = _dl_find_hash((char*)name, handle, 0); /* * Nothing found. -- cgit v1.2.3