1; RUN: llc %s -o %t.o -filetype=obj
2; RUN: llvm-as %S/Inputs/used.ll -o %t1.o
3; RUN: wasm-ld %t.o %t1.o -o %t.wasm
4; RUN: obj2yaml %t.wasm | FileCheck %s
5
6; Verify that symbols references from regular objects are preserved by LTO
7
8target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
9target triple = "wasm32-unknown-unknown"
10
11declare void @bar()
12
13@foo = external global i32
14
15define void @_start() {
16  %val = load i32, i32* @foo, align 4
17  %tobool = icmp ne i32 %val, 0
18  br i1 %tobool, label %callbar, label %return
19
20callbar:
21  call void @bar()
22  br label %return
23
24return:
25  ret void
26}
27
28; CHECK:        - Type:            DATA
29; CHECK-NEXT:     Segments:
30; CHECK-NEXT:       - SectionOffset:   7
31; CHECK-NEXT:         InitFlags:       0
32; CHECK-NEXT:         Offset:
33; CHECK-NEXT:           Opcode:          I32_CONST
34; CHECK-NEXT:           Value:           1024
35; CHECK-NEXT:         Content:         '01000000'
36
37; CHECK:       - Type:            CUSTOM
38; CHECK-NEXT:    Name:            name
39; CHECK-NEXT:    FunctionNames:
40; CHECK-NEXT:      - Index:           0
41; CHECK-NEXT:        Name:            _start
42; CHECK-NEXT:      - Index:           1
43; CHECK-NEXT:        Name:            bar
44