Bug 27042

Summary: Assembler Error: symbol `_ZT' is already defined
Product: gcc Reporter: Ludovic Brenta <ludovic>
Component: bootstrapAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED INVALID    
Severity: normal CC: ebotcazou, gcc-bugs
Priority: P3    
Version: 4.1.0   
Target Milestone: ---   
Host: sparc-sun-solaris2.8 Target: sparc-sun-solaris2.8
Build: sparc-sun-solaris2.8 Known to work:
Known to fail: Last reconfirmed:

Description Ludovic Brenta 2006-04-05 13:02:39 UTC
$ ../gcc-4.1.0/configure --prefix=$HOME/opt/gcc-4.1.0.tmp --enable-languages=ada,c,c++ --with-as=$HOME/opt/binutils-2.16.1/bin/as --with-gnu-as --with-ld=$HOME/opt/binutils-2.16.1/bin/ld --with-gnu-ld --enable-bootstrap=no

...

$ make

...

/export/home/lbre/src/gcc-4.1.0.o/./gcc/xgcc -shared-libgcc -B/export/home/lbre/src/gcc-4.1.0.o/./gcc -nostdinc++ -L/export/home/lbre/src/gcc-4.1.0.o/sparc-sun-solaris2.8/libstdc++-v3/src -L/export/home/lbre/src/gcc-4.1.0.o/sparc-sun-solaris2.8/libstdc++-v3/src/.libs -B/export/home/lbre/opt/gcc-4.1.0.tmp/sparc-sun-solaris2.8/bin/ -B/export/home/lbre/opt/gcc-4.1.0.tmp/sparc-sun-solaris2.8/lib/ -isystem /export/home/lbre/opt/gcc-4.1.0.tmp/sparc-sun-solaris2.8/include -isystem /export/home/lbre/opt/gcc-4.1.0.tmp/sparc-sun-solaris2.8/sys-include -I/export/home/lbre/src/gcc-4.1.0.o/sparc-sun-solaris2.8/libstdc++-v3/include/sparc-sun-solaris2.8 -I/export/home/lbre/src/gcc-4.1.0.o/sparc-sun-solaris2.8/libstdc++-v3/include -I/export/home/lbre/src/gcc-4.1.0/libstdc++-v3/libsupc++ -g -O2 -fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -fdiagnostics-show-location=once -ffunction-sections -fdata-sections -I/export/home/lbre/src/gcc-4.1.0.o/sparc-sun-solaris2.8/libstdc++-v3/include/backward -Wno-deprecated -c ../../../../gcc-4.1.0/libstdc++-v3/src/strstream.cc  -fPIC -DPIC -o .libs/strstream.o
/var/tmp//cc4Gnxrh.s: Assembler messages:
/var/tmp//cc4Gnxrh.s:3520: Error: symbol `_ZT' is already defined
/var/tmp//cc4Gnxrh.s:5411: Error: symbol `_ZT' is already defined
/var/tmp//cc4Gnxrh.s:5675: Error: symbol `_ZT' is already defined
/var/tmp//cc4Gnxrh.s:7026: Error: symbol `_ZT' is already defined
/var/tmp//cc4Gnxrh.s:7042: Error: symbol `_ZT' is already defined
/var/tmp//cc4Gnxrh.s:7284: Error: symbol `_ZT' is already defined
/var/tmp//cc4Gnxrh.s:7300: Error: symbol `_ZT' is already defined
make[4]: *** [strstream.lo] Error 1
make[4]: Leaving directory `/export/home/lbre/src/gcc-4.1.0.o/sparc-sun-solaris2.8/libstdc++-v3/src'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/export/home/lbre/src/gcc-4.1.0.o/sparc-sun-solaris2.8/libstdc++-v3'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/export/home/lbre/src/gcc-4.1.0.o/sparc-sun-solaris2.8/libstdc++-v3'
make[1]: *** [all-target-libstdc++-v3] Error 2
make[1]: Leaving directory `/export/home/lbre/src/gcc-4.1.0.o'
make: *** [all] Error 2

As can be seen from the configure options, this is with GNU
binutils 2.16.1.

I also tried the Sun assembler and linker, and get similar errors
but thousands of times instead of just 7.  Complete logs available
on request (1.2 Mb for GNU as/ld, 91 Mb for Sun as/ld; respectively
54k and 2553k compressed with bzip2).

Am I doing something wrong?  (--enable-bootstrap=yes gives the same
errors).

Incidentally, the options mention /export/home/lbre/opt/gcc-4.1.0.tmp/sparc-sun-solaris2.8/
in four places (-B and -isystem options) but this is incorrect
because that directory does not exist yet.  I don't think
the bootstrap procedure should ever refer to the install
directory, except when installing.  Is this worth another PR?

-- 
Ludovic Brenta.
Comment 1 Eric Botcazou 2006-04-05 13:35:58 UTC
> As can be seen from the configure options, this is with GNU
> binutils 2.16.1.

What's the configure shell?  What's the version of GNU make?  What's the bootstrap compiler?

> I also tried the Sun assembler and linker, and get similar errors
> but thousands of times instead of just 7.  Complete logs available
> on request (1.2 Mb for GNU as/ld, 91 Mb for Sun as/ld; respectively
> 54k and 2553k compressed with bzip2).

Both sets of tools are known to work with GCC 4.1.0 on SPARC/Solaris 8.

> Am I doing something wrong?

What happens if you bootstrap the compiler (make bootstrap instead of make)?
Comment 2 Ludovic Brenta 2006-04-05 13:47:04 UTC
$ make --version
GNU Make 3.80
Copyright (C) 2002  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

