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.


------- Comment #1 from ro at techfak dot uni-bielefeld dot de  2006-01-31 
22:29 -------
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.


-- 
           Summary: Misdetection of COMDAT group support with GNU as and
                    non-GNU ld
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: bootstrap
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ro at techfak dot uni-bielefeld dot de
 GCC build triplet: mips-sgi-irix6.5
  GCC host triplet: mips-sgi-irix6.5
GCC target triplet: mips-sgi-irix6.5


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26053

Reply via email to