43 lines · plain
1## The function `bar` is declared in stub.so and depends on `foo` which is2## defined in an LTO object. We also test the case where the LTO object is3## with an archive file.4## This verifies that stub library dependencies (which are required exports) can5## be defined in LTO objects, even when they are within archive files.6 7# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.o %s8# RUN: mkdir -p %t9# RUN: llvm-as %S/Inputs/foo.ll -o %t/foo.o10# RUN: wasm-ld %t.o %t/foo.o %p/Inputs/stub.so -o %t.wasm11# RUN: obj2yaml %t.wasm | FileCheck %s12 13## Run the same test but with foo.o inside of an archive file.14# RUN: rm -f %t/libfoo.a15# RUN: llvm-ar rcs %t/libfoo.a %t/foo.o16# RUN: wasm-ld %t.o %t/libfoo.a %p/Inputs/stub.so -o %t2.wasm17# RUN: obj2yaml %t2.wasm | FileCheck %s18 19.functype bar () -> ()20 21.globl _start22_start:23 .functype _start () -> ()24 call bar25 end_function26 27# CHECK: Imports:28# CHECK-NEXT: - Module: env29# CHECK-NEXT: Field: bar30# CHECK-NEXT: Kind: FUNCTION31# CHECK-NEXT: SigIndex: 032 33# CHECK: Exports:34# CHECK-NEXT: - Name: memory35# CHECK-NEXT: Kind: MEMORY36# CHECK-NEXT: Index: 037# CHECK-NEXT: - Name: _start38# CHECK-NEXT: Kind: FUNCTION39# CHECK-NEXT: Index: 140# CHECK-NEXT: - Name: foo41# CHECK-NEXT: Kind: FUNCTION42# CHECK-NEXT: Index: 243