@@ -934,7 +934,7 @@ def compile_wast_to_wasm(form, wast_tempfile, wasm_tempfile, opts):
934934
935935 return True
936936
937- def compile_wasm_to_aot (wasm_tempfile , aot_tempfile , runner , opts , r ):
937+ def compile_wasm_to_aot (wasm_tempfile , aot_tempfile , runner , opts , r , output = 'default' ):
938938 log ("Compiling AOT to '%s'" % aot_tempfile )
939939 cmd = [opts .aot_compiler ]
940940
@@ -973,6 +973,11 @@ def compile_wasm_to_aot(wasm_tempfile, aot_tempfile, runner, opts, r):
973973 if opts .multi_thread :
974974 cmd .append ("--enable-multi-thread" )
975975
976+ if output == 'object' :
977+ cmd .append ("--format=object" )
978+ elif output == 'ir' :
979+ cmd .append ("--format=llvmir-opt" )
980+
976981 # disable llvm link time optimization as it might convert
977982 # code of tail call into code of dead loop, and stack overflow
978983 # exception isn't thrown in several cases
@@ -1265,6 +1270,14 @@ def test_assert_with_exception(form, wast_tempfile, wasm_tempfile, aot_tempfile,
12651270 traceback .print_exc ()
12661271 print ("THE FINAL EXCEPTION IS {}" .format (e ))
12671272 ret_code = 101
1273+
1274+ if opts .aot or opts .xip :
1275+ if "indirect-mode" in str (e ):
1276+ compile_wasm_to_aot (wasm_tempfile , aot_tempfile , None , opts , None , "object" )
1277+ subprocess .check_call (["llvm-objdump" , "-r" , aot_tempfile ])
1278+ compile_wasm_to_aot (wasm_tempfile , aot_tempfile , None , opts , None , "ir" )
1279+ subprocess .check_call (["cat" , aot_tempfile ])
1280+
12681281 else :
12691282 ret_code = 0
12701283 finally :
0 commit comments