Symbols in ELF

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Kernel Panic

Symbols in ELF

Post 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];
   }
Post Reply