1; Static code 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 9 10; PIC code 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 16 17target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128" 18target triple = "wasm32-unknown-emscripten" 19 20declare void @foo(ptr) 21declare void @bar(ptr) 22 23define void @_start() { 24 call void @foo(ptr null) 25 call void @bar(ptr null) 26 ret void 27} 28 29; NOPIC: Sections: 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: 37; NOPIC-NEXT: - I32 38; NOPIC-NEXT: ReturnTypes: [] 39 40; NOPIC: - Type: TAG 41; NOPIC-NEXT: TagTypes: [ 1 ] 42 43; Global section has to come after tag section 44; NOPIC: - Type: GLOBAL 45 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 51 52; In PIC mode, tags are undefined and imported from JS. 53; PIC: Sections: 54; PIC: - Type: TYPE 55; PIC-NEXT: Signatures: 56; PIC-NEXT: - Index: 0 57; PIC-NEXT: ParamTypes: 58; PIC-NEXT: - I32 59; PIC-NEXT: ReturnTypes: [] 60; PIC-NEXT: - Index: 1 61; PIC-NEXT: ParamTypes: [] 62; PIC-NEXT: ReturnTypes: [] 63 64; PIC: - Type: IMPORT 65; PIC-NEXT: Imports: 66; PIC: - Module: env 67; PIC: Field: __cpp_exception 68; PIC-NEXT: Kind: TAG 69; PIC-NEXT: SigIndex: 0 70 71; In PIC mode, tags should NOT be defined in the module; they are imported. 72; PIC-NOT: - Type: TAG 73