This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
RFC: COMDAT group names become anonymouse local symbols
- From: mitchell at codesourcery dot com (Mark Mitchell)
- To: binutils at sourceware dot org
- Date: Tue, 19 Oct 2010 13:08:38 -0700 (PDT)
- Subject: RFC: COMDAT group names become anonymouse local symbols
- Reply-to: mark at codesourcery dot com
When assembling this trivial file:
.section A,"axG",%progbits,B,comdat
# Note that there is no definition of the symbol B.
GAS generates a COMDAT group whose "signature" (in the sense of the
ELF spec) is an anonymous local symbol:
Section Headers:
[Nr] Name Type Address Off Size ES Flg Lk Inf Al
[ 1] B GROUP 0000000000000000 000040 000008 04 7 5 4
Symbol table '.symtab' contains 6 entries:
Num: Value Size Type Bind Vis Ndx Name
5: 0000000000000000 0 SECTION LOCAL DEFAULT 1
This seems bad. The documentation for the .section directive says
that B is the group name, and since the linker's collapsing of COMDAT
groups is done based on the *signature*, not the name referred to by
the section header itself, this seems wrong.
On the other hand, perhaps GCC shouldn't generate code like this. (It
does, at present, for certain C++ inputs.) The assembler certainly
shouldn't create a global symbol named "B". If the assembler were to
create a local symbol with the name "B", would the linker still
combine this COMDAT group with another group in another object file
also named "B", even if both had different local symbols as their
signatures?
Thanks,
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713