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: RFC: COMDAT group names become anonymouse local symbols


Mark Mitchell <mark@codesourcery.com> writes:

> I guess the question is what exactly this bit of the ELF specification
> means:
>
> "The name of a symbol from one of the containing object's symbol tables
> provides a signature for the section group.  The section header of the
> SHT_GROUP section specifies the identifying symbol entry, as described
> above: the sh_link member contains the section header index of the
> symbol table section that contains the entry. The sh_info member
> contains the symbol table index of the identifying entry.
>
> Here, the symbol is the section symbol.  The section symbol has no name,
> in the sense that its st_name value is zero.  In fact, the ELF
> specification says, in the documentation for "st_name":
>
> "If the value is non-zero, it represents a string table index that gives
> the symbol name. Otherwise, the symbol table entry has no name."
>
> I don't see anything that says that the symbol name is implicitly the
> name of the associated section; in other words, I don't see how to
> justify your statement that "the name of such a symbol is given by the
> section sn_name".  So, it seems to me that a literal reading of the ELF
> specification says that what Binutils is doing isn't valid and that we
> should change the GAS behavior to do:
>
>> In cases like this, where a non-section symbol having the same name a
>> the group signature does not already exist, gas could create a normal
>> local symbol just for the group name.
>
> Thoughts?

I note that the corresponding code in gold says 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.

So gold has a specific workaround for this gas behaviour.

The gas behaviour makes sense in that it gives you a slightly smaller
object file, although that is partially offset by the need for the
linker to do extra work to dig up the section name from .shstrtab rather
than the symbol name from .strtab.  But I agree that it does not meet
the letter of the ELF standard.

Ian


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