i386 DLL builds have same issue as EXE builds, entry point (DllMain or DllEntryPoint) can use SSE and therefore stack should be aligned to 16-bytes. Use attribute force_align_arg_pointer for __DllMainCRTStartup, like it is already for __tmainCRTStartup. Also mark it as static.
This code was copied from crtexe.c __tmainCRTStartup() function. --- mingw-w64-crt/crt/crtdll.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mingw-w64-crt/crt/crtdll.c b/mingw-w64-crt/crt/crtdll.c index f59d7326236a..754648a6382b 100644 --- a/mingw-w64-crt/crt/crtdll.c +++ b/mingw-w64-crt/crt/crtdll.c @@ -150,6 +150,12 @@ DllMainCRTStartup (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved) return __DllMainCRTStartup (hDllHandle, dwReason, lpreserved); } +static +#if defined(__i386__) || defined(_X86_) +/* We need to make sure that we align the stack to 16 bytes for the sake of SSE + opts in DllMain/DllEntryPoint or in functions called DllMain/DllEntryPoint. */ +__attribute__((force_align_arg_pointer)) +#endif __declspec(noinline) WINBOOL __DllMainCRTStartup (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved) { -- 2.20.1 _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public