1; RUN: llc -filetype=obj -exception-model=wasm -mattr=+exception-handling %p/Inputs/event-section1.ll -o %t1.o
2; RUN: llc -filetype=obj -exception-model=wasm -mattr=+exception-handling %p/Inputs/event-section2.ll -o %t2.o
3; RUN: llc -filetype=obj -exception-model=wasm -mattr=+exception-handling %s -o %t.o
4; RUN: wasm-ld -o %t.wasm %t.o %t1.o %t2.o
5; RUN: wasm-ld --export-all -o %t-export-all.wasm %t.o %t1.o %t2.o
6; RUN: obj2yaml %t.wasm | FileCheck %s
7; RUN: obj2yaml %t-export-all.wasm | FileCheck %s --check-prefix=EXPORT-ALL
8
9target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
10target triple = "wasm32-unknown-unknown"
11
12declare void @foo(i8*)
13declare void @bar(i8*)
14
15define void @_start() {
16  call void @foo(i8* null)
17  call void @bar(i8* null)
18  ret void
19}
20
21; CHECK:      Sections:
22; CHECK-NEXT:   - Type:            TYPE
23; CHECK-NEXT:     Signatures:
24; CHECK-NEXT:       - Index:           0
25; CHECK-NEXT:         ParamTypes:      []
26; CHECK-NEXT:         ReturnTypes:     []
27; CHECK-NEXT:       - Index:           1
28; CHECK-NEXT:         ParamTypes:
29; CHECK-NEXT:           - I32
30; CHECK-NEXT:         ReturnTypes:     []
31
32; CHECK:        - Type:            EVENT
33; CHECK-NEXT:     Events:
34; CHECK-NEXT:       - Index:           0
35; CHECK-NEXT:         Attribute:       0
36; CHECK-NEXT:         SigIndex:        1
37
38; Global section has to come after event section
39; CHECK:        - Type:            GLOBAL
40
41; EXPORT-ALL:   - Type:            EXPORT
42; EXPORT-ALL-NEXT Exports:
43; EXPORT-ALL:       - Name:            __cpp_exception
44; EXPORT-ALL:         Kind:            EVENT
45; EXPORT-ALL:         Index:           0
46