$ $SHELL --version
GNU bash, version 2.03.0(1)-release (sparc-sun-solaris)
Copyright 1998 Free Software Foundation, Inc.

$ gcc --version
2.8.1

(that's from GNAT 3.15p, binary distribution from AdaCore; but the
compiler used to build strstream.cc is ./xgcc, i.e. GCC 4.1.0
built in stage1.  And, as I said, the same errors occur with
--enable-bootstrap=yes, so I can confidently say that the
bootstrap compiler is irrelevant).

I've started the "make bootstrap" and will report later.  To speed it up
I've only passed --enable-languages=c,c++.

-- 
Ludovic Brenta.
Comment 3 Eric Botcazou 2006-04-05 13:57:45 UTC
> (that's from GNAT 3.15p, binary distribution from AdaCore; but the
> compiler used to build strstream.cc is ./xgcc, i.e. GCC 4.1.0
> built in stage1.  And, as I said, the same errors occur with
> --enable-bootstrap=yes, so I can confidently say that the
> bootstrap compiler is irrelevant).

--enable-bootstrap=yes has not been tested with GCC 4.1.x so I'd avoid it.
Comment 4 Ludovic Brenta 2006-04-05 15:21:59 UTC
--enable-bootstrap=no + "make bootstrap" cause a successful build:

...
/export/home/lbre/src/gcc-4.1.0.bootstrap/./gcc/xgcc -shared-libgcc -B/export/home/lbre/src/gcc-4.1.0.bootstrap/./gcc -nostdinc++ -L/export/home/lbre/src/gcc-4.1.0.bootstrap/sparc-sun-solaris2.8/libstdc++-v3/src -L/export/home/lbre/src/gcc-4.1.0.bootstrap/sparc-sun-solaris2.8/libstdc++-v3/src/.libs -B/export/home/lbre/opt/gcc-4.1.0-bootstrap/sparc-sun-solaris2.8/bin/ -B/export/home/lbre/opt/gcc-4.1.0-bootstrap/sparc-sun-solaris2.8/lib/ -isystem /export/home/lbre/opt/gcc-4.1.0-bootstrap/sparc-sun-solaris2.8/include -isystem /export/home/lbre/opt/gcc-4.1.0-bootstrap/sparc-sun-solaris2.8/sys-include -I/export/home/lbre/src/gcc-4.1.0.bootstrap/sparc-sun-solaris2.8/libstdc++-v3/include/sparc-sun-solaris2.8 -I/export/home/lbre/src/gcc-4.1.0.bootstrap/sparc-sun-solaris2.8/libstdc++-v3/include -I/export/home/lbre/src/gcc-4.1.0/libstdc++-v3/libsupc++ -g -O2 -fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -fdiagnostics-show-location=once -ffunction-sections -fdata-sections -I/export/home/lbre/src/gcc-4.1.0.bootstrap/sparc-sun-solaris2.8/libstdc++-v3/include/backward -Wno-deprecated -c ../../../../gcc-4.1.0/libstdc++-v3/src/strstream.cc  -fPIC -DPIC -o .libs/strstream.o
/export/home/lbre/src/gcc-4.1.0.bootstrap/./gcc/xgcc -shared-libgcc -B/export/home/lbre/src/gcc-4.1.0.bootstrap/./gcc -nostdinc++ -L/export/home/lbre/src/gcc-4.1.0.bootstrap/sparc-sun-solaris2.8/libstdc++-v3/src -L/export/home/lbre/src/gcc-4.1.0.bootstrap/sparc-sun-solaris2.8/libstdc++-v3/src/.libs -B/export/home/lbre/opt/gcc-4.1.0-bootstrap/sparc-sun-solaris2.8/bin/ -B/export/home/lbre/opt/gcc-4.1.0-bootstrap/sparc-sun-solaris2.8/lib/ -isystem /export/home/lbre/opt/gcc-4.1.0-bootstrap/sparc-sun-solaris2.8/include -isystem /export/home/lbre/opt/gcc-4.1.0-bootstrap/sparc-sun-solaris2.8/sys-include -I/export/home/lbre/src/gcc-4.1.0.bootstrap/sparc-sun-solaris2.8/libstdc++-v3/include/sparc-sun-solaris2.8 -I/export/home/lbre/src/gcc-4.1.0.bootstrap/sparc-sun-solaris2.8/libstdc++-v3/include -I/export/home/lbre/src/gcc-4.1.0/libstdc++-v3/libsupc++ -g -O2 -fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -fdiagnostics-show-location=once -ffunction-sections -fdata-sections -I/export/home/lbre/src/gcc-4.1.0.bootstrap/sparc-sun-solaris2.8/libstdc++-v3/include/backward -Wno-deprecated -c ../../../../gcc-4.1.0/libstdc++-v3/src/strstream.cc -o strstream.o >/dev/null 2>&1

(no output)

The bootstrap then completes successfully.

So: "make" fails, "make bootstrap" works, but the commands
invoked are identical.  Could it be that gcc 2.8.1 silently
miscompiled cc1plus in the case of "make", and introduced an
obscure bug which only strstream.cc triggers?

-- 
Ludovic Brenta.
Comment 5 Eric Botcazou 2006-04-05 15:47:57 UTC
> The bootstrap then completes successfully.

Wunderbar. :-)

> So: "make" fails, "make bootstrap" works, but the commands
> invoked are identical.  Could it be that gcc 2.8.1 silently
> miscompiled cc1plus in the case of "make", and introduced an
> obscure bug which only strstream.cc triggers?

Most likely, yes; --enable-bootstrap=yes should have worked around the problem, but it may have its own problems in 4.1.x.