This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Reducing the size of C++ executables - eliminating malloc


Michael Eager wrote:
> Mark Mitchell wrote:
>>> Generating __gxx_personality_v0 is suppressed with the -fno-exceptions
>>> flag, but it would seem better if this symbol were only generated
>>> when catch/throw was used.  This happens in cxx_init_decl_processing(),
>>> which is called before it's known whether or not EH is really needed.
>>
>> I believe that you need the personality routine if you will be unwinding
>> through a function, which is why -fno-exceptions is the test.
> 
> You mean unwinding stack frames to handle a thrown exception?
> 
> That's true, but shouldn't this only be included when there
> exceptions are used?  

No, it must be included if exceptions are enabled, and there are any
objects which might require cleanups, which, in most C++ programs, is
equivalent to there are any objects with a destructor.

> One of the C++ percepts is that there
> is no overhead for features which are not used.

That objective does not hold for space, especially in the presence of
exceptions.

> Why should the personality routine be included in all C++ programs?

Because all non-trivial, exceptions-enabled programs, may need to do
stack unwinding.

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]