Message ID | CAEwic4ZiqxOrAPqGCFodod424XqfHWinr7WL+mHvMEHo2TnybQ@mail.gmail.com |
---|---|
State | New |
Headers | show |
On Dec 15, 2011, at 1:43 AM, Kai Tietz wrote: > This patch takes care that we are using for operator new/delete > replacement test static version on > mingw-targets. As the shared (DLL) version isn't able to have > operator overload within DLL itself, as a DLL is finally-linked for > PE-COFF. > Ok for apply? Not sure who would review this if I don't, so, Ok. That said, if a shared library C++ type person wants to chime in... I get the feeling this is unfortunate, and it might have been nice to manage this in some other way, but, I just want to step back and let others think about it.
On 15/12/2011 17:44, Mike Stump wrote: > On Dec 15, 2011, at 1:43 AM, Kai Tietz wrote: >> This patch takes care that we are using for operator new/delete >> replacement test static version on mingw-targets. As the shared (DLL) >> version isn't able to have operator overload within DLL itself, as a DLL >> is finally-linked for PE-COFF. > >> Ok for apply? > > Not sure who would review this if I don't, so, Ok. That said, if a shared > library C++ type person wants to chime in... I get the feeling this is > unfortunate, and it might have been nice to manage this in some other way, > but, I just want to step back and let others think about it. Well, it's a consequence of how you can't leave undefined references in Windows DLLs at link-time for the loader to just fill in with the first definition it comes across at run-time (as you can on ELF). We have to jump through hoops to get operator new/delete replacement working on Cygwin, and were lucky in that the cygwin1.dll is linked against absolutely everything, so we had somewhere to hang our redirection hooks. Without someone adding some similar amount of infrastructure to MinGW, the only time function replacement can work is for a statically-linked executable, when all definitions are visible in one single link. > * g++.old-deja/g++.brendan/new3.C: Adjust test for mingw > targets to use static-version. s/static-version/static linking/ > +// Avoid use of none-overridable new/delete operators in shared s/none-overridable/non-overridable/g s/in shared/in shared link/g Patch looks perfectly sensible to me, but I can't approve. cheers, DaveK
Ping 2011/12/15 Dave Korn <dave.korn.cygwin@gmail.com>: > On 15/12/2011 17:44, Mike Stump wrote: >> On Dec 15, 2011, at 1:43 AM, Kai Tietz wrote: >>> This patch takes care that we are using for operator new/delete >>> replacement test static version on mingw-targets. As the shared (DLL) >>> version isn't able to have operator overload within DLL itself, as a DLL >>> is finally-linked for PE-COFF. >> >>> Ok for apply? >> >> Not sure who would review this if I don't, so, Ok. That said, if a shared >> library C++ type person wants to chime in... I get the feeling this is >> unfortunate, and it might have been nice to manage this in some other way, >> but, I just want to step back and let others think about it. > > Well, it's a consequence of how you can't leave undefined references in > Windows DLLs at link-time for the loader to just fill in with the first > definition it comes across at run-time (as you can on ELF). We have to jump > through hoops to get operator new/delete replacement working on Cygwin, and > were lucky in that the cygwin1.dll is linked against absolutely everything, so > we had somewhere to hang our redirection hooks. Without someone adding some > similar amount of infrastructure to MinGW, the only time function replacement > can work is for a statically-linked executable, when all definitions are > visible in one single link. > >> * g++.old-deja/g++.brendan/new3.C: Adjust test for mingw >> targets to use static-version. > > s/static-version/static linking/ > >> +// Avoid use of none-overridable new/delete operators in shared > > s/none-overridable/non-overridable/g > s/in shared/in shared link/g > > Patch looks perfectly sensible to me, but I can't approve. > > cheers, > DaveK
On Dec 27, 2011, at 10:55 PM, Kai Tietz <ktietz70@googlemail.com> wrote: > Ping It was previously approved in the email you quote. See the Ok buried in there. > 2011/12/15 Dave Korn <dave.korn.cygwin@gmail.com>: >> On 15/12/2011 17:44, Mike Stump wrote: >>> On Dec 15, 2011, at 1:43 AM, Kai Tietz wrote: >>>> This patch takes care that we are using for operator new/delete >>>> replacement test static version on mingw-targets. As the shared (DLL) >>>> version isn't able to have operator overload within DLL itself, as a DLL >>>> is finally-linked for PE-COFF. >>> >>>> Ok for apply? >>> >>> Not sure who would review this if I don't, so, Ok. That said, if a shared >>> library C++ type person wants to chime in... I get the feeling this is >>> unfortunate, and it might have been nice to manage this in some other way, >>> but, I just want to step back and let others think about it. >> >> Well, it's a consequence of how you can't leave undefined references in >> Windows DLLs at link-time for the loader to just fill in with the first >> definition it comes across at run-time (as you can on ELF). We have to jump >> through hoops to get operator new/delete replacement working on Cygwin, and >> were lucky in that the cygwin1.dll is linked against absolutely everything, so >> we had somewhere to hang our redirection hooks. Without someone adding some >> similar amount of infrastructure to MinGW, the only time function replacement >> can work is for a statically-linked executable, when all definitions are >> visible in one single link. >> >>> * g++.old-deja/g++.brendan/new3.C: Adjust test for mingw >>> targets to use static-version. >> >> s/static-version/static linking/ >> >>> +// Avoid use of none-overridable new/delete operators in shared >> >> s/none-overridable/non-overridable/g >> s/in shared/in shared link/g >> >> Patch looks perfectly sensible to me, but I can't approve. >> >> cheers, >> DaveK > > > > -- > | (\_/) This is Bunny. Copy and paste > | (='.'=) Bunny into your signature to help > | (")_(") him gain world domination
Index: g++.old-deja/g++.brendan/new3.C =================================================================== --- g++.old-deja/g++.brendan/new3.C (revision 182092) +++ g++.old-deja/g++.brendan/new3.C (working copy) @@ -5,6 +5,8 @@ // are resolved when the kernel is linked. // { dg-do run { xfail { powerpc-ibm-aix* || vxworks_kernel } } } // { dg-options "-flat_namespace" { target *-*-darwin[67]* } } +// Avoid use of none-overridable new/delete operators in shared +// { dg-options "-static" { target *-*-mingw* } } // GROUPS passed operator-new #include <stdio.h> #include <stdlib.h> Index: g++.old-deja/g++.abi/cxa_vec.C =================================================================== --- g++.old-deja/g++.abi/cxa_vec.C (revision 182092) +++ g++.old-deja/g++.abi/cxa_vec.C (working copy) @@ -5,6 +5,8 @@ // are resolved when the kernel is linked. // { dg-do run { xfail { powerpc-ibm-aix* || vxworks_kernel } } } // { dg-options "-flat_namespace" { target *-*-darwin[67]* } } +// Avoid use of none-overridable new/delete operators in shared +// { dg-options "-static" { target *-*-mingw* } } // Test __cxa_vec routines // Copyright (C) 2000, 2005 Free Software Foundation, Inc. // Contributed by Nathan Sidwell 7 Apr 2000 <nathan@nathan@codesourcery.com> Index: g++.old-deja/g++.abi/arraynew.C =================================================================== --- g++.old-deja/g++.abi/arraynew.C (revision 182092) +++ g++.old-deja/g++.abi/arraynew.C (working copy) @@ -1,5 +1,7 @@ // { dg-do run } // Origin: Mark Mitchell <mark@codesourcery.com> +// Avoid use of none-overridable new/delete operators in shared +// { dg-options "-static" { target *-*-mingw* } } #if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 Index: g++.old-deja/g++.eh/new2.C =================================================================== --- g++.old-deja/g++.eh/new2.C (revision 182092) +++ g++.old-deja/g++.eh/new2.C (working copy) @@ -1,5 +1,7 @@ // { dg-do run } // Test that a throw in B's constructor destroys the A and frees the memory. +// Avoid use of none-overridable new/delete operators in shared +// { dg-options "-static" { target *-*-mingw* } } #include <cstddef> #include <cstdlib> Index: g++.old-deja/g++.eh/new1.C =================================================================== --- g++.old-deja/g++.eh/new1.C (revision 182092) +++ g++.old-deja/g++.eh/new1.C (working copy) @@ -1,5 +1,7 @@ // { dg-do run } // Test that a throw in foo destroys the A, but does not free the memory. +// Avoid use of none-overridable new/delete operators in shared +// { dg-options "-static" { target *-*-mingw* } } #include <cstddef> #include <cstdlib>