From 5f5b585d3b0db74de601672f90d76784f5ac79f4 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Mon, 27 Sep 2021 17:14:42 +0200 Subject: [PATCH 1/2] fix(compiler)-Use regular setjmp function for MinGW --- lib/vm/src/trap/handlers.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/vm/src/trap/handlers.c b/lib/vm/src/trap/handlers.c index 015e67cdc87..142976db71f 100644 --- a/lib/vm/src/trap/handlers.c +++ b/lib/vm/src/trap/handlers.c @@ -18,7 +18,13 @@ // it's fine most of the time, but not for JIT'd code that may not respect stack ordring // Using a special setjmp here, with NULL as second parameter to disable that behaviour // and have a regular simple setjmp/longjmp sequence +#ifdef __MINGW32__ +// MINGW64 doesn't expose the __intrinsic_setjmp function, so using regular setjump +// that seems to do the same thing as MSVC __intrinsic_setjmp(buf, NULL) +#define platform_setjmp(buf) setjmp(buf) +#else #define platform_setjmp(buf) __intrinsic_setjmp(buf, NULL) +#endif #define platform_longjmp(buf, arg) longjmp(buf, arg) #define platform_jmp_buf jmp_buf #elif defined(CFG_TARGET_OS_MACOS) From 98ad240cf837463d7f3b6446f4b38871ba4fd22b Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Mon, 27 Sep 2021 18:03:51 +0200 Subject: [PATCH 2/2] fix(compiler)-Use _setjmp function with NULL ctx for MinGW instead of regular jmpbuff --- lib/vm/src/trap/handlers.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/vm/src/trap/handlers.c b/lib/vm/src/trap/handlers.c index 142976db71f..3273353acc2 100644 --- a/lib/vm/src/trap/handlers.c +++ b/lib/vm/src/trap/handlers.c @@ -19,9 +19,8 @@ // Using a special setjmp here, with NULL as second parameter to disable that behaviour // and have a regular simple setjmp/longjmp sequence #ifdef __MINGW32__ -// MINGW64 doesn't expose the __intrinsic_setjmp function, so using regular setjump -// that seems to do the same thing as MSVC __intrinsic_setjmp(buf, NULL) -#define platform_setjmp(buf) setjmp(buf) +// MINGW64 doesn't expose the __intrinsic_setjmp function, but a similar _setjump instead +#define platform_setjmp(buf) _setjmp(buf, NULL) #else #define platform_setjmp(buf) __intrinsic_setjmp(buf, NULL) #endif