This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Using hash table
- To: binutils at sourceware dot cygnus dot com
- Subject: Using hash table
- From: Bharadwaj Yadavalli <sby at ives dot lkg dot dec dot com>
- Date: Mon, 10 Jul 2000 17:26:07 -0400 (EDT)
- Reply-To: sby at ives dot lkg dot dec dot com
The ELF spec. says the following regarding the contents of .hash
section:
A hashing function accepts a symbol name and returns a value that
may be used to compute a bucket index. Consequently, if the hashing
function returns the value x for some name, bucket[x%nbucket] gives
an index, y, into both the symbol table and the chain table. If the
symbol table entry is not the one desired, chain[y] gives the next
symbol table entry with the same hash value.
One can follow the chain links until either the selected symbol
table entry holds the desired name or the chain entry contains the
value STN_UNDEF.
What does "following the chain links" mean? Assume that the symbol at
index y does not match the name desired. The above says that I should
look up for the symbol whose index is the content of chain[y]. Assume
that even this does not match. Which is the next index I need to look
for the symbol being looked up? chain[y+1]? But that doesn't seem
correct either - given that chain table parallels (dynamic) symbol
table. So how does "follow the chain links"?
Thanks for your help in advance. My apologies if I am unable to see
the obvious.
Bharadwaj