File tree Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -160,8 +160,12 @@ unsafe extern "C" fn cleanup(_code: i32, _ex: *mut Header) {
160160 ) ;
161161}
162162
163- #[ cfg( not( target_arch = "wasm32" ) ) ]
164163unsafe extern "C-unwind" {
164+ #[ cfg( target_arch = "wasm32" ) ]
165+ #[ link_name = "llvm.wasm.throw" ]
166+ fn wasm_throw ( tag : i32 , ex : * mut u8 ) -> !;
167+
168+ #[ cfg( not( target_arch = "wasm32" ) ) ]
165169 fn _Unwind_RaiseException ( ex : * mut u8 ) -> !;
166170}
167171
@@ -183,6 +187,6 @@ unsafe fn raise(ex: *mut u8) -> ! {
183187 #[ cfg( target_arch = "wasm32" ) ]
184188 // SAFETY: Passthrough.
185189 unsafe {
186- core :: arch :: wasm32 :: throw :: < 0 > ( ex) ;
190+ wasm_throw ( 0 , ex) ;
187191 }
188192}
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ unsafe impl ThrowByPointer for ActiveBackend {
1818 unsafe fn throw ( ex : * mut Header ) -> ! {
1919 // SAFETY: Wasm has no unwinder, so the pointer reaches `intercept` as-is.
2020 unsafe {
21- core :: arch :: wasm32 :: throw :: < 0 > ( ex. cast :: < u8 > ( ) . wrapping_add ( 1 ) ) ;
21+ wasm_throw ( 0 , ex. cast :: < u8 > ( ) . wrapping_add ( 1 ) ) ;
2222 }
2323 }
2424
@@ -34,7 +34,7 @@ unsafe impl ThrowByPointer for ActiveBackend {
3434 // safe because it's indistinguishable from not catching it in the first place due to
3535 // Wasm EH being performed by the VM.
3636 unsafe {
37- core :: arch :: wasm32 :: throw :: < 0 > ( ex ) ;
37+ wasm_throw ( 0 , ex . cast ( ) ) ;
3838 }
3939 }
4040
@@ -45,5 +45,10 @@ unsafe impl ThrowByPointer for ActiveBackend {
4545 }
4646}
4747
48+ unsafe extern "C-unwind" {
49+ #[ link_name = "llvm.wasm.throw" ]
50+ fn wasm_throw ( tag : i32 , ex : * mut u8 ) -> !;
51+ }
52+
4853#[ repr( C , align( 2 ) ) ]
4954pub struct Header ;
Original file line number Diff line number Diff line change 191191#![ cfg_attr( backend = "seh" , feature( fn_ptr_trait, std_internals) ) ]
192192#![ cfg_attr(
193193 any( backend = "wasm" , all( backend = "itanium" , target_arch = "wasm32" ) ) ,
194- feature( wasm_exception_handling_intrinsics )
194+ feature( link_llvm_intrinsics )
195195) ]
196196#![ deny( unsafe_op_in_unsafe_fn) ]
197197#![ warn(
You can’t perform that action at this time.
0 commit comments