Skip to content

Commit

Permalink
Some more fixes for the unique symbol handling.
Browse files Browse the repository at this point in the history
The hash value can be zero, so we need a different test for empty
slots.  And unify the way we prevent a DSO from being unloaded.
  • Loading branch information
Ulrich Drepper committed Jul 23, 2009
1 parent 802fe9a commit 077e770
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
2009-07-23 Ulrich Drepper <drepper@redhat.com>

* elf/dl-lookup.c (dl_lookup_x): The hashval for unique symbol can
potentially be zero.

* elf/tst-unique1.c: Extend test to check for unloading DSO with
unique symbol definition.
Patch by Jakub Jelinek.
Expand Down
9 changes: 4 additions & 5 deletions elf/dl-lookup.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash,
size_t hash2 = 1 + hash % (size - 2);
while (1)
{
if (table[idx].hashval == 0)
if (table[idx].name == NULL)
{
table[idx].hashval = hash;
table[idx].name = strtab + sym->st_name;
Expand All @@ -336,7 +336,7 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash,
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;
table[idx].map->l_flags_1 |= DF_1_NODELETE;

return;
}
Expand Down Expand Up @@ -369,8 +369,7 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash,
return 1;
}

if (entries[idx].hashval == 0
&& entries[idx].name == NULL)
if (entries[idx].name == NULL)
break;

idx += hash2;
Expand All @@ -392,7 +391,7 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash,
}

for (idx = 0; idx < size; ++idx)
if (entries[idx].hashval != 0)
if (entries[idx].name != NULL)
enter (newentries, newsize, entries[idx].hashval,
entries[idx].name, entries[idx].sym,
entries[idx].map);
Expand Down

0 comments on commit 077e770

Please sign in to comment.