Built gcc 4.0.0, without C++ support

2005-04-23 Thread Jeroen Scheerder
I configured/made/installed gcc 4.0.0 partially on a Solaris host.  I
could not build with C++ support, because ld (GNU ld, that is) choked
(dumped core, signal 11, segmentation violation) on abi_check (see
below).
When using the Sun-supplied as and ld, ld chokes on alignment errors
during bootstrap.

Note that builds on Solaris 10 on AMD Opteron (on a Sun Fire V20z) failed
miserably.  With the Sun-supplied as and ld, bootstraps chokes on syntax
errors in assembly files; with GNU as and ld, bootstrap chockes on
invalid instructions (64-bit AMD instructions not handled by as?).

Build status info:
-

$ /phil/sw/src/gcc-4.0.0/config.guess
sparc-sun-solaris2.7
$ gcc -v
Using built-in specs.
Target: sparc-sun-solaris2.7
Configured with: /phil/sw/src/gcc-4.0.0/configure 
--prefix=/phil/sw/sunos/sparc/pkg/gcc-4.0.0 --disable-libgcj 
--enable-languages=c,c++,objc --with-gnu-as 
--with-as=/phil/sw/sunos/sparc/bin/as --with-gnu-ld 
--with-ld=/phil/sw/sunos/sparc/bin/ld : (reconfigured) 
/phil/sw/src/gcc-4.0.0/configure --prefix=/phil/sw/sunos/sparc/pkg/gcc-4.0.0 
--disable-libgcj --enable-languages=c,objc --with-gnu-as 
--with-as=/phil/sw/sunos/sparc/bin/as --with-gnu-ld 
--with-ld=/phil/sw/sunos/sparc/bin/ld
Thread model: posix
gcc version 4.0.0


Coredump on abi_check ld:


$ make [...] bootstrap
[...]
creating libstdc++.la
(cd .libs && rm -f libstdc++.la && ln -s ../libstdc++.la libstdc++.la)
Making all in po
Making all in testsuite
mkdir .libs
/phil/sw/sunos/sparc/obj/gcc-4.0.0/gcc/g++ -shared-libgcc 
-B/phil/sw/sunos/sparc/obj/gcc-4.0.0/gcc/ -nostdinc++ 
-B/phil/sw/sunos/sparc/pkg/gcc-4.0.0/sparc-sun-solaris2.7/bin/ 
-B/phil/sw/sunos/sparc/pkg/gcc-4.0.0/sparc-sun-solaris2.7/lib/ -isystem 
/phil/sw/sunos/sparc/pkg/gcc-4.0.0/sparc-sun-solaris2.7/include -isystem 
/phil/sw/sunos/sparc/pkg/gcc-4.0.0/sparc-sun-solaris2.7/sys-include -g -O2 
-D_GLIBCXX_ASSERT -ffunction-sections -fdata-sections -fmessage-length=0 
-DLOCALEDIR=/phil/sw/sunos/sparc/obj/gcc-4.0.0/sparc-sun-solaris2.7/libstdc++-v3/po/share/locale
 -g -O2 -o abi_check abi_check.o  
-L/phil/sw/sunos/sparc/obj/gcc-4.0.0/sparc-sun-solaris2.7/libstdc++-v3/src 
-L/phil/sw/sunos/sparc/obj/gcc-4.0.0/sparc-sun-solaris2.7/libstdc++-v3/src/.libs
 -lv3test 
-L/phil/sw/sunos/sparc/obj/gcc-4.0.0/sparc-sun-solaris2.7/libstdc++-v3/testsuite
 -Wl,--rpath -Wl,/phil/sw/sunos/sparc/obj/gcc-4.0.0/gcc -Wl,--rpath 
-Wl,/phil/sw/sunos/sparc/obj/gcc-4.0.0/sparc-sun-solaris2.7/libstdc++-v3/src/.libs
collect2: ld terminated with signal 11 [Segmentation Fault], core dumped
make[4]: *** [abi_check] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-target-libstdc++-v3] Error 2
make: *** [bootstrap] Error 2


Regards, Jeroen.


Re: Built gcc 4.0.0, without C++ support

2005-04-23 Thread Jeroen Scheerder
Joseph S. Myers:

