@@ -1291,8 +1291,16 @@ impl Step for Libunwind {
12911291 cfg. define ( "__NO_MATH_INLINES" , None ) ;
12921292 cfg. define ( "_LIBUNWIND_IS_BAREMETAL" , None ) ;
12931293 cfg. define ( "__LIBUNWIND_IS_NATIVE_ONLY" , None ) ;
1294+ cfg. define ( "_LIBUNWIND_SUPPORT_SEH_UNWIND" , None ) ;
12941295 cfg. define ( "NDEBUG" , None ) ;
12951296 }
1297+ if self . target . contains ( "wasi" ) {
1298+ cfg. flag ( "-fdeclspec" ) ;
1299+ cfg. flag ( "-fwasm-exceptions" ) ;
1300+ cfg. define ( "_LIBUNWIND_HIDE_SYMBOLS" , None ) ;
1301+ cfg. define ( "_LIBUNWIND_IS_BAREMETAL" , None ) ;
1302+ cfg. define ( "__USING_WASM_EXCEPTIONS__" , None ) ;
1303+ }
12961304 if self . target . is_windows ( ) {
12971305 cfg. define ( "_LIBUNWIND_HIDE_SYMBOLS" , "1" ) ;
12981306 cfg. define ( "_LIBUNWIND_IS_NATIVE_ONLY" , "1" ) ;
@@ -1327,13 +1335,17 @@ impl Step for Libunwind {
13271335 }
13281336 }
13291337
1330- let mut c_sources = vec ! [
1331- "Unwind-sjlj.c" ,
1332- "UnwindLevel1-gcc-ext.c" ,
1333- "UnwindLevel1.c" ,
1334- "UnwindRegistersRestore.S" ,
1335- "UnwindRegistersSave.S" ,
1336- ] ;
1338+ let mut c_sources = if self . target . contains ( "wasi" ) {
1339+ vec ! [ "Unwind-wasm.c" ]
1340+ } else {
1341+ vec ! [
1342+ "Unwind-sjlj.c" ,
1343+ "UnwindLevel1-gcc-ext.c" ,
1344+ "UnwindLevel1.c" ,
1345+ "UnwindRegistersRestore.S" ,
1346+ "UnwindRegistersSave.S" ,
1347+ ]
1348+ } ;
13371349
13381350 let cpp_sources = vec ! [ "Unwind-EHABI.cpp" , "Unwind-seh.cpp" , "libunwind.cpp" ] ;
13391351 let cpp_len = cpp_sources. len ( ) ;
0 commit comments