This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: Add --enable-__cxa_atexit
- From: "H . J . Lu" <hjl at lucon dot org>
- To: Mark Mitchell <mark at codesourcery dot com>
- Cc: Jakub Jelinek <jakub at redhat dot com>,"Martin v. Loewis" <martin at v dot loewis dot de>,Jack Howarth <howarth at bromo dot med dot uc dot edu>, gcc-patches at gcc dot gnu dot org
- Date: Thu, 6 Jun 2002 08:45:19 -0700
- Subject: Re: PATCH: Add --enable-__cxa_atexit
- References: <20020604130242.A21183@lucon.org> <5670000.1023319933@localhost>
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.