1; RUN: llvm-as %s -o %t.o
2; RUN: wasm-ld -r -o %t.wasm %t.o
3; RUN: obj2yaml %t.wasm | FileCheck %s
4
5target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
6target triple = "wasm32-unknown-unknown"
7
8@missing_data = external global i32
9declare i32 @missing_func() local_unnamed_addr
10
11define i32 @foo() {
12entry:
13  %0 = call i32 @missing_func()
14  %1 = load i32, i32* @missing_data, align 4
15  ret i32 %1
16}
17
18
19; CHECK:        - Type:            CUSTOM
20; CHECK-NEXT:     Name:            linking
21; CHECK-NEXT:     Version:         2
22; CHECK-NEXT:     SymbolTable:
23; CHECK-NEXT:       - Index:           0
24; CHECK-NEXT:         Kind:            FUNCTION
25; CHECK-NEXT:         Name:            missing_func
26; CHECK-NEXT:         Flags:           [ UNDEFINED ]
27; CHECK-NEXT:         Function:        0
28; CHECK-NEXT:       - Index:           1
29; CHECK-NEXT:         Kind:            FUNCTION
30; CHECK-NEXT:         Name:            foo
31; CHECK-NEXT:         Flags:           [  ]
32; CHECK-NEXT:         Function:        1
33; CHECK-NEXT:       - Index:           2
34; CHECK-NEXT:         Kind:            DATA
35; CHECK-NEXT:         Name:            missing_data
36; CHECK-NEXT:         Flags:           [ UNDEFINED ]
37