brintos

brintos / llvm-project-archived public Read only

0
0
Text · 905 B · 3973042 Raw
32 lines · plain
1; RUN: llvm-as %s -o %t.o2; RUN: wasm-ld %t.o -o %t.wasm3; RUN: obj2yaml %t.wasm | FileCheck %s4 5; Test that undefined weak external functions are handled in the LTO case6; We had a bug where stub function generation was failing because functions7; 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 will17; remove it, so it will never be referenced by an normal object file, and18; therefore never have a signature.19define void @unused_function() #0 {20entry:21    %call2 = call i32 @bar()22    ret void23}24 25define void @_start() #0 {26entry:27    %call2 = call i32 @foo()28    ret void29}30 31; CHECK: Name:            'undefined_weak:foo'32