elf object files with hash and w/o dynamic section

Programming, for all ages and all languages.
Post Reply
FlashBurn
Member
Member
Posts: 313
Joined: Fri Oct 20, 2006 10:14 am

elf object files with hash and w/o dynamic section

Post by FlashBurn »

As the topic tells you, I want to know if it is possible to have the hash table for static symbols in an elf object file w/o a dynamic section.

I want to speed up my loader and because I link my kernel at run time it would be faster if I could use a hash table for the symbols.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: elf object files with hash and w/o dynamic section

Post by JamesM »

Not AFAIK. The hashtable is intended to speed up the userspace dynamic linker, kernels weren't really thought of!

What I do is to read the static symbol table into a structure, then use that structure for lookups instead of the linear search through the static symtab. The structure I use is a Patricia Trie (also called a radix tree) - which gives O(k) access times where k is the length of the key you're looking for.

You could construct your own hashtable in kernel-land, or even run a script to preprocess the object files, creating a hashtable and objcopying it into a new section, which your kernel reads. In fact, the possibilities are endless :-)
FlashBurn
Member
Member
Posts: 313
Joined: Fri Oct 20, 2006 10:14 am

Re: elf object files with hash and w/o dynamic section

Post by FlashBurn »

Ok, I like the idea to create the hashtable of my own and insert it into the object file. My question is now how do I do this? I mean how do I create a new section in my object files and insert my hashtable? Is there a utility I can use or have I to write my own?
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: elf object files with hash and w/o dynamic section

Post by JamesM »

JamesM wrote:and objcopying it
Post Reply