This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Should undefined symbols in sysv hash table be ignored in do_lookup_x?
On Thu, Feb 7, 2013 at 5:03 PM, Roland McGrath <roland@hack.frob.com> wrote:
>
> Anyway, while the linker putting other SHN_UNDEF symbols in the hash table
> would be a linker bug if it happened (since the only purpose of the hash
> table is for symbol table entries that might need to be looked up by name),
> I don't think we would or should consider it a violation of the format.
> So the treatment of symbol table entries should be completely identical
> regardless of which hash table format was involved in locating them.
>
Since there are no SHN_UNDEF TLS symbols in gnu hash table,
we don't need to check it in check_match. We only need to check
it for sysv hash table:
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index 68f8dac..4e01cfd 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -270,7 +270,9 @@ 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
+ || ELFW(ST_TYPE) (sym->st_info) != STT_TLS))
goto found_it;
}
}
--
H.J.