On Tue, Jan 22, 2013 at 06:28:03PM +0100, Jan Kratochvil wrote:
On Tue, 22 Jan 2013 18:03:26 +0100, Mark Wielaard wrote:
> 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
If that happens then first_global = 0. Which means we just don't know
where the first global is in the table. And so we will just search the
whole table (1, syments). That means we just don't do the optimization
of first searching the globals and then the locals if no global matches.
Which is slightly less efficient (since all local matches come first
but we will have to also search the globals because a global symbol
match trumps a local match). But it is still a valid search.
BTW. I don't think this will ever happen since for first_global = 0
we must have found the dynsym table through the phdrs and so most
likely there are no shdrs. Without shdrs we won't be able to find the
auxiliary table.
Cheers,
Mark