* common.din (__cxa_atexit): Define as cygwin__cxa_atexit.

* dcrt0.cc (cygwin__cxa_atexit): New function.  Explain what we do.
This commit is contained in:
Corinna Vinschen 2014-10-29 09:56:18 +00:00
parent 6eca6c43be
commit 6bb19351d9
4 changed files with 28 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2014-10-29 Corinna Vinschen <corinna@vinschen.de>
* common.din (__cxa_atexit): Define as cygwin__cxa_atexit.
* dcrt0.cc (cygwin__cxa_atexit): New function. Explain what we do.
2014-10-28 Corinna Vinschen <corinna@vinschen.de>
* globals.cc (dos_file_warning): Set to false by default.

View File

@ -41,7 +41,7 @@ __assert_func NOSIGFE
__assertfail NOSIGFE
__b64_ntop NOSIGFE
__b64_pton NOSIGFE
__cxa_atexit SIGFE
__cxa_atexit = cygwin__cxa_atexit SIGFE
__cxa_finalize SIGFE
__dn_comp SIGFE
__dn_expand SIGFE

View File

@ -1232,6 +1232,24 @@ do_exit (int status)
myself.exit (n);
}
/* When introducing support for -fuse-cxa-atexit with Cygwin 1.7.32 and
GCC 4.8.3-3, we defined __dso_value as &ImageBase. This supposedly allowed
a reproducible value which could also be easily evaluated in cygwin_atexit.
However, when building C++ applications with -fuse-cxa-atexit, G++ creates
calls to __cxa_atexit using the *address* of __dso_handle as DSO handle.
So what we do here is this: A call to __cxa_atexit from the application
actually calls cygwin__cxa_atexit. From the dso_handle value we fetch the
ImageBase address, which is then used as the actual DSO handle value in
calls to __cxa_atexit and __cxa_finalize. */
extern "C" int
cygwin__cxa_atexit (void (*fn)(void *), void *obj, void *dso_handle)
{
if (dso_handle)
dso_handle = *(void **) dso_handle;
return __cxa_atexit (fn, obj, dso_handle);
}
extern "C" int
cygwin_atexit (void (*fn) (void))
{

View File

@ -88,3 +88,7 @@ Bug Fixes
- Fix a SEGV in some 64 bit applications explicitely dlclosing DLLs.
Addresses: https://cygwin.com/ml/cygwin/2014-10/msg00402.html
- Fix -fuse-cxa-atexit handling where dlclose fails to trigger calling
global dtors in dynamically loaded modules in C++ applications (and
thus another potential SEGV).