[PATCH] Defaulting to -fno-use-cxa-atexit on Windows

Anton Korobeynikov anton at korobeynikov.info
Sat Mar 16 12:11:50 PDT 2013


> Cygwin, MinGW, and hexagon targets are Itanium ABI targets;  they're
> just Itanium ABI targets that don't provide __cxa_atexit (although I've
> never understood why not).  So the flag is still meaningful for them.
> It's meaningless for MS ABI targets.
I do not know the situation with Cygwin / Hexagon. But reasoning for
mingw was simple: it was explicitly asked for mingw to use
msvcrt-provided atexit mechanism instead of cxa_atexit in runtime lib.
So, "smaller runtime lib - more use of msvcrt".

> Rather than papering over the problem, I would like someone to
> investigate what the right code to emit is for MS ABI targets.
> Specifically,
> will the destructor get executed correctly if we just register it with LLVM
> as a global destructor?
There might be complications... I do not recall all the details, but
my feeling is that we should do something special for DLLs. Like not
atexit(), but __dllonexit().

I believe the mingw dll boilerplate even overrides atexit / _onexit to
use __dllonexit instead.

-- 
With best regards, Anton Korobeynikov
Faculty of Mathematics and Mechanics, Saint Petersburg State University



More information about the cfe-commits mailing list