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

John McCall rjmccall at apple.com
Tue Mar 19 21:48:20 PDT 2013


On Mar 16, 2013, at 12:11 PM, Anton Korobeynikov <anton at korobeynikov.info> wrote:
>> 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.

Hmm.  I assume that MSVC gets told that it's compiling for a DLL?
I guess we can punt on supporting that particular bit until we have an
MS-compatible driver.

John.



More information about the cfe-commits mailing list