[PATCH] Defaulting to -fno-use-cxa-atexit on Windows
John McCall
rjmccall at apple.com
Tue Mar 19 21:50:58 PDT 2013
On Mar 11, 2013, at 6:13 PM, Aaron Ballman <aaron at aaronballman.com> wrote:
> The way MSVC handles it is by registering an atexit handler:
>
> ; 6 : C c;
>
> push OFFSET ??__Fc@@YAXXZ ; `dynamic atexit destructor for 'c''
> call _atexit
> pop ecx
> ret 0
>
> This is analogous to what clang does when passing -fno-use-cxa-atexit, which is:
>
> define internal void @__cxx_global_var_init() {
> entry:
> %0 = call i32 @atexit(void ()* @__dtor_c) #1
> ret void
> }
Okay. Would you mind abstracting this through the C++ ABI, then?
Make some sort of "register dynamic destructor" method, have CGF publish
a general method to do that via atexit, and move the __cxa_atexit-specific
stuff into ItaniumCXXABI.cpp.
John.
More information about the cfe-commits
mailing list