This is the mail archive of the
mailing list for the Cygwin project.
Re: [RFC] Cygwin libstdc++ plan (operator new/delete replacement)
Dave Korn wrote:
> Dave Korn wrote:
>> It's related trouble in some way.
> Specifically the cxx_malloc pointer is still getting zeroed out somehow and
> the fixes aren't saving us. Very odd. I'll soon see how it's happening.
> Double hooray for mingw gdb and hardware watchpoints!
D'oh, of course! We need to disable the wrappers when building the dll
itself, or all the internal functions attempt to call libstdc++ new, which
would be fine(*), but in the narrow window after the startup code in the (old)
executable zeros the cxx_malloc (forkee) field and before we reach dll_crt0_1
which would restore it, _dll_crt0 calls __sinit to set up newlib stdio, which
needs to create a mutex, which calls the pthread_mutex::init code, which tries
to new some memory and jumps through NULL!
It'll be a simple patch to add -mno-use-libstdc-wrappers to the
appropriate CFLAGS or CXXFLAGS, I'll have something soon.
(*) - Just because it would - in theory - be fine, doesn't mean I think it
would be a good idea or that we should do it; the 'kernel' should have its own
memory management and heap entirely separate from 'usermode' stuff.