44 lines · plain
1## Test that weak undefined symbols do not fetch members from archive files.2# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %s -o %t.o3# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/ret32.s -o %t.ret32.o4# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/hello.s -o %t.hello.o5# RUN: rm -f %t.a6# RUN: llvm-ar rcs %t.a %t.ret32.o %t.hello.o7 8# RUN: wasm-ld %t.o %t.a -o %t.wasm9# RUN: obj2yaml %t.wasm | FileCheck %s10 11## Also test with the library symbols being read first12# RUN: wasm-ld %t.a %t.o -o %t2.wasm13# RUN: obj2yaml %t2.wasm | FileCheck %s14 15# RUN: wasm-ld -u hello_str %t.o %t.a -o %t2.wasm16# RUN: obj2yaml %t2.wasm | FileCheck %s -check-prefix=CHECK-DATA17 18# Weak external function symbol19.weak ret3220.functype ret32 () -> (i32)21 22# Weak external data symbol23.weak hello_str24 25.globl _start26_start:27 .functype _start () -> ()28 block29 i32.const hello_str30 i32.eqz31 br_if 032 call ret3233 drop34 end_block35 end_function36 37# Ensure we have no data section. If we do, would mean that hello_str was38# pulled out of the library.39# CHECK-NOT: Type: DATA40# CHECK-DATA: Type: DATA41 42# CHECK: Name: 'undefined_weak:ret32'43# CHECK-NOT: Name: ret3244