From: Martin S. <ma...@ma...> - 2017-12-09 21:46:20
|
The previous hookup of setjmp for ucrtbase in 7c161daf1e4090ff30d0172cf9d93e24c46f8035 was incorrect; based on inexact def files claiming that the "setjmp" function actually would exist on all architectures - it actually only exists on x86_64. The actual ucrtbase.dll on i386, x86_64 and arm all contain a different subset of functions - clarify the def file. Make sure we link to a function that actually exists on all architectures. This reverts 7c161daf1e4090ff30d0172cf9d93e24c46f8035 and redirects setjmp to _setjmp3 on i386, and __intrinsic_setjmp and __intrinsic_setjmpex on all other architectures for 32 and 64 bit respectively. When building setjmp/longjmp code with MSVC, the linked modules end up linking to those the __intrinsic_setjmp* functions on ARM/ARM64 platforms. On x86_64, MSVC actually links to __intrinsic_setjmp, but linking to __intrinsic_setjmpex also seems to work fine.) This fixes reported issues about running binaries linked against ucrtbase.dll on i386. Signed-off-by: Martin Storsjö <ma...@ma...> --- mingw-w64-crt/lib-common/ucrtbase.def.in | 4 ++-- mingw-w64-headers/crt/setjmp.h | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/mingw-w64-crt/lib-common/ucrtbase.def.in b/mingw-w64-crt/lib-common/ucrtbase.def.in index d260ae4..25e863a 100644 --- a/mingw-w64-crt/lib-common/ucrtbase.def.in +++ b/mingw-w64-crt/lib-common/ucrtbase.def.in @@ -105,7 +105,7 @@ __initialize_lconv_for_unsigned_char __lconv_init == __initialize_lconv_for_unsigned_char __intrinsic_abnormal_termination __intrinsic_setjmp -__intrinsic_setjmpex +F64(__intrinsic_setjmpex) __isascii __iscsym __iscsymf @@ -2508,7 +2508,7 @@ scalbnl set_terminate set_unexpected setbuf -setjmp +F_X64(setjmp) setlocale setvbuf signal diff --git a/mingw-w64-headers/crt/setjmp.h b/mingw-w64-headers/crt/setjmp.h index db9ee7f..ec4b013 100644 --- a/mingw-w64-headers/crt/setjmp.h +++ b/mingw-w64-headers/crt/setjmp.h @@ -202,7 +202,14 @@ extern "C" { void * __cdecl __attribute__ ((__nothrow__)) mingw_getsp (void); -#if !defined(USE_NO_MINGW_SETJMP_TWO_ARGS) && __MSVCRT_VERSION__ < 0x1400 +#if !defined(USE_NO_MINGW_SETJMP_TWO_ARGS) +# if __MSVCRT_VERSION__ >= 0x1400 +# ifdef _WIN64 +# define _setjmp __intrinsic_setjmpex +# else +# define _setjmp __intrinsic_setjmp +# endif +# endif # ifndef _INC_SETJMPEX # if defined(_X86_) || defined(__i386__) # define setjmp(BUF) _setjmp3((BUF), NULL) @@ -234,7 +241,7 @@ void * __cdecl __attribute__ ((__nothrow__)) mingw_getsp (void); #else -# if !defined(_INC_SETJMPEX) && __MSVCRT_VERSION__ < 0x1400 +# if !defined(_INC_SETJMPEX) # define setjmp _setjmp # endif -- 2.7.4 |