WASI mssing signal and siglongjmp support. This patch workaround build error and add simd128 flag. Please note that many tests use large array on stack, so you need to increase the stack size when build checkasm, e.g., --extra-ldflags='-Wl,-z,stack-size=10485760'
Unified · Split
| @@ -363,6 +363,8 @@ static const struct { · 362 unmodified lines | |||
| 363 | #elif ARCH_LOONGARCH | 363 | #elif ARCH_LOONGARCH |
| 364 | { "LSX", "lsx", AV_CPU_FLAG_LSX }, | 364 | { "LSX", "lsx", AV_CPU_FLAG_LSX }, |
| 365 | { "LASX", "lasx", AV_CPU_FLAG_LASX }, | 365 | { "LASX", "lasx", AV_CPU_FLAG_LASX }, |
| 366 | #elif ARCH_WASM | ||
| 367 | { "SIMD128", "simd128", AV_CPU_FLAG_SIMD128 }, | ||
| 366 | #endif | 368 | #endif |
| 367 | { NULL } | 369 | { NULL } |
| 368 | }; | 370 | }; |
| @@ -770,6 +772,8 @@ static LONG NTAPI signal_handler(EXCEPTION_POINTERS *e) { · 401 unmodified lines | |||
| 770 | } | 772 | } |
| 771 | #endif | 773 | #endif |
| 772 | #else | 774 | #else |
| 775 | |||
| 776 | #ifndef _WASI_EMULATED_SIGNAL | ||
| 773 | static void signal_handler(int s); | 777 | static void signal_handler(int s); |
| 774 | 778 | ||
| 775 | static const struct sigaction signal_handler_act = { | 779 | static const struct sigaction signal_handler_act = { |
| @@ -784,6 +788,8 @@ static void signal_handler(int s) { · 8 unmodified lines | |||
| 784 | checkasm_load_context(s); | 788 | checkasm_load_context(s); |
| 785 | } | 789 | } |
| 786 | } | 790 | } |
| 791 | #endif // _WASI_EMULATED_SIGNAL | ||
| 792 | |||
| 787 | #endif | 793 | #endif |
| 788 | 794 | ||
| 789 | /* Compares a string with a wildcard pattern. */ | 795 | /* Compares a string with a wildcard pattern. */ |
| @@ -933,10 +939,12 @@ int main(int argc, char *argv[]) · 143 unmodified lines | |||
| 933 | AddVectoredExceptionHandler(0, signal_handler); | 939 | AddVectoredExceptionHandler(0, signal_handler); |
| 934 | #endif | 940 | #endif |
| 935 | #else | 941 | #else |
| 942 | #ifndef _WASI_EMULATED_SIGNAL | ||
| 936 | sigaction(SIGBUS, &signal_handler_act, NULL); | 943 | sigaction(SIGBUS, &signal_handler_act, NULL); |
| 937 | sigaction(SIGFPE, &signal_handler_act, NULL); | 944 | sigaction(SIGFPE, &signal_handler_act, NULL); |
| 938 | sigaction(SIGILL, &signal_handler_act, NULL); | 945 | sigaction(SIGILL, &signal_handler_act, NULL); |
| 939 | sigaction(SIGSEGV, &signal_handler_act, NULL); | 946 | sigaction(SIGSEGV, &signal_handler_act, NULL); |
| 947 | #endif // _WASI_EMULATED_SIGNAL | ||
| 940 | #endif | 948 | #endif |
| 941 | #if HAVE_PRCTL && defined(PR_SET_UNALIGN) | 949 | #if HAVE_PRCTL && defined(PR_SET_UNALIGN) |
| 942 | prctl(PR_SET_UNALIGN, PR_UNALIGN_SIGBUS); | 950 | prctl(PR_SET_UNALIGN, PR_UNALIGN_SIGBUS); |
| @@ -66,12 +66,23 @@ typedef struct { CONTEXT c; int status; } checkasm_context; · 65 unmodified lines | |||
| 66 | #define checkasm_save_context() 0 | 66 | #define checkasm_save_context() 0 |
| 67 | #define checkasm_load_context() do {} while (0) | 67 | #define checkasm_load_context() do {} while (0) |
| 68 | #endif | 68 | #endif |
| 69 | #else | 69 | #else // _WIN32 |
| 70 | |||
| 71 | #ifdef _WASI_EMULATED_SIGNAL | ||
| 72 | |||
| 73 | #define checkasm_context void* | ||
| 74 | #define checkasm_save_context() 0 | ||
| 75 | #define checkasm_load_context() do {} while (0) | ||
| 76 | |||
| 77 | #else // _WASI_EMULATED_SIGNAL | ||
| 78 | |||
| 70 | #include <setjmp.h> | 79 | #include <setjmp.h> |
| 71 | typedef sigjmp_buf checkasm_context; | 80 | typedef sigjmp_buf checkasm_context; |
| 72 | #define checkasm_save_context() checkasm_handle_signal(sigsetjmp(checkasm_context_buf, 1)) | 81 | #define checkasm_save_context() checkasm_handle_signal(sigsetjmp(checkasm_context_buf, 1)) |
| 73 | #define checkasm_load_context(s) siglongjmp(checkasm_context_buf, s) | 82 | #define checkasm_load_context(s) siglongjmp(checkasm_context_buf, s) |
| 74 | #endif | 83 | #endif // _WASI_EMULATED_SIGNAL |
| 84 | |||
| 85 | #endif // _WIN32 | ||
| 75 | 86 | ||
| 76 | void checkasm_check_aacencdsp(void); | 87 | void checkasm_check_aacencdsp(void); |
| 77 | void checkasm_check_aacpsdsp(void); | 88 | void checkasm_check_aacpsdsp(void); |