This is the mail archive of the cygwin-patches@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Remove libstdc++ from cygwin1.dll build


I have changed cxx.cc a bit because it is only needed when the dll is
build via gcc3. gcc2 does not need libstdc++ at all because the
operators are contained in libgcc.

BTW, if someone is interested why better use sjlj instead of dwarf2
exceptions there is actually a thread on the mingw users mailing list
called "DLLs and Exceptions" discussing the pros and cons of sjlj and
dwarf2.

Whatever exception type is preferred by the cygwin gcc package i do not
think that the cygwin1.dll should ever throw an exception.

2002-11-26  Thomas Pfaff  <tpfaff@gmx.net>

	* cxx.cc: New file. Implement new, new[], delete and delete[]
	operators and  __cxa_pure_virtual if compiled by gcc >=3.
	* Makefile.in (DLL_OFILES): Add cxx.o.
	Remove libstdc++.a from cygwin1.dll link step.


On Tue, 26 Nov 2002, Thomas Pfaff wrote:

>
> I had some problems building the cygwin1.dll after i changed gcc to use
> sjlj exceptions. The resulting dll was unusable.
>
> I have discovered that this is due to the fact that cygwin1 is linked
> against libstdc++. The only reasons why cygwin1 is linked against stdc++
> are the operators new and delete and __cxa_pure_virtual.
>
> IMHO this is not acceptable because the new and new[] operators will throw
> exceptions if the memory allocation has failed. C programs will terminate
> via abort because the exception is not caught, C++ programs might behave
> unpredictable.
>
> A possible solution might be to use the nothrow new operators, i think
> that the cleanest way is to define own operators. As a side effect the
> cygwin1 dll can be build with an sjlj gcc and the dll is
> significantly smaller.
>
> Thomas
>
> 2002-11-26  Thomas Pfaff  <tpfaff@gmx.net>
>
> 	* cxx.cc: New file. Implement new, new[], delete and delete[]
> 	operators. Implement  __cxa_pure_virtual.
> 	* Makefile.in (DLL_OFILES): Add cxx.o.
> 	Remove libstdc++.a from cygwin1.dll link step.
>
>
>

Attachment: cxx.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]