}
}
}
- else
+ else if (match->l_info[DT_HASH] != NULL)
{
- const ElfW(Sym) *symtabend;
- if (match->l_info[DT_HASH] != NULL)
- symtabend = (symtab
- + ((Elf_Symndx *) D_PTR (match, l_info[DT_HASH]))[1]);
- else
- /* There is no direct way to determine the number of symbols in the
- dynamic symbol table and no hash table is present. The ELF
- binary is ill-formed but what shall we do? Use the beginning of
- the string table which generally follows the symbol table. */
- symtabend = (const ElfW(Sym) *) strtab;
+ const ElfW (Sym) *symtabend
+ = (symtab + ((Elf_Symndx *) D_PTR (match, l_info[DT_HASH]))[1]);
for (; (void *) symtab < (void *) symtabend; ++symtab)
if ((ELFW(ST_BIND) (symtab->st_info) == STB_GLOBAL
&& symtab->st_name < strtabsize)
matchsym = (ElfW(Sym) *) symtab;
}
+ /* In the absence of a hash table, treat the object as if it has no symbol.
+ */
if (mapp)
*mapp = match;