> On Sat, 23 Apr 2005, Jeroen Scheerder wrote:
> 
> > Note that builds on Solaris 10 on AMD Opteron (on a Sun Fire V20z) failed
> > miserably.  With the Sun-supplied as and ld, bootstraps chokes on syntax
> > errors in assembly files; with GNU as and ld, bootstrap chockes on
> > invalid instructions (64-bit AMD instructions not handled by as?).
> 
> I recommend using GNU as and Sun ld.  /usr/sfw/bin/as should be a suitable 
> version of the GNU assembler, or try the 2.15.97 binutils snapshot (from 
> ftp://gcc.gnu.org/pub/binutils/snapshots/) for an assembler which should 
> also be sufficiently recent (soon to be released as 2.16); I don't know if 
> the 2.15 release is recent enough.  The version of GCC distributed in 
> /usr/sfw/bin is configured with
> 
> --with-as=/usr/sfw/bin/gas --with-gnu-as --with-ld=/usr/ccs/bin/ld 
> --without-gnu-ld --enable-languages=c,c++ --enable-shared
> 
> which should be a configuration which works for 4.0.0 and mainline, as 
> well as for csl-sol210-3_4-branch from which /usr/sfw/bin/gcc comes.

Partial success only.  I think I'll be able to build it without C++
support, but compilation per your instruction does choke on libstdc++.so.6.0.4.

This is how I configured/compiled it:

$ which as; as --version
/phil/sw/sunos/i386/bin/as
GNU assembler 2.15.97 20050420
Copyright 2005 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License.  This program has absolutely no warranty.
This assembler was configured for a target of `i386-pc-solaris2.10'.
$ /phil/sw/src/gcc-4.0.0/configure \
--prefix=/phil/sw/sunos/i386/pkg/gcc-4.0.0 \
--disable-libgcj \
--enable-languages=c,c++,objc \
--with-gnu-as \
--with-as=/phil/sw/sunos/i386/bin/as \
--without-gnu-ld \
--with-ld=/usr/ccs/bin/ld \
--enable-shared
$ make -sj3 CFLAGS='-O' LIBCFLAGS='-g -O2' \
LIBCXXFLAGS='-g -O2 -fno-implicit-templates' bootstrap
[...]
Building runtime libraries
config.status: creating config.h
config.status: config.h is unchanged
Checking multilib configuration...
multilib.out is unchanged
Making all in include
Making all in libsupc++
Making all in libmath
Making all in src
rm -fr  .libs/libstdc++.lax
rm -fr .libs/libstdc++.lax
mkdir .libs/libstdc++.lax
rm -fr .libs/libstdc++.lax/libmath.a
mkdir .libs/libstdc++.lax/libmath.a
(cd .libs/libstdc++.lax/libmath.a && ar x 
/phil/sw/sunos/i386/obj/gcc-4.0.0/i386-pc-solaris2.10/libstdc++-v3/src/../libmath/.libs/libmath.a)
rm -fr .libs/libstdc++.lax/libsupc++convenience.a
mkdir .libs/libstdc++.lax/libsupc++convenience.a
(cd .libs/libstdc++.lax/libsupc++convenience.a && ar x 
/phil/sw/sunos/i386/obj/gcc-4.0.0/i386-pc-solaris2.10/libstdc++-v3/src/../libsupc++/.libs/libsupc++convenience.a)
/phil/sw/sunos/i386/obj/gcc-4.0.0/gcc/xgcc -shared-libgcc 
-B/phil/sw/sunos/i386/obj/gcc-4.0.0/gcc/ -nostdinc++ 
-L/phil/sw/sunos/i386/obj/gcc-4.0.0/i386-pc-solaris2.10/libstdc++-v3/src 
-L/phil/sw/sunos/i386/obj/gcc-4.0.0/i386-pc-solaris2.10/libstdc++-v3/src/.libs 
-B/phil/sw/sunos/i386/pkg/gcc-4.0.0/i386-pc-solaris2.10/bin/ 
-B/phil/sw/sunos/i386/pkg/gcc-4.0.0/i386-pc-solaris2.10/lib/ -isystem 
/phil/sw/sunos/i386/pkg/gcc-4.0.0/i386-pc-solaris2.10/include -isystem 
/phil/sw/sunos/i386/pkg/gcc-4.0.0/i386-pc-solaris2.10/sys-include -shared 
-nostdlib  /usr/lib/crti.o /usr/lib/values-Xa.o 
/phil/sw/sunos/i386/obj/gcc-4.0.0/gcc/crtbegin.o  .libs/bitmap_allocator.o 
.libs/pool_allocator.o .libs/mt_allocator.o .libs/codecvt.o .libs/complex_io.o 
.libs/ctype.o .libs/debug.o .libs/debug_list.o .libs/functexcept.o 
.libs/globals_locale.o .libs/globals_io.o .libs/ios.o .libs/ios_failure.o 
.libs/ios_init.o .libs/ios_locale.o .libs/limits.o .libs/list.o .libs/locale.o 
.libs/locale_init.o .libs/locale_facets.o .libs/localename.o .libs/stdexcept.o 
.libs/strstream.o .libs/tree.o .libs/allocator-inst.o .libs/concept-inst.o 
.libs/fstream-inst.o .libs/ext-inst.o .libs/io-inst.o .libs/istream-inst.o 
.libs/istream.o .libs/locale-inst.o .libs/locale-misc-inst.o .libs/misc-inst.o 
.libs/ostream-inst.o .libs/sstream-inst.o .libs/streambuf-inst.o 
.libs/streambuf.o .libs/string-inst.o .libs/valarray-inst.o 
.libs/wlocale-inst.o .libs/wstring-inst.o .libs/atomicity.o 
.libs/codecvt_members.o .libs/collate_members.o .libs/ctype_members.o 
.libs/messages_members.o .libs/monetary_members.o .libs/numeric_members.o 
.libs/time_members.o .libs/basic_file.o .libs/c++locale.o 
.libs/libstdc++.lax/libmath.a/stubs.o .libs/libstdc++.lax/libmath.a/signbit.o 
.libs/libstdc++.lax/libmath.a/signbitf.o 
.libs/libstdc++.lax/libmath.a/signbitl.o  
.libs/libstdc++.lax/libsupc++convenience.a/del_op.o 
.libs/libstdc++.lax/libsupc++convenience.a/del_opnt.o 
.libs/libstdc++.lax/libsupc++convenience.a/del_opv.o 
.libs/li

One fully and one partially successful build

2005-04-23 Thread Jeroen Scheerder
Successful build:

$ which as; as --version 
/phil/sw/sunos/sparc/bin/as
GNU assembler 2.15.97 20050420
Copyright 2005 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License.  This program has absolutely no warranty.
This assembler was configured for a target of `sparc-sun-solaris2.7'.
$ /phil/sw/src/gcc-4.0.0/config.guess
sparc-sun-solaris2.7
$ gcc -v
Using built-in specs.
Target: sparc-sun-solaris2.7
Configured with: /phil/sw/src/gcc-4.0.0/configure 
--prefix=/phil/sw/sunos/sparc/pkg/gcc-4.0.0 --disable-libgcj 
--enable-languages=c,c++,objc --with-gnu-as 
--with-as=/phil/sw/sunos/sparc/bin/as --with-gnu-ld 
--with-ld=/phil/sw/sunos/sparc/bin/ld --enable-shared
Thread model: posix
gcc version 4.0.0

Partially successful build:

$ /phil/sw/src/gcc-4.0.0/config.guess
i386-pc-solaris2.10
$ which as; as --version; which ld; ld --version
/phil/sw/sunos/i386/bin/as
GNU assembler 2.15.97 20050420
Copyright 2005 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License.  This program has absolutely no warranty.
This assembler was configured for a target of `i386-pc-solaris2.10'.
/phil/sw/sunos/i386/bin/ld
GNU ld version 2.15.97 20050420
Copyright 2005 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License.  This program has absolutely no warranty.
$ gcc -v
Using built-in specs.
Target: i386-pc-solaris2.10
Configured with: /phil/sw/src/gcc-4.0.0/configure 
--prefix=/phil/sw/sunos/i386/pkg/gcc-4.0.0 --disable-libgcj 
--enable-languages=c,objc --with-gnu-as --with-as=/phil/sw/sunos/i386/bin/as 
--without-gnu-ld --with-ld=/usr/ccs/bin/ld --enable-shared
Thread model: posix
gcc version 4.0.0

Building with C++ support fails, because the linker chokes when linking
libstdc++.so.6.0.4:

""
ld: fatal: relocation error: file: .libs/stdexcept.o section: .rel.debug_info 
symbol: : relocation against a discarded symbol,
symbol is part of discarded section: 
.gnu.linkonce.t._ZNSt12out_of_rangeD0Ev
collect2: ld returned 1 exit status
make[4]: *** [libstdc++.la] Error 1
""

Using Sun's ld instead of GNU ld didn't work here (it did when
building 3.4.3), because GNU ld chokes on /usr/lib/amd64/crti.o:

""
$ phil/sw/src/gcc-4.0.0/configure \
--prefix=/phil/sw/sunos/i386/pkg/gcc-4.0.0 \  
--disable-libgcj \
--enable-languages=c,c++,objc \
--with-gnu-as \
--with-as=/phil/sw/sunos/i386/bin/as \
--with-gnu-ld \
--with-ld=/phil/sw/sunos/i386/bin/ld \
--enable-shared
$ make -s [..] bootstrap
[...]
/usr/lib/amd64/crti.o: file not recognized: File format not recognized
collect2: ld returned 1 exit status
make[3]: *** [amd64/libgcc_s.so] Error 1
""


Regards, Jeroen.


Re: Built gcc 4.0.0, without C++ support

2005-04-25 Thread Jeroen Scheerder
Rainer Orth:

> Jeroen Scheerder <[EMAIL PROTECTED]> writes:
> 
> > Partial success only.  I think I'll be able to build it without C++
> > support, but compilation per your instruction does choke on 
> > libstdc++.so.6.0.4.
> 
> I've had the same problem and think I know what's going on.
> 
> > ld: fatal: relocation error: file: .libs/stdexcept.o section: 
> > .rel.debug_info symbol: : relocation against a discarded symbol,
> > symbol is part of discarded section: 
> > .gnu.linkonce.t._ZNSt12out_of_rangeD0Ev
> 
> If I compare stdexcept.s when building with /usr/sfw/bin/gas vs. gas
> 2.15.96, I see differences like the following:
> 
>  .Ltext0:
> .weak   _ZTISt11logic_error
> -   .section.gnu.linkonce.r._ZTISt11logic_error,"a",@progbits
> +   .section
> .gnu.linkonce.r._ZTISt11logic_error,"aG",@progbits,_ZTISt11logic_error,comdat
> 
> Comparing gcc/auto-host.h between bootstraps with those different gas
> versions, I find:
> 
>  /* Define 0/1 if your assembler supports COMDAT group. */
> -#define HAVE_GAS_COMDAT_GROUP 0
> +#define HAVE_GAS_COMDAT_GROUP 1
> 
> So obviously Sun ld doesn't have the necessary support for COMDAT groups
> (even with GNU ld, a quite recent version seems to be required).
> Unfortunately, gcc's configure.ac doesn't check for this, but should.

Your analysis is very convincing.  So an ugly workaround would be to
toggle HAVE_GAS_COMDAT_GROUP?


Re: Built gcc 4.0.0, without C++ support

2005-04-25 Thread Jeroen Scheerder
Daniel Jacobowitz:

[...]

> > So obviously Sun ld doesn't have the necessary support for COMDAT groups
> > (even with GNU ld, a quite recent version seems to be required).
> > Unfortunately, gcc's configure.ac doesn't check for this, but should.
> 
> So you're using gas with the Sun linker?  Yes, the configure check
> definitely needs to test both as and ld.

Yes, I do, per Joseph S. Myers' instructions:

""
I recommend using GNU as and Sun ld.  /usr/sfw/bin/as should be a suitable
version of the GNU assembler, or try the 2.15.97 binutils snapshot (from
ftp://gcc.gnu.org/pub/binutils/snapshots/) for an assembler which should
also be sufficiently recent [..]
""

Note that no other combination will even bootstrap.  GNU ld stumbles
upon a Sun-supplied crt*.o file, and Sun's as chokes on the generated
assembly (x86_64 instructions it fails to handle?).


Regards, Jeroen.


Re: Built gcc 4.0.0, without C++ support

2005-04-25 Thread Jeroen Scheerder
Daniel Jacobowitz:

[...]

> > Note that no other combination will even bootstrap.  GNU ld stumbles
> > upon a Sun-supplied crt*.o file, and Sun's as chokes on the generated
> > assembly (x86_64 instructions it fails to handle?).
> 
> GNU ld ought to work; what's the error look like?

/usr/lib/amd64/crti.o: file not recognized: File format not recognized

This is with ld 2.15.97, the most recent one I could find.


Re: Built gcc 4.0.0, without C++ support

2005-07-11 Thread Jeroen Scheerder
Rainer Orth (25/4/05 12:28 +0200) [Re: Built gcc 4.0.0, without C++
support]:

>> Partial success only.  I think I'll be able to build it without C++
>> support, but compilation per your instruction does choke on
>>libstdc++.so.6.0.4.
>
>I've had the same problem and think I know what's going on.

[...]

>So obviously Sun ld doesn't have the necessary support for COMDAT groups
>(even with GNU ld, a quite recent version seems to be required).
>Unfortunately, gcc's configure.ac doesn't check for this, but should.

FWIW, I just started building gcc 4.0.1, and ran into this problem once
again; and setting HAVE_GAS_COMDAT_GROUP to 0 in gcc/auto-host.h seems
once again to be a valid workaround.