This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [patch] stop objcopy breaking group sections
Daniel Jacobowitz <drow@false.org> writes:
> On Fri, Sep 26, 2008 at 08:35:40AM +0930, Alan Modra wrote:
>> On Thu, Sep 25, 2008 at 08:21:19AM -0400, Daniel Jacobowitz wrote:
>> > I vaguely recall that there's a hack involved in the names of section
>> > symbols; BFD wants them to have the section name but we changed it not
>> > to output the name unless it was necessary. Could that be the
>> > problem? The spec does talk about the name of the symbol, not the
>> > name of the corresponding section.
>>
>> Yes, STT_SECTION symbols have st_name of zero (*). Their name is that
>> of their st_shndx section. See elf.c:bfd_elf_sym_name.
>>
>> *) At least, that's how GNU ld creates section symbols. In a quick
>> look over the ELF gabi, I couldn't see anything that officially
>> blesses this practice.
>
> So, it seems to me, we're wrong to use such a section sym as a group
> signature.
In gold I had write an explicit workaround to deal with this.
// It seems that some versions of gas will create a section group
// associated with a section symbol, and then fail to give a name to
// the section symbol. In such a case, use the name of the section.
Whether or not it is acceptable ELF, it's inefficient, because it
means that the group signature string gets stored in the section name
string table. Since there is usually a symbol with the name of the
group signature, the string is already stored in the symbol name
string table. The purpose of the little dance to find the signature
string is to permit storing it only once, in the symbol name string
table. This matters because those signature strings can be very long
for C++ programs--e.g., 1K bytes--and duplicating them is wasteful.
Ian