When configuring the 4.1 branch (I haven't tried this on mainline yet since I only recently found a workaround for PR target/24334) on IRIX 6.5 with GNU as 2.16.1 and the SGI MIPSpro ld, libstdc++.so fails to link: ld32: FATAL 2 : Internal: at ../../ld/section_type.c In load_info() unknown section type collect2: ld returned 1 exit status make[5]: *** [libstdc++.la] Error 1 While the error message could be clearer ;-), this is obviously due to e.g. allocator-inst.o: **** SECTION HEADER TABLE **** [No] Type Addr Offset Size Name Link Info Adralgn Entsize Flags [1] 0x11 0 0x34 0x8 .group 43 0x25 0x4 0x4 0x00000000 (excerpt of elfdump -h output): Section Type 0x11 (obviously unknown to elfdump) is SHT_GROUP. While the version of GNU as used obviously supports COMDAT group, the native ld does not. It turns out that the test in gcc/configure.ac for COMDAT group support is wrong if using GNU as with a non-GNU ld: if test $in_tree_ld != yes && test x"$ld_vers" != x; then comdat_group=yes if test 0"$ld_date" -lt 20050308; then if test -n "$ld_date"; then # If there was date string, but was earlier than 2005-03-08, fail comdat_group=no elif test "$ld_vers_major" -lt 2; then comdat_group=no elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 16; then comdat_group=no fi fi if test $comdat_group = no; then gcc_cv_as_comdat_group=no gcc_cv_as_comdat_group_percent=no fi fi For non-in_tree_ld and non-GNU ld (i.e. $ld_vers empty), only gcc_cv_as_comdat_group* results from above this section are used, but instead for non-GNU ld, no COMDAT group support should be assumed. It may be that e.g. the Solaris 10+ ld does support this, but we either need a configure check for this or statically define this in configure.ac if it is hard/impossible to check at configure time. This triggers only with GNU as 2.16.1, since 2.15 on IRIX 6 SEGVs with gas COMDAT group tests, thus GNU as isn't known to support COMDAT group in 2.15. Environment: System: IRIX sculptor 6.5 10060437 IP32 host: mips-sgi-irix6.5 build: mips-sgi-irix6.5 target: mips-sgi-irix6.5 configured with: /vol/gcc/src/gcc-4.1-branch-dist/configure --prefix=/vol/gcc --with-local-prefix=/vol/gcc --disable-nls --with-gnu-as --with-as=/vol/gcc/lib/gas-2.16.1 --enable-libgcj --disable-multilib --with-gmp-dir=/vol/gnu/obj/gmp-4.1.3 --with-mpfr-dir=/vol/gnu/obj/gmp-4.1.3/mpfr --enable-languages=c,c++,fortran,java,objc,ada How-To-Repeat: Bootstrap the 4.1 branch (mainline is almost certainly affected as well) as described above.
Fix: The following patch allowed a bootstrap on the 4.1 branch to finish successfully: Index: gcc/configure.ac =================================================================== --- gcc/configure.ac (revision 110450) +++ gcc/configure.ac (working copy) @@ -2175,10 +2175,13 @@ if test $in_tree_ld != yes && test x"$ld comdat_group=no fi fi - if test $comdat_group = no; then - gcc_cv_as_comdat_group=no - gcc_cv_as_comdat_group_percent=no - fi +else + # assume linkers other than GNU ld don't support COMDAT group + comdat_group=no +fi +if test $comdat_group = no; then + gcc_cv_as_comdat_group=no + gcc_cv_as_comdat_group_percent=no fi AC_DEFINE_UNQUOTED(HAVE_COMDAT_GROUP, [`if test $gcc_cv_as_comdat_group = yes || test $gcc_cv_as_comdat_group_percent = yes; then echo 1; else echo 0; fi`], I need to test this on mainline and properly submit to gcc-patches.
This is at least a 4.1/4.2 regression, I forgot when comdat support was added.
Confirmed.
I agree that the configure test is broken. We could have a --enable-comdat option, or, as you say, we could have something in the target configuration file. I think your patch is the right idea, but I do think we need a --enable-comdat option, if we go that route, so that we can specifically indicate that a particular linker *does* support COMDAT.
Subject: Re: [4.1/4.2 Regression] Misdetection of COMDAT group support with GNU as and non-GNU ld mmitchel at gcc dot gnu dot org writes: > We could have a --enable-comdat option, or, as you say, we could have something > in the target configuration file. I think your patch is the right idea, but I > do think we need a --enable-comdat option, if we go that route, so that we can > specifically indicate that a particular linker *does* support COMDAT. Would you be ok with applying the current patch (mainline testing is in progress, but as expected it correctly detected non COMDAT support on IRIX 6.5 with gas 2.16.1 and the MIPSpro ld) to mainline and the 4.1 branch now (since it fixes a bootstrap failure) and implementing --enable-comdat in a follow-up patch? Rainer
Subject: Bug 26053 Author: ro Date: Tue Feb 14 16:46:04 2006 New Revision: 110985 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=110985 Log: PR bootstrap/26053 * configure.ac (HAVE_COMDAT_GROUP): Don't assume non-GNU linkers support COMDAT group. * configure: Regenerate. Modified: trunk/gcc/ChangeLog trunk/gcc/configure trunk/gcc/configure.ac
Subject: Bug 26053 Author: ro Date: Tue Feb 14 16:50:45 2006 New Revision: 110986 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=110986 Log: PR bootstrap/26053 * configure.ac (HAVE_COMDAT_GROUP): Don't assume non-GNU linkers support COMDAT group. * configure: Regenerate. Modified: branches/gcc-4_1-branch/gcc/ChangeLog branches/gcc-4_1-branch/gcc/configure branches/gcc-4_1-branch/gcc/configure.ac
Fixed for 4.1 and on mainline.
*** Bug 24345 has been marked as a duplicate of this bug. ***