1 # RUN: split-file %s %t
2 # RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t_main.o %t/main.s
3 # RUN: llvm-as %S/Inputs/foo.ll -o %t_foo.o
4 # RUN: llvm-as %S/Inputs/libcall.ll -o %t_libcall.o
5 # RUN: wasm-ld %t_main.o %t_libcall.o %t_foo.o %p/Inputs/stub.so -o %t.wasm
6 # RUN: obj2yaml %t.wasm | FileCheck %s
8 # The function `func_with_libcall` will generate an undefined reference to
9 # `memcpy` at LTO time. `memcpy` itself also declared in stub.so and depends
12 # If %t_foo.o is not included in the link we get an undefined symbol reported
13 # to the dependency of memcpy on the foo export:
15 # RUN: not wasm-ld %t_main.o %t_libcall.o %p/Inputs/stub.so -o %t.wasm 2>&1 | FileCheck --check-prefix=MISSING %s
16 # MISSING: stub.so: undefined symbol: foo. Required by memcpy
19 .functype func_with_libcall (i32, i32) -> ()
22 .functype _start () -> ()
25 call func_with_libcall
29 # CHECK-NEXT: - Module: env
30 # CHECK-NEXT: Field: memcpy
31 # CHECK-NEXT: Kind: FUNCTION
32 # CHECK-NEXT: SigIndex: 0
35 # CHECK-NEXT: - Name: memory
36 # CHECK-NEXT: Kind: MEMORY
37 # CHECK-NEXT: Index: 0
38 # CHECK-NEXT: - Name: _start
39 # CHECK-NEXT: Kind: FUNCTION
40 # CHECK-NEXT: Index: 1
41 # CHECK-NEXT: - Name: foo
42 # CHECK-NEXT: Kind: FUNCTION
43 # CHECK-NEXT: Index: 3