This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
forced dependency on libtsdc++
- To: gcc bug reports <gcc-bugs at gcc dot gnu dot org>
- Subject: forced dependency on libtsdc++
- From: Martin Sebor <sebor at roguewave dot com>
- Date: Mon, 20 Nov 2000 22:45:31 -0700
- Organization: Rogue Wave Software, Inc.
This used to work up until very recently (gcc-20001002) but now I'm
getting linker errors. Using g++ resolves the references but also links
in libstdc++.
Looking at the recent snapshot, the symbols are now undefined in
libgcc.a:
$ nm -C gcc-20001113/lib/gcc-lib/i686-pc-linux-gnu/2.97/libgcc.a | grep
__builtin_new
and they are defined in libstdc++ instead:
$ nm -C gcc-20001113/lib/libstdc++.so | grep __builtin_new
0009f0f4 T __builtin_new
This is different from gcc-20001002 where the symbols are in libgcc:
$ nm -C gcc-20001002/lib/gcc-lib/i686-pc-linux-gnu/2.97/libgcc.a | grep
__builtin_new
00000004 W __builtin_new
U __builtin_new
and only being referenced from libstdc++:
$ nm -C gcc-20001002/lib/libstdc++.a.2.10.0 | grep __builtin_new
U __builtin_new
U __builtin_new
It's important for our implementation of the Standard C++ library (as
well as other 3rd party standard libraries, I'm sure) not to depend on
anything in libstdc++ if nothing else then for copyright reasons. Is
there a way to _NOT_ link in libstdc++ and still get these symbols (this
isn't limited to the operator new and delete but also exception
handling, rtti, etc.)?
Thanks
Martin
$ cat test.cpp
int main ()
{
new int;
new int [1];
}
$ gcc test.cpp
/tmp/ccx2Rwli.o: In function `main':
/tmp/ccx2Rwli.o(.text+0xc): undefined reference to `__builtin_new'
/tmp/ccx2Rwli.o(.text+0x19): undefined reference to `__builtin_vec_new'
collect2: ld returned 1 exit status