This is the mail archive of the binutils@sourceware.org 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]
Other format: [Raw text]

Re: [PATCH] give .comment sections SHF_MERGE|SHF_STRINGS


>> That would then keep only one string, even if some happened to be
>> different from the rest -- unless you copy the string itself into the
>> comdat key, but that would be pretty wasteful. This is what merge
>> sections are for.
>
> Yes, comment string will be used as group signature. What will be
> wasted? I think comdat has lower overhead than string merge in linker.

True, comdat processing is more efficient than string merging, but I
don't think that's worth the cost in terms of relocatable size: the
comment string will end up both in the section contents and in the
symbol table. That's going to double the number of occurrences of that
string in the relocatable files. It also adds a bunch of symbols to
the symbol table that don't otherwise need to be there. The point of
using a symbol for the comdat key was that the key symbol was going to
be in the symbol table anyway, so it was no extra overhead.

You could hash the string and use the hash as the comdat key. That
could be more reasonable, but it just doesn't seem worth it to me.
It's still adding a bunch of extra symbols.

I suppose you could make the section itself empty and let the comdat
key itself serve as the comment. At that point, why bother with
sections at all? Just put the comments in as STT_GNU_COMMENT symbols!

-cary


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