brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.1 KiB · 45a578f Raw
75 lines · plain
1; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t_tags.o %p/Inputs/tags.s2 3; Static code, with tags defined in tags.s4; RUN: llc -filetype=obj -wasm-enable-eh -exception-model=wasm -mattr=+exception-handling %p/Inputs/tag-section1.ll -o %t1.o5; RUN: llc -filetype=obj -wasm-enable-eh -exception-model=wasm -mattr=+exception-handling %p/Inputs/tag-section2.ll -o %t2.o6; RUN: llc -filetype=obj -wasm-enable-eh -exception-model=wasm -mattr=+exception-handling %s -o %t.o7; RUN: wasm-ld -o %t.wasm %t.o %t1.o %t2.o %t_tags.o8; RUN: wasm-ld --export-all -o %t-export-all.wasm %t.o %t1.o %t2.o %t_tags.o9; RUN: obj2yaml %t.wasm | FileCheck %s --check-prefix=NOPIC10; RUN: obj2yaml %t-export-all.wasm | FileCheck %s --check-prefix=NOPIC-EXPORT-ALL11 12; PIC code with tags imported13; RUN: llc -filetype=obj -wasm-enable-eh -exception-model=wasm -mattr=+exception-handling -relocation-model=pic %p/Inputs/tag-section1.ll -o %t1.o14; RUN: llc -filetype=obj -wasm-enable-eh -exception-model=wasm -mattr=+exception-handling -relocation-model=pic %p/Inputs/tag-section2.ll -o %t2.o15; RUN: llc -filetype=obj -wasm-enable-eh -exception-model=wasm -mattr=+exception-handling -relocation-model=pic %s -o %t.o16; RUN: wasm-ld --import-undefined --experimental-pic --unresolved-symbols=import-dynamic -pie -o %t_pic.wasm %t.o %t1.o %t2.o17; RUN: obj2yaml %t_pic.wasm | FileCheck %s --check-prefix=PIC18 19target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"20target triple = "wasm32-unknown-emscripten"21 22declare void @foo(ptr)23declare void @bar(ptr)24 25define void @_start() {26  call void @foo(ptr null)27  call void @bar(ptr null)28  ret void29}30 31; NOPIC:      Sections:32; NOPIC-NEXT:   - Type:            TYPE33; NOPIC-NEXT:     Signatures:34; NOPIC-NEXT:       - Index:           035; NOPIC-NEXT:         ParamTypes:      []36; NOPIC-NEXT:         ReturnTypes:     []37; NOPIC-NEXT:       - Index:           138; NOPIC-NEXT:         ParamTypes:39; NOPIC-NEXT:           - I3240; NOPIC-NEXT:         ReturnTypes:     []41 42; NOPIC:        - Type:            TAG43; NOPIC-NEXT:     TagTypes:        [ 1 ]44 45; Global section has to come after tag section46; NOPIC:        - Type:            GLOBAL47 48; NOPIC-EXPORT-ALL:   - Type:            EXPORT49; NOPIC-EXPORT-ALL-NEXT Exports:50; NOPIC-EXPORT-ALL:       - Name:            __cpp_exception51; NOPIC-EXPORT-ALL:         Kind:            TAG52; NOPIC-EXPORT-ALL:         Index:           053 54; In PIC mode, we leave the tags as undefined and they should be imported55; PIC:        Sections:56; PIC:         - Type:            TYPE57; PIC-NEXT:      Signatures:58; PIC-NEXT:        - Index:           059; PIC-NEXT:          ParamTypes:60; PIC-NEXT:            - I3261; PIC-NEXT:          ReturnTypes:     []62; PIC-NEXT:        - Index:           163; PIC-NEXT:          ParamTypes:      []64; PIC-NEXT:          ReturnTypes:     []65 66; PIC:         - Type:            IMPORT67; PIC-NEXT:      Imports:68; PIC:             - Module:          env69; PIC:               Field:           __cpp_exception70; PIC-NEXT:          Kind:            TAG71; PIC-NEXT:          SigIndex:        072 73; In PIC mode, tags should NOT be defined in the module; they are imported.74; PIC-NOT:     - Type:            TAG75