problems compiling gcc 2.95.[12] for sparc64-linux using --with-cpu=sparc
Ben Collins
bcollins@debian.org
Sun Oct 31 06:04:00 GMT 1999
On Sun, Oct 31, 1999 at 11:30:49AM +0100, Martin v. Loewis wrote:
> > /usr/lib/gcc-lib/sparc-linux/2.95.2/libstdc++.so: undefined reference to `bad_alloc virtual table'
> > /usr/lib/gcc-lib/sparc-linux/2.95.2/libstdc++.so: undefined reference to `exception virtual table'
> >
> > This is a problem in how C++ code is compiled, since using this library
> > with a known good compiler, works fine, and using a known good library
> > works fine with this compiler (except that new code is still broken, and
> > it seems to be mainly PIC related).
>
> It does not look like this problem is related to PIC, sparc64, or any
> other architecture specifics. These symbols *should* be defined in
> libgcc.a; please verify that they are.
I'm not saying it is a problem in the PIC, nor a problem in sparc64. It is
a problem in how the sparc32 compiler is generated when compiling for
sparc64-linux (note that it is multilib, and default is sparc32, and
should compile the code the same as a sparc-linux compiler, but it doesn't).
> Also, don't link libstdc++ to you application explicitly; use the
> 'g++' driver instead.
I am not linking directly, this is output from config.log that is using
the c++ frontend (so libstdc++ is getting linked from there, not by
explicitly adding it to the command line).
> If you find that the symbols are indeed in libgcc.a, please provide
> the output of a linker run, giving '-v' to the compiler.
Note this output (after a `ar x libgcc.a'):
[buildd@xia03(6:32am)-/<8>2.95.2/tmp]%objdump --syms *.o | grep bad_alloc
0000000000000000 l d .gnu.linkonce.t._._9bad_alloc 0000000000000000
0000000000000000 l d .gnu.linkonce.t.__tf9bad_alloc 0000000000000000
0000000000000000 l d .gnu.linkonce.d._vt.9bad_alloc 0000000000000000
0000000000000000 w O .gnu.linkonce.d._vt.9bad_alloc 0000000000000020
_vt.9bad_alloc
0000000000000000 w F .gnu.linkonce.t.__tf9bad_alloc 000000000000005c
__tf9bad_alloc
0000000000000000 w F .gnu.linkonce.t._._9bad_alloc 000000000000003c
_._9bad_alloc
0000000000000034 g F .text 0000000000000024 what__C9bad_alloc
000000000000000c O *COM* 0000000000000008 __ti9bad_alloc
0000000000000000 *UND* 0000000000000000 _vt.9bad_alloc
0000000000000000 *UND* 0000000000000000 _._9bad_alloc
0000000000000000 *UND* 0000000000000000 __tf9bad_alloc
0000000000000000 *UND* 0000000000000000 __tf9bad_alloc
0000000000000000 *UND* 0000000000000000 __tf9bad_alloc
[buildd@xia03(6:30am)-/<8>2.95.2/tmp]%objdump --syms ./exception.o|grep
exception
./exception.o: file format elf32-sparc
0000000000000000 l d .gnu.linkonce.t.__tf9exception 0000000000000000
0000000000000000 l d .gnu.linkonce.t.__tf13bad_exception
0000000000000000
0000000000000000 l d .gnu.linkonce.d._vt.13bad_exception
0000000000000000
0000000000000000 l d .gnu.linkonce.d._vt.9exception 0000000000000000
00000000000000bc g F .text 0000000000000018 __cp_exception_info
00000000000001b8 g F .text 000000000000006c __cp_push_exception
0000000000000224 g F .text 00000000000000c8 __cp_pop_exception
00000000000002ec g F .text 000000000000002c __uncatch_exception
0000000000000000 w O .gnu.linkonce.d._vt.9exception 0000000000000020
_vt.9exception
0000000000000000 w O .gnu.linkonce.d._vt.13bad_exception
0000000000000020 _vt.13bad_exception
0000000000000770 g F .text 0000000000000048 _._13bad_exception
0000000000000000 w F .gnu.linkonce.t.__tf13bad_exception
0000000000000088 __tf13bad_exception
0000000000000694 g F .text 0000000000000030 uncaught_exception__Fv
00000000000006c4 g F .text 0000000000000020 what__C9exception
0000000000000000 w F .gnu.linkonce.t.__tf9exception 0000000000000044
__tf9exception
000000000000070c g F .text 000000000000003c _._9exception
0000000000000008 O *COM* 0000000000000008 __ti9exception
000000000000000c O *COM* 0000000000000008 __ti13bad_exception
00000000000006e4 g F .text 0000000000000028 __9exception
0000000000000748 g F .text 0000000000000028 __13bad_exception
Hopefully that can help.
Also, here is the same config.log with LDFLAGS=-Wl,-v
c++ -bsparc-linux -o conftest -Wl,-v conftest.C
collect2 version 2.95.2 19991024 (release) (sparc64 GNU/Linux with ELF) /usr/bin/ld -m elf32_sparc -Y P,/usr/lib -dynamic-linker /lib/ld-linux.so.2 -o conftest /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/gcc-lib/sparc-linux/2.95.2/crtbegin.o -L/usr/lib/gcc-lib/sparc-linux/2.95.2 -v /tmp/ccRnRezR.o -lstdc++ -lm -lgcc -lc -lgcc /usr/lib/gcc-lib/sparc-linux/2.95.2/crtend.o /usr/lib/crtn.o
/usr/lib/gcc-lib/sparc-linux/2.95.2/libstdc++.so: undefined reference to `bad_alloc virtual table'
/usr/lib/gcc-lib/sparc-linux/2.95.2/libstdc++.so: undefined reference to `exception virtual table'
GNU ld version 2.9.5 (with BFD 2.9.5.0.16)
collect2: ld returned 1 exit status
Ben
More information about the Gcc-bugs
mailing list