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


On Wed, Oct 20, 2010 at 05:31:27PM -0700, Mark Mitchell wrote:
> The concern here is indeed about compatibility with other linkers.  At
> least one linker does not treat the name of the group as "B" in this
> case -- and therefore does not correctly collapse COMDAT groups
> generated by GAS.

Hmm, OK.

> 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".

Correct, but this is how GNU ld and other binutils have behaved for a
long time.  For example, gas allows access to a section symbol (having
st_name zero) with

 .data
 .long .data

for which readelf shows:

Relocation section '.rel.data' at offset 0x1ec contains 1 entries:
 Offset     Info    Type                Sym. Value  Symbol's Name
00000000  00000201 R_386_32               00000000   .data

There are no unwind sections in this file.

Symbol table '.symtab' contains 4 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 00000000     0 SECTION LOCAL  DEFAULT    1 
     2: 00000000     0 SECTION LOCAL  DEFAULT    2 
     3: 00000000     0 SECTION LOCAL  DEFAULT    4 

Note the symbol index on the reloc, the zero st_name in .symtab,
but the reloc is said to be against ".data".

It would be reasonable to say that this behaviour is a GNU extension
to the ELF spec.  We do quite a lot of that.  :-)

As far as changing this to suit some other linker, I'm definitely not
motivated to do the work myself as I don't see this as a bug in gas.
It's a bug in the other linker!

-- 
Alan Modra
Australia Development Lab, IBM


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