File: dwarf_with_exceptions.cpp

package info (click to toggle)
binaryen 120-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 41,284 kB
  • sloc: cpp: 189,449; javascript: 62,189; ansic: 14,087; python: 5,379; pascal: 441; sh: 77; makefile: 30; asm: 27
file content (18 lines) | stat: -rw-r--r-- 723 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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