2009/12/3 Peter Hurley <phurley@...>:
> Kai Tietz wrote:
>>> Peter Hurley wrote:
>>> The appropriate fix (which doesn't sacrifice old Windows support) is
>>> trivial - fix the gcc build so that crtmt.o is pulled into the shared
>>> c library build. Steve Wolter offered to push the upstream patch back
>>> on Oct 19th (on this list) with no takers. (FYI - In his patch, he
>>> also claims to have integrated mingwm10.dll into the shared c library
>>> as well - which I feel is the superior approach).
>> No, as it leads still to some issues, if somebody builds with static
>> version of libgcc. The approach to use TLS callbacks in startup code
>> is the way to solve this issue.
>> I patched once the libgcc in shared mode for this in gcc, and reverted
>> it due to a half fix.
>> The better solution for this is, use for win9X/ME the old mingwm10.dll
>> approach, and for newer OSes just use TLS-callback code in dll/exe
> Hi Kai but also to the mingw devs,
> The conundrum over switching to TLS callbacks for cleaning up exception
> contexts has paralyzed fixing this problem. My arguments for keeping this
> simple are:
> 1. Architectural decision was already made. The TLS callback patch wasn't
> part of the 4.4 release (and still isn't...).
> 2. Shared Dll is necessary anyway. Cross-module exception handling
> requires a shared dll; this was the whole impetus behind putting the
> exception handling code in the shared libgcc dll in the first place.
Right, for throws over DLL boundaries, the libgcc_s is still required,
but for cleaning up the TLS hooks on a throw it is solved by
TLS-callbacks in startup for DLL/EXE in runtime.
> 3. TLS callbacks fix a different problem. Strictly speaking, they are only
> necessary to prevent eh context leaks when using the static libgcc (ie.,
> single module). In this case, TLS callbacks can be pulled in by building
> it as a static library (this may already be possible).
By adding TLS-callback into runtime startup code (as we do for
mingw-w64) static and shared build are able to use TLS-callback. It
isn't not just a memory leak, it is also the calling of the registered
callback on thread exit.
> 4. Building libgcc_s with crtmt.o and libgwmthr is a really easy fix.
This isn't necessary, but if done, gcc Makefiles need to be changed,
which I dislike to see in gcc sources.
> I'm no fan of W95/Me but adding/changing gcc build options seems like a
> next-release-kind-of-thing (build target arch support).
It has nothing to do with gcc here and so the change isn't related to
gcc at all, it is just the startup-code of mingw.org, which would need
to provide this feature. Of course this should be done in an new
release of the startup code and runtime.
| (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination