From 97a017e60595a7b6a424dee8ba8609f29abc6fd9 Mon Sep 17 00:00:00 2001 From: cgf Date: Mon, 21 Sep 2009 02:19:30 +0000 Subject: [PATCH] * external.cc (cygwin_internal): Add hack to always reset cxx_malloc to proper value. * lib/_cygwin_crt0_common.cc (_cygwin_crt0_common): Relocate wayward comment. --- winsup/cygwin/ChangeLog | 8 ++++++++ winsup/cygwin/external.cc | 5 +++++ winsup/cygwin/lib/_cygwin_crt0_common.cc | 5 +++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index b3f389249c..e8e67d9f57 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,11 @@ +2009-09-20 Christopher Faylor + + * external.cc (cygwin_internal): Add hack to always reset cxx_malloc to + proper value. + + * lib/_cygwin_crt0_common.cc (_cygwin_crt0_common): Relocate wayward + comment. + 2009-09-19 Christopher Faylor * exceptions.cc (sigpacket::process): Explicitly set thread-specific diff --git a/winsup/cygwin/external.cc b/winsup/cygwin/external.cc index 4e4102ecb1..e20bebf560 100644 --- a/winsup/cygwin/external.cc +++ b/winsup/cygwin/external.cc @@ -195,6 +195,11 @@ cygwin_internal (cygwin_getinfo_types t, ...) return 1; case CW_USER_DATA: + /* This is a kludge to work around a version of _cygwin_common_crt0 + which overwrote the cxx_malloc field with the local DLL copy. + Hilarity ensues if the DLL is not loaded like while the process + is forking. */ + __cygwin_user_data.cxx_malloc = &default_cygwin_cxx_malloc; return (DWORD) &__cygwin_user_data; case CW_PERFILE: diff --git a/winsup/cygwin/lib/_cygwin_crt0_common.cc b/winsup/cygwin/lib/_cygwin_crt0_common.cc index 648d54aac6..173f852689 100644 --- a/winsup/cygwin/lib/_cygwin_crt0_common.cc +++ b/winsup/cygwin/lib/_cygwin_crt0_common.cc @@ -68,8 +68,6 @@ struct per_process_cxx_malloc __cygwin_cxx_malloc = int __stdcall _cygwin_crt0_common (MainFunc f, per_process *u) { - /* This is used to record what the initial sp was. The value is needed - when copying the parent's stack to the child during a fork. */ per_process *newu = (per_process *) cygwin_internal (CW_USER_DATA); bool uwasnull; @@ -110,6 +108,9 @@ _cygwin_crt0_common (MainFunc f, per_process *u) u->premain[2] = cygwin_premain2; u->premain[3] = cygwin_premain3; u->fmode_ptr = &_fmode; + + /* This is used to record what the initial sp was. The value is needed + when copying the parent's stack to the child during a fork. */ u->initial_sp = (char *) __builtin_frame_address (1); /* Remember whatever the user linked his application with - or -- 2.11.0