2 ; RUN: llc -filetype=obj -wasm-enable-eh -exception-model=wasm -mattr=+exception-handling %p/Inputs/tag-section1.ll -o %t1.o
3 ; RUN: llc -filetype=obj -wasm-enable-eh -exception-model=wasm -mattr=+exception-handling %p/Inputs/tag-section2.ll -o %t2.o
4 ; RUN: llc -filetype=obj -wasm-enable-eh -exception-model=wasm -mattr=+exception-handling %s -o %t.o
5 ; RUN: wasm-ld -o %t.wasm %t.o %t1.o %t2.o
6 ; RUN: wasm-ld --export-all -o %t-export-all.wasm %t.o %t1.o %t2.o
7 ; RUN: obj2yaml %t.wasm | FileCheck %s --check-prefix=NOPIC
8 ; RUN: obj2yaml %t-export-all.wasm | FileCheck %s --check-prefix=NOPIC-EXPORT-ALL
11 ; RUN: llc -filetype=obj -wasm-enable-eh -exception-model=wasm -mattr=+exception-handling -relocation-model=pic %p/Inputs/tag-section1.ll -o %t1.o
12 ; RUN: llc -filetype=obj -wasm-enable-eh -exception-model=wasm -mattr=+exception-handling -relocation-model=pic %p/Inputs/tag-section2.ll -o %t2.o
13 ; RUN: llc -filetype=obj -wasm-enable-eh -exception-model=wasm -mattr=+exception-handling -relocation-model=pic %s -o %t.o
14 ; RUN: wasm-ld --import-undefined --experimental-pic --unresolved-symbols=import-dynamic -pie -o %t.wasm %t.o %t1.o %t2.o
15 ; RUN: obj2yaml %t.wasm | FileCheck %s --check-prefix=PIC
17 target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
18 target triple = "wasm32-unknown-emscripten"
20 declare void @foo(ptr)
21 declare void @bar(ptr)
23 define void @_start() {
24 call void @foo(ptr null)
25 call void @bar(ptr null)
30 ; NOPIC-NEXT: - Type: TYPE
31 ; NOPIC-NEXT: Signatures:
32 ; NOPIC-NEXT: - Index: 0
33 ; NOPIC-NEXT: ParamTypes: []
34 ; NOPIC-NEXT: ReturnTypes: []
35 ; NOPIC-NEXT: - Index: 1
36 ; NOPIC-NEXT: ParamTypes:
38 ; NOPIC-NEXT: ReturnTypes: []
41 ; NOPIC-NEXT: TagTypes: [ 1 ]
43 ; Global section has to come after tag section
44 ; NOPIC: - Type: GLOBAL
46 ; NOPIC-EXPORT-ALL: - Type: EXPORT
47 ; NOPIC-EXPORT-ALL-NEXT Exports:
48 ; NOPIC-EXPORT-ALL: - Name: __cpp_exception
49 ; NOPIC-EXPORT-ALL: Kind: TAG
50 ; NOPIC-EXPORT-ALL: Index: 0
52 ; In PIC mode, tags are undefined and imported from JS.
55 ; PIC-NEXT: Signatures:
56 ; PIC-NEXT: - Index: 0
57 ; PIC-NEXT: ParamTypes:
59 ; PIC-NEXT: ReturnTypes: []
60 ; PIC-NEXT: - Index: 1
61 ; PIC-NEXT: ParamTypes: []
62 ; PIC-NEXT: ReturnTypes: []
67 ; PIC: Field: __cpp_exception
69 ; PIC-NEXT: SigIndex: 0
71 ; In PIC mode, tags should NOT be defined in the module; they are imported.
72 ; PIC-NOT: - Type: TAG