Page 1 of 1

Symbols in ELF

Posted: Mon Mar 04, 2002 10:05 am
by Kernel Panic
I'm writing a simple dynamic linker for my kernel, and am now stuck with elf symbols.. Can anyone tell me if the following code is correct? It's supposed to find the symbol using the hash table, but it doesn't seem to. Neither do I, when I try to do this manually :( ..

   cur_index = hash_table[(name_hash % nbucket) + 2];
   while (cur_index != STN_UNDEF)
   {
     cur_symbol = sym_table + hash_table[cur_index + 2];
     if (strcmp(name, str_table + cur_symbol->st_name) == 0)
     {
       if (cur_symbol->st_shndx == STN_UNDEF) break;
       return(cur_symbol);
     }
     cur_index = hash_table[cur_index + 2 + nbucket];
   }