Any way to get number of symbols in GNU_HASH section ?

kernel error k3rn3l.3rr0r@gmail.com
Tue Dec 28 18:34:00 GMT 2010


>> 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.

I spent my last weekend on, thanks to the source code of readelf I
found this way.
Indeed, the source code was the only one "documentation" that helped me.

Thanks for reply.

-- 
Regards,
kernel_error



More information about the Binutils mailing list