From: Dan Kegel Subject: msvcp100: add _Container_base0::_Swap_all, _Container_base0::_Orphan_all (resend) Message-Id: Date: Tue, 24 Jul 2012 13:43:15 -0700 On Tue, Jul 24, 2012 at 6:15 AM, Dan Kegel wrote: > Visual C++ 2010's STL has a feature called 'checked iterators'. > By default, this is disabled by using the preprocessor to point > _Container_base at _Container_base0, a dummy implementation > of the checking functions. > This is normally inlined and thus removed by the optimizer, but if the > optimizer is disabled or can't cope (e.g. with a large function), the > dummy checking functions in _Container_base0 are actually called, so > msvcp100.dll has to provide (empty) implementations of them. > > Fixes http://bugs.winehq.org/show_bug.cgi?id=27698 > See that bug report for test case and other details. Use this one instead, it puts config.h above all other includes. Tested on both x86 and x64. From 50f39c6ccca578a5d50aa170f906a12a6c48baf2 Mon Sep 17 00:00:00 2001 From: Dan Kegel Date: Tue, 24 Jul 2012 13:33:40 -0700 Subject: [PATCH] msvcp100: add _Container_base0::_Swap_all, _Container_base0::_Orphan_all --- dlls/msvcp100/msvcp100.c | 48 +++++++++++++++++++++++++++++++++++++++++++ dlls/msvcp100/msvcp100.spec | 8 +++--- 2 files changed, 52 insertions(+), 4 deletions(-) diff --git a/dlls/msvcp100/msvcp100.c b/dlls/msvcp100/msvcp100.c index ed44b72..fd9a1a4 100644 --- a/dlls/msvcp100/msvcp100.c +++ b/dlls/msvcp100/msvcp100.c @@ -18,14 +18,62 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "config.h" + #include #include "windef.h" #include "winbase.h" +/* Copied from dlls/msvcrt/cpp.c */ +#ifdef __i386__ /* thiscall functions are i386-specific */ + +#define THISCALL(func) __thiscall_ ## func +#define THISCALL_NAME(func) __ASM_NAME("__thiscall_" #func) +#define __thiscall __stdcall +#define DEFINE_THISCALL_WRAPPER(func,args) \ + extern void THISCALL(func)(void); \ + __ASM_GLOBAL_FUNC(__thiscall_ ## func, \ + "popl %eax\n\t" \ + "pushl %ecx\n\t" \ + "pushl %eax\n\t" \ + "jmp " __ASM_NAME(#func) __ASM_STDCALL(args) ) +#else /* __i386__ */ + +#define THISCALL(func) func +#define THISCALL_NAME(func) __ASM_NAME(#func) +#define __thiscall __cdecl +#define DEFINE_THISCALL_WRAPPER(func,args) /* nothing */ + +#endif /* __i386__ */ + /* ?_BADOFF@std@@3_JB -> __int64 const std::_BADOFF */ const __int64 std_BADOFF = -1; +/* _Container_base0 is used by apps compiled without iterator checking + * (i.e. with _ITERATOR_DEBUG_LEVEL=0 ). + * It provides empty versions of methods used by visual c++'s stl's + * iterator checking. + * msvcr100 has to provide them in case apps are compiled with /Od + * or the optimizer fails to inline those (empty) calls. + */ + +/* ?_Orphan_all@_Container_base0@std@@QAEXXZ */ +/* ?_Orphan_all@_Container_base0@std@@QEAAXXZ */ +DEFINE_THISCALL_WRAPPER(Container_base0_Orphan_all, 4) +void __thiscall Container_base0_Orphan_all(void *this) +{ + ; +} + +/* ?_Swap_all@_Container_base0@std@@QAEXAAU12@@Z */ +/* ?_Swap_all@_Container_base0@std@@QEAAXAEAU12@@Z */ +DEFINE_THISCALL_WRAPPER(Container_base0_Swap_all, 8) +void __thiscall Container_base0_Swap_all(void *this, void *that) +{ + ; +} + BOOL WINAPI DllMain(HINSTANCE hdll, DWORD reason, LPVOID reserved) { switch (reason) diff --git a/dlls/msvcp100/msvcp100.spec b/dlls/msvcp100/msvcp100.spec index 98bd8c3..64f3359 100644 --- a/dlls/msvcp100/msvcp100.spec +++ b/dlls/msvcp100/msvcp100.spec @@ -1123,8 +1123,8 @@ @ cdecl -arch=win32 ?_Mutex_dtor@_Mutex@std@@CAXPAV12@@Z(ptr) msvcp90.?_Mutex_dtor@_Mutex@std@@CAXPAV12@@Z @ cdecl -arch=win64 ?_Mutex_dtor@_Mutex@std@@CAXPEAV12@@Z(ptr) msvcp90.?_Mutex_dtor@_Mutex@std@@CAXPEAV12@@Z @ stub ?_Nomemory@std@@YAXXZ -@ stub -arch=win32 ?_Orphan_all@_Container_base0@std@@QAEXXZ -@ stub -arch=win64 ?_Orphan_all@_Container_base0@std@@QEAAXXZ +@ thiscall -arch=win32 ?_Orphan_all@_Container_base0@std@@QAEXXZ(ptr) Container_base0_Orphan_all +@ cdecl -arch=win64 ?_Orphan_all@_Container_base0@std@@QEAAXXZ(ptr) Container_base0_Orphan_all @ stub -arch=win32 ?_Orphan_all@_Container_base12@std@@QAEXXZ @ stub -arch=win64 ?_Orphan_all@_Container_base12@std@@QEAAXXZ @ thiscall -arch=win32 ?_Osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEXXZ(ptr) msvcp90.?_Osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEXXZ @@ -1202,8 +1202,8 @@ @ stub -arch=win64 ?_Segment_index_of@_Concurrent_vector_base_v4@details@Concurrency@@KA_K_K@Z @ cdecl -arch=win32 ?_Setgloballocale@locale@std@@CAXPAX@Z(ptr) msvcp90.?_Setgloballocale@locale@std@@CAXPAX@Z @ cdecl -arch=win64 ?_Setgloballocale@locale@std@@CAXPEAX@Z(ptr) msvcp90.?_Setgloballocale@locale@std@@CAXPEAX@Z -@ stub -arch=win32 ?_Swap_all@_Container_base0@std@@QAEXAAU12@@Z -@ stub -arch=win64 ?_Swap_all@_Container_base0@std@@QEAAXAEAU12@@Z +@ thiscall -arch=win32 ?_Swap_all@_Container_base0@std@@QAEXAAU12@@Z(ptr ptr) Container_base0_Swap_all +@ cdecl -arch=win64 ?_Swap_all@_Container_base0@std@@QEAAXAEAU12@@Z(ptr ptr) Container_base0_Swap_all @ stub -arch=win32 ?_Swap_all@_Container_base12@std@@QAEXAAU12@@Z @ stub -arch=win64 ?_Swap_all@_Container_base12@std@@QEAAXAEAU12@@Z @ extern ?_Sync@ios_base@std@@0_NA msvcp90.?_Sync@ios_base@std@@0_NA -- 1.7.4.1