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: PATCH: Disable dynamic allocation in atexit


Jeff Johnston wrote:
> Mark,
> 
>   The patch is fine, but it's got me thinking I want to do a bit more.

To be 100% clear, I'm interpreting that as approval, and I'll check it
in.  If that's not OK, shout!

>   The one question I am pondering is whether to make
> static-only-32-entry, the default for non-_REENT_SMALL platforms.
> Normally I preach backwards-compatibility, but I can't think of any
> applications off-hand that should require more than 32 entries.  This
> makes the empty program compact by default which I think is a good thing.

One thing to bear in mind is that C++ applications will register an
atexit function for every statically allocated object with a destructor.
 For example:

  struct S { ~S(); };
  S s;

will result in an atexit call to clean up "s".

So, I think in medium-size C++ applications, it's easy to get more than
32 slots.  ARM has invented a way for the compiler to collaborate to say
how many slots are needed so that the linker can allocate just the right
number.  This is a good trick, and we should implement it at some point.
 (Even though it was originally designed for ARM, it could be made to
work on all platforms.)

I'm not sure whether it makes sense to implement your plan before this
feature is added; you understand the userbase better than I.

Thanks,

-- 
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]