PATCH: Add --enable-__cxa_atexit

H . J . Lu hjl@lucon.org
Thu Jun 6 08:45:00 GMT 2002


On Wed, Jun 05, 2002 at 04:32:13PM -0700, Mark Mitchell wrote:
> > Here is a new patch to pass -fno-use-cxa-atexit to libstdc++-v3.
> 
> This seems like a bad idea.
> 
> If V3 ever makes any use of static initializers, things may go subtly
> wrong.  It is not enough to think about what happens in V3; you must
> consider functions in user code that are called from code in V3.  For
> example, if a static initializer in V3 calls "malloc", and I override
> "malloc", and my "malloc" does static initialization of something,
> the standard says that I can rely on relationships between the orders
> the destructors run in.
> 
> And, if V3 does not use static initializers then there is no cost
> associated with using -fuse-cxa-atexit to compile it.
> 
> So, why pass this flag?

I was told -fuse-cxa-atexit was too expensive at the startup time. Did
you mean g++ would use __cxa_atexit only when it is needed, otherwise
it would use atexit even if -fuse-cxa-atexit is used?


H.J.



More information about the Gcc-patches mailing list