This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
PATCH: [BZ #15030]: do_lookup_x returns undefined symbol entry
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Date: Thu, 17 Jan 2013 12:30:03 -0800
- Subject: PATCH: [BZ #15030]: do_lookup_x returns undefined symbol entry
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
do_lookup_x has
/* Use the old SysV-style hash table. Search the appropriate
hash bucket in this object's symbol table for a definition
for the same symbol name. */
for (symidx = map->l_buckets[*old_hash % map->l_nbuckets];
symidx != STN_UNDEF;
symidx = map->l_chain[symidx])
{
sym = check_match (&symtab[symidx]);
if (sym != NULL)
goto found_it;
}
With the old SysV-style hash table, we may return undefined symbol entry.
We don't run into this problem often since GNU-style hash table is enabled
by most GCC. This patch skips undefined symbol entry. Tested on ia32
and x86-64. OK to install?
H.J.
---
2013-01-17 H.J. Lu <hongjiu.lu@intel.com>
[BZ #15030]
* dl-lookup.c (do_lookup_x): Skip undefined symbol entry with
the old SysV-style hash table.
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index 68f8dac..5941775 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -270,7 +270,7 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash,
symidx = map->l_chain[symidx])
{
sym = check_match (&symtab[symidx]);
- if (sym != NULL)
+ if (sym != NULL && sym->st_shndx != STN_UNDEF)
goto found_it;
}
}