Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / wasm / stub-library.s
blob9cbf2505ea9e778e93abadffed22d6fec2b14d35
1 # RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.o %s
2 # RUN: wasm-ld %t.o %p/Inputs/libstub.so -o %t.wasm
3 # RUN: obj2yaml %t.wasm | FileCheck %s
5 # When the dependencies are missing the link fails
6 # RUN: not wasm-ld %t.o %p/Inputs/libstub-missing-dep.so -o %t.wasm 2>&1 | FileCheck --check-prefix=MISSING-DEP %s
8 # When the dependencies are missing the link fails
9 # RUN: not wasm-ld %t.o %p/Inputs/libstub-missing-sym.so -o %t.wasm 2>&1 | FileCheck --check-prefix=MISSING-SYM %s
11 # MISSING-DEP: libstub-missing-dep.so: undefined symbol: missing_dep. Required by foo
12 # MISSING-DEP: libstub-missing-dep.so: undefined symbol: missing_dep2. Required by foo
14 # MISSING-SYM: undefined symbol: foo
16 # The function foo is defined in libstub.so but depend on foodep1 and foodep2
17 .functype foo () -> ()
19 .globl foodep1
20 foodep1:
21 .functype foodep1 () -> ()
22 end_function
24 .globl foodep2
25 foodep2:
26 .functype foodep2 () -> ()
27 end_function
29 .globl _start
30 _start:
31 .functype _start () -> ()
32 call foo
33 end_function
35 # CHECK: - Type: EXPORT
36 # CHECK-NEXT: Exports:
37 # CHECK-NEXT: - Name: memory
38 # CHECK-NEXT: Kind: MEMORY
39 # CHECK-NEXT: Index: 0
40 # CHECK-NEXT: - Name: foodep1
41 # CHECK-NEXT: Kind: FUNCTION
42 # CHECK-NEXT: Index: 1
43 # CHECK-NEXT: - Name: foodep2
44 # CHECK-NEXT: Kind: FUNCTION
45 # CHECK-NEXT: Index: 2
46 # CHECK-NEXT: - Name: _start
47 # CHECK-NEXT: Kind: FUNCTION
48 # CHECK-NEXT: Index: 3