[PATCH] Objcopy: use a hash table for symbol renaming

Eirik Byrkjeflot Anonsen eirik@opera.com
Thu Jan 14 13:56:00 GMT 2010


Eirik Byrkjeflot Anonsen <eirik@opera.com> writes:

> Nick Clifton <nickc@redhat.com> writes:
>
>> Hi Eirik,
>>
>>> The attached patch replaces the linked list with a hash table
>>> implementation.
>>
>> Thanks for submitting this patch.  It is a good idea, but as
>> Hans-Peter has pointed out it would be better to make use of the
>> hashing functions that are already implemented in the libiberty
>> library, rather than creating your own.
>
> Fully agreed.  I just didn't know that libiberty has a hash table
> implementation.  I didn't even know that I was allowed to use libiberty
> in binutils.  In fact, you could say I know precious little about
> libiberty :)

Ok, I finally got around to spending some time trying to figure out how
libiberty's hash tables work.  I found the documentation to be somewhat
thin, so I ended up implementing the symbol redefinition hash table by
the time-honored coding style of "cut and paste".  (Though the resulting
code seems sensible.  And it seems to do the right thing.)

(Astonishingly, this version seems to be about 10% slower than mine.
"Astonishingly" because my version was optimized for correctness and
readability, not for performance.  Still, it's not a performance
difference that matters significantly.  The benefits of using a standard
implementation of hash tables far outweighs that minor performance hit.)

>
>> Also, with a change of this size, you will need to complete an FSF
>> copyright assignment, so that we can make use of your code.  I have
>> attached an emailable form which you can fill out in order to start
>> this process.
>
> Urgh!  I had forgotten about that.  I'll do that.

This is still in progress, but maybe this change is small enough to not
need it...

eirik


-------------- next part --------------
A non-text attachment was scrubbed...
Name: objcopy-hashtab.patch
Type: text/x-diff
Size: 4693 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20100114/a86b96e2/attachment.bin>


More information about the Binutils mailing list