On Sat, 22 Dec 2012 02:18:36 +0100, Mark Wielaard wrote:
--- a/libdwfl/dwfl_module_getsym.c
+++ b/libdwfl/dwfl_module_getsym.c
@@ -43,7 +43,14 @@ dwfl_module_getsym (Dwfl_Module *mod, int ndx,
}
GElf_Word shndx;
- sym = gelf_getsymshndx (mod->symdata, mod->symxndxdata, ndx, sym, &shndx);
+ if ((size_t) ndx < mod->syments)
+ sym = gelf_getsymshndx (mod->symdata, mod->symxndxdata, ndx, sym,
&shndx);
+ else if (mod->aux_symdata != NULL)
+ sym = gelf_getsymshndx (mod->aux_symdata, mod->aux_symxndxdata,
+ ndx - mod->syments, sym, &shndx);
This violates ELF standard for the application callers of dwfl_module_getsym:
In each symbol table, all symbols with STB_LOCAL binding precede the
weak and global symbols.
As long as the dwfl_module_getsym interface represents a single symbol table
which seems so according to its description:
Fetch one entry from the module's symbol table.
Regards,
Jan