This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: Group identifier of a comdat group
- From: "Jessica Han" <jessica at cup dot hp dot com>
- To: "'Alan Modra'" <amodra at bigpond dot net dot au>
- Cc: <binutils at sources dot redhat dot com>, <gcc at gcc dot gnu dot org>,<reva at cup dot hp dot com>
- Date: Mon, 3 Jun 2002 13:33:17 -0700
- Subject: RE: Group identifier of a comdat group
- Reply-to: <jessica at cup dot hp dot com>
Thanks for the response.
I am using the GNU ELF convention for link-once sections, since all COMDAT
sections marked by gnu.linkonce.
(http://gcc.gnu.org/ml/gcc/2001-12/msg00975.html). When the compiler sees a
section is marked by LINK_ONCE, it puts out the group information in
assembly. A COMDAT section is marked by something like:
.section .gnu.linkonce.t.foo,"axG",@progbits,foo_group
Then the assembler can generate the COMDAT using the group support already
in binutils. A COMDAT group contains not only all sections have the same
group "foo_group" in assembly file, but also sections generated by the
assembler based on any of those member sections.
For two sections like
.section .text.foo,"axG",@progbits,foo_group
.section .rodata.foo,"aG",@progbits,foo_group
I can get a new section called foo_group with the two member section, and
sh_link of the section header points to .symtab, sh_info is the index of
section foo_group. However, .symtab section doesn't have section names.
----Original Message-----
From: Alan Modra [mailto:amodra@bigpond.net.au]
Sent: Sunday, June 02, 2002 9:20 PM
To: Jessica Han
Cc: binutils@sources.redhat.com; gcc@gcc.gnu.org; reva@cup.hp.com
Subject: Re: Group identifier of a comdat group
On Fri, May 31, 2002 at 10:08:01AM -0700, Jessica Han wrote:
> I am trying to implement the COMDAT sections support for GCC on IA64,
and
> I am having a problem finding the group identifier of a COMDAT group.
Let's step back a little from the details of the implementation for a
moment. Are you using the existing binutils support for ELF groups,
that is, gcc will emit something like:
.section .text.foo,"axG",@progbits,foo_group
.
.
.section .rodata.foo,"aG",@progbits,foo_group
to set up a group, foo_group, with two members, .text.foo and
.data.foo?
I didn't implement GRP_COMDAT at the time I did the rest of the group
support mainly because it wasn't relevant to the immediate problem I
was trying to solve at the time. Also, there were too many options
for specifying a link-once type group. :)
Should we follow the GNU ELF convention for link-once sections?
ie. use something like
.section .text.foo,"axG",@progbits,.gnu.linkonce.foo_group
to specify that the group as a whole is link-once? Must the member
sections all be named .gnu.linkonce.*? (I don't think they need to
be, but if they all are, then should we just automatically add the
GRP_COMDAT flag?)
A second alternative is to follow the COFF scheme, using
.linkonce foo_group
I think that's cleaner than the magic .gnu.linkonce.* section names.
As a side issue, I think it's a pity that existing ELF link once
sections need special names; I'd rather see a SHF_LINKONCE flag in
sh_flags.
Then there are other options like an extra section letter, say
.section .text.foo,"axGC",...
or an extra field, say
.section .text.foo,"axG",@progbits,foo_group,comdat
Once we get these issues sorted out, it shouldn't be too hard to
implement in the linker.
--
Alan Modra
IBM OzLabs - Linux Technology Centre