summaryrefslogtreecommitdiff
path: root/test/passes/dwarf_with_exceptions.cpp
diff options
context:
space:
mode:
authorHeejin Ahn <aheejin@gmail.com>2021-02-19 05:26:04 +0900
committerGitHub <noreply@github.com>2021-02-19 05:26:04 +0900
commit629012c3f9a58ff2ecbac066788af57c16471969 (patch)
tree94166250455c634d2f59d30379e6892a1ac11094 /test/passes/dwarf_with_exceptions.cpp
parentd6ba20b0e43ea2a6cadbd82c236ad5614faafbbc (diff)
downloadbinaryen-629012c3f9a58ff2ecbac066788af57c16471969.tar.gz
binaryen-629012c3f9a58ff2ecbac066788af57c16471969.tar.bz2
binaryen-629012c3f9a58ff2ecbac066788af57c16471969.zip
[EH] Change catch_all's opcode (#3574)
We decided to change `catch_all`'s opcode from 0x05, which is the same as `else`, to 0x19, to avoid some complicated handling in the tools. See: https://github.com/WebAssembly/exception-handling/issues/147 lso this contains the original cpp file used to generate dwarf_with_exceptions.wasm; instructions to generate the wasm from that cpp file are in the comments.
Diffstat (limited to 'test/passes/dwarf_with_exceptions.cpp')
-rw-r--r--test/passes/dwarf_with_exceptions.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/passes/dwarf_with_exceptions.cpp b/test/passes/dwarf_with_exceptions.cpp
new file mode 100644
index 000000000..283b30064
--- /dev/null
+++ b/test/passes/dwarf_with_exceptions.cpp
@@ -0,0 +1,14 @@
+void foo();
+void dwarf_with_exceptions() {
+ try {
+ foo();
+ } catch (...) {
+ foo();
+ }
+}
+// How to generate dwarf_with_exceptions.wasm:
+// $ clang++ -std=c++14 --target=wasm32-unknown-unknown -g -fwasm-exceptions -Xclang -disable-O0-optnone -c -S -emit-llvm dwarf_with_exceptions.cpp -o temp.ll
+// $ opt -S -mem2reg -simplifycfg temp.ll -o dwarf_with_exceptions.ll
+// Remove some personal info from dwarf_with_exceptions.ll
+// $ llc -exception-model=wasm -mattr=+exception-handling -filetype=obj dwarf_with_exceptions.ll -o dwarf_with_exceptions.o
+// $ wasm-ld --no-entry --no-gc-sections --allow-undefined dwarf_with_exceptions.o -o dwarf_with_exceptions.wasm