[llvm-commits] Patch for pr9213: Emit global_ctors into MSVCRT-compatible section for win32 targets
arcata at gmail.com
Thu Jan 19 13:34:15 PST 2012
Here's a partial fix for pr9213 that emits global constructors into
the .CRT$XCU section instead of .ctors when targeting win32. As far as
I know, MSVCRT doesn't natively support an equivalent to .dtors, so
I'm not sure what the correct way to handle them is: generate a stub
ctor that registers dtors using atexit(); modify compiler-rt to
produce that stub; or leave it in frontends' hands to use atexit()
instead of global_dtors when destructors aren't supported by the
target platform. Are there other platforms that don't support dtors
that I can look to as an example?
Global initializers still need additional work in Clang for win32,
because Clang emits __dso_handle and __cxa_atexit references that
aren't satisfied by MSVCRT. I believe atexit could simply be used in
place of __cxa_atexit, but I'm not sure what the best equivalent to
__dso_handle would be.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2816 bytes
Desc: not available
More information about the llvm-commits