This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: 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:34:29 -0800
- Subject: Re: PATCH: [BZ #15030]: do_lookup_x returns undefined symbol entry
- References: <20130117203003.GA30789@intel.com>
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
On Thu, Jan 17, 2013 at 12:30:03PM -0800, H.J. Lu wrote:
> 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?
>
>
It should be SHN_UNDEF, not STN_UNDEF.
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..dc8ecef 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 != SHN_UNDEF)
goto found_it;
}
}