public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: Mark Mitchell <mark@codesourcery.com>
Cc: binutils@sourceware.org
Subject: Re: RFC: COMDAT group names become anonymouse local symbols
Date: Thu, 21 Oct 2010 02:12:00 -0000	[thread overview]
Message-ID: <20101021021150.GS26553@bubble.grove.modra.org> (raw)
In-Reply-To: <4CBF89DF.5070509@codesourcery.com>

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

      parent reply	other threads:[~2010-10-21  2:12 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-19 20:08 Mark Mitchell
2010-10-20 18:05 ` Cary Coutant
2010-10-20 18:19   ` Mark Mitchell
2010-10-21  6:12     ` Cary Coutant
2010-10-21  0:18 ` Alan Modra
2010-10-21  0:31   ` Mark Mitchell
2010-10-21  1:04     ` Ian Lance Taylor
2010-10-21  4:41       ` Mark Mitchell
2010-10-21  5:19         ` H.J. Lu
2010-10-21  5:27           ` Mark Mitchell
2010-10-21  5:41             ` H.J. Lu
2010-10-21  5:42               ` Mark Mitchell
2010-10-21  6:24         ` Alan Modra
2010-10-21 16:41           ` Mark Mitchell
2010-10-21 18:50             ` Daniel Jacobowitz
2010-10-21 20:22               ` Mark Mitchell
2010-10-21 22:19                 ` Alan Modra
2010-10-21 22:41                   ` Mark Mitchell
2010-10-21 23:11                     ` Alan Modra
2010-10-22  3:23                       ` Mark Mitchell
2010-10-22  4:33                         ` Alan Modra
2010-10-22  6:10                           ` Mark Mitchell
2010-10-22  7:16                             ` Alan Modra
2010-10-22 15:34                               ` Mark Mitchell
2010-10-23  8:16                                 ` Alan Modra
2010-10-23 18:05                                   ` Mark Mitchell
2010-10-24  1:15                                     ` Hans-Peter Nilsson
2010-10-24  1:43                                       ` Mark Mitchell
2010-10-24  3:50                                         ` Hans-Peter Nilsson
2010-10-24  4:34                                           ` Mark Mitchell
2010-10-25 11:45                                             ` Hans-Peter Nilsson
2010-10-25 12:39                                             ` Alan Modra
2010-10-25 15:22                                               ` Mark Mitchell
2010-10-26  3:45                                                 ` Alan Modra
2010-10-26 15:48                                             ` Dave Korn
2010-10-26 15:49                                               ` Mark Mitchell
2010-10-26 15:59                                                 ` Dave Korn
2010-10-26 16:12                                                   ` Dave Korn
2010-10-21  2:12     ` Alan Modra [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101021021150.GS26553@bubble.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=mark@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).