This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Using hash table



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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]