This is the mail archive of the
cygwin-developers
mailing list for the Cygwin project.
Re: [Fwd: dlopen regression in 1.7? (or is it just me?)]
On Wed, Aug 12, 2009 at 10:47:46AM +0200, Corinna Vinschen wrote:
>Index: lib/_cygwin_crt0_common.cc
>===================================================================
>RCS file: /cvs/src/src/winsup/cygwin/lib/_cygwin_crt0_common.cc,v
>retrieving revision 1.17
>diff -u -p -r1.17 _cygwin_crt0_common.cc
>--- lib/_cygwin_crt0_common.cc 7 Jul 2009 20:12:44 -0000 1.17
>+++ lib/_cygwin_crt0_common.cc 12 Aug 2009 08:42:32 -0000
>@@ -62,6 +62,8 @@ struct per_process_cxx_malloc __cygwin_c
> /* Set up pointers to various pieces so the dll can then use them,
> and then jump to the dll. */
>
>+extern int __dynamically_loaded;
>+
> int __stdcall
> _cygwin_crt0_common (MainFunc f, per_process *u)
> {
>@@ -114,27 +116,32 @@ _cygwin_crt0_common (MainFunc f, per_pro
> u->realloc = &realloc;
> u->calloc = &calloc;
>
>- /* Likewise for the C++ memory operators - if any. */
>- if (newu && newu->cxx_malloc)
>+ if (!__dynamically_loaded)
> {
>- /* Inherit what we don't override. */
>-#define CONDITIONALLY_OVERRIDE(MEMBER) \
>- if (!__cygwin_cxx_malloc.MEMBER) \
>- __cygwin_cxx_malloc.MEMBER = newu->cxx_malloc->MEMBER;
>- CONDITIONALLY_OVERRIDE(oper_new);
>- CONDITIONALLY_OVERRIDE(oper_new__);
>- CONDITIONALLY_OVERRIDE(oper_delete);
>- CONDITIONALLY_OVERRIDE(oper_delete__);
>- CONDITIONALLY_OVERRIDE(oper_new_nt);
>- CONDITIONALLY_OVERRIDE(oper_new___nt);
>- CONDITIONALLY_OVERRIDE(oper_delete_nt);
>- CONDITIONALLY_OVERRIDE(oper_delete___nt);
>+ /* Likewise for the C++ memory operators - if any.
>+ Only do that for statically linked DLLs, otherwise the cxx_malloc
>+ pointer could potentially point into volatile memory (dlclose). */
>+ if (newu && newu->cxx_malloc && !__dynamically_loaded)
I think the second !_dynamically_loaded is redundant isn't it?
cgf