diff --git a/system/lib/compiler-rt/emscripten_setjmp.c b/system/lib/compiler-rt/emscripten_setjmp.c index 9c4afc3620d8..8dd944b010b5 100644 --- a/system/lib/compiler-rt/emscripten_setjmp.c +++ b/system/lib/compiler-rt/emscripten_setjmp.c @@ -81,13 +81,17 @@ struct __WasmLongjmpArgs { thread_local struct __WasmLongjmpArgs __wasm_longjmp_args; +// llvm uses `1` for the __c_longjmp tag. +// See https://github.com/llvm/llvm-project/blob/main/llvm/include/llvm/CodeGen/WasmEHFuncInfo.h +#define C_LONGJMP 1 + // Wasm EH allows us to throw and catch multiple values, but that requires // multivalue support in the toolchain, whch is not reliable at the time. // TODO Consider switching to throwing two values at the same time later. void __wasm_longjmp(void *env, int val) { __wasm_longjmp_args.env = env; __wasm_longjmp_args.val = val; - __builtin_wasm_throw(1, &__wasm_longjmp_args); + __builtin_wasm_throw(C_LONGJMP, &__wasm_longjmp_args); } #endif