Kevin O'Connor wrote:
> Hi Jacek,
> 
> Thanks for providing the FAQ.
> 
> I found answer 10 to be very informative.  I too had noticed the 40K
> of baggage that the c++ compiler appends to programs.  However, I
> didn't know that the -fno-exceptions flag could reduce this.
> 
> Unfortunately, try as I might, I could not get haret (see
> http://www.handhelds.org/moin/moin.cgi/HaRET) to shrink with
> -fno-exceptions.  As a guess, it looks like anything that requires
> libsupc++.a is going to pull in the exception code.  Many basic c++
> constructs (eg, vtables, new, delete) pull in that library.
> 
> As a result, it looks like the effort of removing the exception code
> is about on par with porting the app to C.
> 

I've once did reduce the amount of bloat c++ exception
handling for an embedded (<32k) firmware app.

First, reimplement operator new*, on top of malloc, not
touching anything related to exceptions:

Simple e.g.:

void *
operator new (std::size_t sz)
{
   return malloc (sz ? sz : 1);
}

Then, the trick was to provide empty stubs for a few
extern "C" functions the C++ runtime calls on some
situations in the presence of exceptions or when
something goes wrong.  Turns out they're always sucked
in even if using -fno-exceptions.
Since I knew they would never be called (I was dead sure
no lib on the system threw exceptions, since I wrote
it all :-) ), it was safe to stub them out.
I can't remember which functions they were OTTOMH, but I
used this to get a clear look at what's pulling what:

http://sources.redhat.com/ml/newlib/2006/msg00309.html

-- 
Pedro Alves

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Cegcc-devel mailing list
Cegcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel

Reply via email to