This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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/C++]: Use dllonexit for static destructors on mingw32


Danny Smith wrote:

2006-10-27 Danny Smith <dannysmith@users.sourceforge.net>
* target.h (targetm.cxx.use_dllonexit): New target hook.
* target-def.h: (TARGET_CXX_USE_DLLONEXIT): Define default.
* config/i386/mingw32.h (TARGET_CXX_USE_DLLONEXIT): Override
default.
* doc/tm.texi (TARGET_CXX_USE_DLLONEXIT): Document.


cp/Changelog

	*decl2.c (one_static_initialization_or_destruction): Check,
	set guard variable and register static destructor here if
	targetm.cxx.use_dllonexit.
	(cp_finish_file): Don't generate destructor if
	targetm.cxx.use_dllonexit.

I think the idea of this patch.


However, I think that you should key off of flag_use_cxa_atexit whether than adding a separate hook. The only difference should be that in register_dtor_fn, you check a target hook that says that you should call atexit, not __cxa_atexit. I suggest naming the hook TARGET_CXX_USE_ATEXIT_FOR_CXA_ATEXIT. There is already prior art, in that it's how we already handle the ARM EABI aeabi_atexit function.

Then, on MinGW, just default --enable-use-cxa-atexit (sp?) to true, or require that users provide it explicitly.


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]