45 lines · plain
1; Verify that the -u / --undefined option is able to pull in symbols from2; an archive, and doesn't error when uses to pull in a symbol already loaded.3;4; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/ret64.s -o %t.o5; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/ret32.s -o %t2.o6; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/start.s -o %t.start.o7; RUN: rm -f %t2.a8; RUN: llvm-ar rcs %t2.a %t2.o9; RUN: wasm-ld %t.start.o --no-gc-sections %t2.a %t.o -o %t.wasm -u ret32 --undefined ret6410; RUN: obj2yaml %t.wasm | FileCheck %s11; RUN: wasm-ld %t.start.o --no-gc-sections %t2.a %t.o -o %t2.wasm12; RUN: obj2yaml %t2.wasm | FileCheck %s -check-prefix=NO-LOAD13 14; CHECK: Name: name15; CHECK-NEXT: FunctionNames: 16; CHECK-NEXT: - Index: 017; CHECK-NEXT: Name: __wasm_call_ctors18; CHECK-NEXT: - Index: 119; CHECK-NEXT: Name: _start20; CHECK-NEXT: - Index: 221; CHECK-NEXT: Name: ret6422; CHECK-NEXT: - Index: 323; CHECK-NEXT: Name: ret3224; CHECK-NEXT: GlobalNames:25; CHECK-NEXT: - Index: 026; CHECK-NEXT: Name: __stack_pointer27; CHECK-NEXT: ...28 29; NO-LOAD: Name: name30; NO-LOAD-NEXT: FunctionNames: 31; NO-LOAD-NEXT: - Index: 032; NO-LOAD-NEXT: Name: __wasm_call_ctors33; NO-LOAD-NEXT: - Index: 134; NO-LOAD-NEXT: Name: _start35; NO-LOAD-NEXT: - Index: 236; NO-LOAD-NEXT: Name: ret6437; NO-LOAD-NEXT: GlobalNames:38; NO-LOAD-NEXT: - Index: 039; NO-LOAD-NEXT: Name: __stack_pointer40; NO-LOAD-NEXT: ...41 42; Verify that referencing a symbol that is not found doesn't result in a link43; failure. This matches the behaviour of the ELF linker.44; RUN: wasm-ld %t.start.o -o %t.wasm -u symboldoesnotexist45