aboutsummaryrefslogtreecommitdiff
path: root/elf/dl-lookup.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-07-23 07:07:53 -0700
committerUlrich Drepper <drepper@redhat.com>2009-07-23 07:07:53 -0700
commit802fe9a1ca0577e8eac28c31a8c20497b15e7e69 (patch)
tree9a9b5daed16d5797ce46aaef6513aa598e6f9790 /elf/dl-lookup.c
parent0122f28eb99351c1b1690d5e2613988452d04583 (diff)
downloadglibc-802fe9a1ca0577e8eac28c31a8c20497b15e7e69.tar
glibc-802fe9a1ca0577e8eac28c31a8c20497b15e7e69.tar.gz
glibc-802fe9a1ca0577e8eac28c31a8c20497b15e7e69.tar.bz2
glibc-802fe9a1ca0577e8eac28c31a8c20497b15e7e69.zip
Handle unloading of DSO with a unique symbol definition.
Diffstat (limited to 'elf/dl-lookup.c')
-rw-r--r--elf/dl-lookup.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index fd0d624430..bdc84afa56 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -312,7 +312,7 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash,
definition we have to use it. */
void enter (struct unique_sym *table, size_t size,
unsigned int hash, const char *name,
- const ElfW(Sym) *sym, const struct link_map *map)
+ const ElfW(Sym) *sym, struct link_map *map)
{
size_t idx = hash % size;
size_t hash2 = 1 + hash % (size - 2);
@@ -332,6 +332,12 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash,
table[idx].sym = sym;
table[idx].map = map;
}
+
+ if (table[idx].map->l_type == lt_loaded)
+ /* Make sure we don't unload this object by
+ artificially increason the open count. */
+ ++table[idx].map->l_direct_opencount;
+
return;
}
@@ -410,7 +416,8 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash,
tab->free = free;
}
- enter (entries, size, new_hash, strtab + sym->st_name, sym, map);
+ enter (entries, size, new_hash, strtab + sym->st_name, sym,
+ (struct link_map *) map);
++tab->n_elements;
__rtld_lock_unlock_recursive (tab->lock);