55 lines · plain
1; RUN: llc -filetype=obj %s -o %t.o2; RUN: llc -filetype=obj %S/Inputs/archive1.ll -o %t.a1.o3; RUN: llc -filetype=obj %S/Inputs/archive2.ll -o %t.a2.o4; RUN: llc -filetype=obj %S/Inputs/archive3.ll -o %t.a3.o5; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/hello.s -o %t.hello.o6; RUN: rm -f %t.a7; RUN: llvm-ar rcs %t.a %t.a1.o %t.a2.o %t.a3.o %t.hello.o8; RUN: rm -f %t.imports9; RUN: not wasm-ld %t.a %t.o -o %t.wasm 2>&1 | FileCheck -check-prefix=CHECK-UNDEFINED %s10 11; CHECK-UNDEFINED: undefined symbol: missing_func12 13; RUN: echo 'missing_func' > %t.imports14; RUN: wasm-ld -r %t.a %t.o -o %t.wasm15 16; RUN: llvm-nm -a %t.wasm | FileCheck %s17 18target triple = "wasm32-unknown-unknown"19 20declare i32 @foo() local_unnamed_addr #121declare i32 @missing_func() local_unnamed_addr #122 23define void @_start() local_unnamed_addr #0 {24entry:25 %call1 = call i32 @foo() #226 %call2 = call i32 @missing_func() #227 ret void28}29 30; Verify that mutually dependant object files in an archive is handled31; correctly. Since we're using llvm-nm, we must link with --relocatable.32;33; TODO(ncw): Update LLD so that the symbol table is written out for34; non-relocatable output (with an option to strip it)35 36; CHECK: 00000016 T _start37; CHECK-NEXT: 0000000a T archive2_symbol38; CHECK-NEXT: 00000001 T bar39; CHECK-NEXT: 0000000d T foo40; CHECK-NEXT: U missing_func41 42; Verify that symbols from unused objects don't appear in the symbol table43; CHECK-NOT: hello44 45; Specifying the same archive twice is allowed.46; RUN: wasm-ld %t.a %t.a %t.o -o %t.wasm47 48; Verfiy errors include library name49; RUN: not wasm-ld -u archive2_symbol -u archive3_symbol %t.a %t.o -o %t.wasm 2>&1 | FileCheck -check-prefix=CHECK-DUP %s50; And that this also works with --whole-archive51; RUN: not wasm-ld -u archive2_symbol -u archive3_symbol --whole-archive %t.a %t.o -o %t.wasm 2>&1 | FileCheck -check-prefix=CHECK-DUP %s52; CHECK-DUP: error: duplicate symbol: bar53; CHECK-DUP: >>> defined in {{.*}}.a({{.*}}.a2.o)54; CHECK-DUP: >>> defined in {{.*}}.a({{.*}}.a3.o)55