[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug gas/12181] New: local COMDAT group names break linking libstdc++.so
From: |
ro at TechFak dot Uni-Bielefeld.DE |
Subject: |
[Bug gas/12181] New: local COMDAT group names break linking libstdc++.so with Sun ld |
Date: |
Tue, 2 Nov 2010 18:32:12 +0000 |
http://sourceware.org/bugzilla/show_bug.cgi?id=12181
Summary: local COMDAT group names break linking libstdc++.so
with Sun ld
Product: binutils
Version: 2.21 (HEAD)
Status: NEW
Severity: normal
Priority: P2
Component: gas
AssignedTo: address@hidden
ReportedBy: address@hidden
CC: address@hidden
Host: i386-pc-solaris2.11
Target: i386-pc-solaris2.11
Build: i386-pc-solaris2.11
Created attachment 5105
--> http://sourceware.org/bugzilla/attachment.cgi?id=5105
testcase
When trying to bootstrap GCC mainline with gas from CVS binutils, linking
libstdc++.so failed when using Sun ld on Solaris 11 (build 147). The attached
testcase shows the problem (derived from bitmap_allocator.s):
$ gas -o group.o group.s
$ ld -G -o group.so group.o
ld: fatal: file group.o: group section [1].group: invalid group symbol D5Ev
ld: fatal: file group.o: section [1].group: SHF_GROUP flag set, but no
corresponding SHT_GROUP section found
ld: fatal: file group.o: section [5].text.D2Ev: SHF_GROUP flag set, but no
corresponding SHT_GROUP section found
ld: fatal: file group.o: section [6].text.D0Ev: SHF_GROUP flag set, but no
corresponding SHT_GROUP section found
ld: fatal: file processing errors. No output written to group.so
ld chokes because the group symbol is local:
$ nm group.o
group.o:
[Index] Value Size Type Bind Other Shndx Name
[1] | 0| 0|SECT |LOCL |0 |2 |
[2] | 0| 0|SECT |LOCL |0 |3 |
[3] | 0| 0|SECT |LOCL |0 |4 |
[4] | 0| 0|SECT |LOCL |0 |5 |
[9] | 0| 0|SECT |LOCL |0 |1 |
[6] | 0| 0|SECT |LOCL |0 |6 |
[7] | 0| 0|FUNC |LOCL |0 |6 |D0Ev
[5] | 0| 0|FUNC |LOCL |0 |5 |D2Ev
[8] | 0| 0|NOTY |LOCL |0 |1 |D5Ev
The source of the linker error can be seen in the OpenSolaris sources:
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/cmd/sgs/libld/common/groups.c#205
Using elfedit to change D5Ev to global allows the link to succeed.
This breakage was introduced by this patch:
2010-10-23 Mark Mitchell <address@hidden>
* config/obj-elf.c (elf_adjust_symtab): New. Move group section
processing here from elf_frob_file. Ensure that group signature
symbols have the name of the group.
(elf_frob_file): Move group section processing to
elf_adjust_symtab.
* config/obj-elf.h (elf_adjust_symtab): Declare.
(obj_adjust_symtab): Define.
* config/tc-arm.c (arm_adjust_symtab): Call elf_adjust_symtab.
If I do the binding change in gas/config/obj-elf.c (elf_adjust_symtab) like
this
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index 79f8033..07688ea 100644
--- a/gas/config/obj-elf.c
+++ b/gas/config/obj-elf.c
@@ -2142,7 +2142,7 @@ elf_adjust_symtab (void)
{
/* Create the symbol now. */
sy = symbol_new (group_name, now_seg, (valueT) 0, frag_now);
- symbol_get_obj (sy)->local = 1;
+ symbol_get_bfdsym (sy)->flags |= BSF_OBJECT | BSF_GLOBAL;
symbol_table_insert (sy);
}
elf_group_id (s) = symbol_get_bfdsym (sy);
I can sucessfully link libstdc++.so, but linking programs against libgcj.so
later fails.
A GCC bootstrap with CVS gas and gld works, but regresses in the libstdc++
testsuite:
FAIL: libstdc++-abi/abi_check
because the same artificial section names I tripped over when developing
COMDAT group support with Sun as
http://gcc.gnu.org/ml/gcc-patches/2010-05/msg01365.html
http://gcc.gnu.org/ml/gcc-patches/2010-06/msg00600.html
now become global and produce abi_check errors because they cannot be
demangled:
48 added symbols
0
_ZNSs12_Alloc_hiderC5EPcRKSaIcE
error code = -2: invalid mangled name
version status: incompatible
GLIBCXX_3.4
type: function
status: added
I'm somewhat at a loss how to deal with this.
It would be really good to have this fixed before 2.21 is released, otherwise
gas 2.21 would be unusable with gcc 4.6.0 and Sun ld.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
- [Bug gas/12181] New: local COMDAT group names break linking libstdc++.so with Sun ld,
ro at TechFak dot Uni-Bielefeld.DE <=