On Tue, 22 Jan 2013 18:03:26 +0100, Mark Wielaard wrote:
/* First go through global symbols. mod->first_global and
mod->aux_first_global are setup by dwfl_module_getsymtab to the
index of the first global symbol in the module's symbol table.
Both are zero when unknown. All symbols with local binding come
first in the symbol table, then all globals. The zeroth, null
entry, in the auxiliary table is always skipped. If we get here
and the main symbol table first_global is zero we loaded it
through phdrs and don't know what the first global is. The
auxiliary table if it exists always has aux_first_global set
correctly because it is looked up and loaded through shdrs. */
int first_global = mod->first_global;
if (first_global > 0 && mod->aux_symdata != NULL)
first_global += mod->aux_first_global - 1;
search_table (first_global == 0 ? 1 : first_global, syments);
This is OK as long as there cannot happen:
mod->first_global == 0 && mod->aux_symdata != NULL
and therefore also: mod->aux_first_global > 0
From find_symtab I think it can happen, isn't -static executable
minidebuginfo such an example?
Sorry I have not tried to reproduce it.