This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Any way to get number of symbols in GNU_HASH section ?
>> is [there] any easy way to get number of symbols in a
>> GNU_HASH section, like old HASH section ?
> Because the symbols are in order, you can it by
> walking the chain of the last bucket. You know that the last symbol in
> the chain will be the last symbol overall, and you can calculate its
> offset from the start of the symbols.
*Please* do better than that. Scan the array of bucket heads (whose length
is given in the first word in the section), pick the head which points to
the chain with highest address, then scan that [linear] chain to its end.
Nothing in the specification requires a monotonic mapping from
the heads to the chains. Perhaps the _current_ ld and gold do so,
but there are other processors that [re-]write HASH sections.
--