This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Re: Large size of C++ v3 libs
- To: "H . J . Lu" <hjl at lucon dot org>
- Subject: Re: Large size of C++ v3 libs
- From: <llewelly at dbritsch dot dsl dot xmission dot com>
- Date: Fri, 12 May 2000 16:00:09 -0600 (MDT)
- Cc: Ryszard Kabatek <rumcajs at gmx dot net>, gcc at gcc dot gnu dot org,binutils at sourceware dot cygnus dot com
On Fri, 12 May 2000, H . J . Lu wrote:
> On Fri, May 12, 2000 at 02:16:12PM -0600, llewelly@dbritsch.dsl.xmission.com wrote:
> > On Fri, 12 May 2000, Ryszard Kabatek wrote:
> >
> > > I compiled the gcc (egcs-20000501) on Linux (SuSE 6.2) with
> > > --enable-libstdcxx-v3.
> > > The build was successfull, but the size of the libraries is really large:
> > > libstdc++.a - 24584366 bytes,
> > > libstdc++.so.3.0.0 - 5718674 bytes.
> >
> > I believe the libraries are built with -g by default. Since they are
> > experimental, and thus probably buggy, this is usually a good
> > thing. However, it greatly increases the size of the binaries.
> >
> > If you decide to strip(1) them, be careful. On my i686-pc-linux-gnu, with
> > binutils 2.9.5.0.41, I need to use 'strip --strip-debug foo.a' and *not*
> > 'strip --strip-unneeded foo.a'. The --strip-unneeded rips out the stack
> > unwinding stuff needed for exceptions, which it seems to consider
> > 'unneeded'
>
> This sounds like a bug in strip. Could you please provide a small
> testcase? I'd like to fix it.
>
> Thanks.
>
>
> H.J.
>
Actually, it appears that I misunderstood what was going on.
I had had some problems with stripped executables that contained
exception throwing code. I had noticed that strip removed the
'__EXCEPTION_TABLE__' and '__FRAME_BEGIN__' symbols, so I
(incorrectly) assumed that was the cause of the problems.
It seems that the function containing the 'throw' is
disappearing.
I have a test case that (I think) shows a bug in strip, but it is not
the bug I thought it was.
Here it is:
{~/cc_exer}cat foo_vanish.h
void foo(int j);
extern int l;
{~/cc_exer}cat foo_vanish.cc
#include"foo_vanish.h"
int l=1;
void bar(int j)
{
throw j;
}
void foo(int j)
{
bar(j);
}
{~/cc_exer}cat foo_vanish_main.cc
#include"foo_vanish.h"
int main()
{
int k=1;
try
{
foo(k);
}
catch(int i)
{
return l;
}
return l;
}
{~/cc_exer}g++ -g -Wall -c foo_vanish.cc
{~/cc_exer}nm --demangle foo_vanish.o
00000089 t Letext
00000000 ? __EXCEPTION_TABLE__
00000000 ? __FRAME_BEGIN__
U __cp_push_exception
U __eh_alloc
U int type_info function
U __throw
00000000 T bar(int)
0000006c T foo(int)
00000000 D l
U terminate(void)
{~/cc_exer}strip --strip-unneeded foo_vanish.o
{~/cc_exer}nm --demangle foo_vanish.o
U __cp_push_exception
U __eh_alloc
U int type_info function
U __throw
00000000 T bar(int)
U terminate(void)
{~/cc_exer}g++ -g -Wall foo_vanish_main.cc foo_vanish.o
/tmp/cciCkDOS.o: In function `main':
/home/llewelly/cc_exer/foo_vanish_main.cc:9: undefined reference to `foo(int)'
/home/llewelly/cc_exer/foo_vanish_main.cc:15: undefined reference to `l'
/home/llewelly/cc_exer/foo_vanish_main.cc:13: undefined reference to `l'
collect2: ld returned 1 exit status
{~/cc_exer}strip -V
GNU strip 2.9.5
Copyright 1997, 98, 99, 2000 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.
{~/cc_exer}ld -v
GNU ld version 2.9.5 (with BFD 2.9.5.0.41)
{~/cc_exer}g++ -v
Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/specs
gcc version 2.95.2 19991024 (release)
on i686-pc-linux-gnu .