f1a8ff51647d010c79bcf80eba144e73b38e665d
[openwrt/openwrt.git] / toolchain / uClibc / patches-0.9.33.2 / 011-dlsym_rtld_next_fix.patch
1 --- a/ldso/libdl/libdl.c
2 +++ b/ldso/libdl/libdl.c
3 @@ -671,7 +671,7 @@ static void *do_dlsym(void *vhandle, con
4 {
5 struct elf_resolve *tpnt, *tfrom;
6 struct dyn_elf *handle;
7 - ElfW(Addr) from;
8 + ElfW(Addr) from = 0;
9 struct dyn_elf *rpnt;
10 void *ret;
11 struct symbol_ref sym_ref = { NULL, NULL };
12 @@ -729,7 +729,12 @@ static void *do_dlsym(void *vhandle, con
13 tpnt = NULL;
14 if (handle == _dl_symbol_tables)
15 tpnt = handle->dyn; /* Only search RTLD_GLOBAL objs if global object */
16 - ret = _dl_find_hash(name2, &handle->dyn->symbol_scope, tpnt, ELF_RTYPE_CLASS_DLSYM, &sym_ref);
17 + do {
18 + ret = _dl_find_hash(name2, &handle->dyn->symbol_scope, tpnt, ELF_RTYPE_CLASS_DLSYM, &sym_ref);
19 + if (ret != NULL)
20 + break;
21 + handle = handle->next;
22 + } while (from && handle);
23
24 #if defined(USE_TLS) && USE_TLS && defined SHARED
25 if (sym_ref.sym && (ELF_ST_TYPE(sym_ref.sym->st_info) == STT_TLS) && (sym_ref.tpnt)) {