1; RUN: llvm-as %s -o %t.o 2; RUN: wasm-ld %t.o -o %t.wasm 3; RUN: obj2yaml %t.wasm | FileCheck %s 4 5; Test that undefined weak external functions are handled in the LTO case 6; We had a bug where stub function generation was failing because functions 7; that are in bitcode (pre-LTO) don't have signatures assigned. 8 9target datalayout = "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-n32:64-S128-ni:1:10:20" 10target triple = "wasm32-unknown-unknown" 11 12declare extern_weak i32 @foo() 13 14declare extern_weak i32 @bar() 15 16; The reference to bar here will exist in the LTO file, but the LTO process will 17; remove it, so it will never be referenced by an normal object file, and 18; therefore never have a signature. 19define void @unused_function() #0 { 20entry: 21 %call2 = call i32 @bar() 22 ret void 23} 24 25define void @_start() #0 { 26entry: 27 %call2 = call i32 @foo() 28 ret void 29} 30 31; CHECK: Name: 'undefined_weak:foo' 32