1; RUN: llc -filetype=obj %s -o %t.o
2; RUN: wasm-ld --relocatable -o %t.wasm %t.o
3; RUN: obj2yaml %t.wasm | FileCheck %s
4
5target triple = "wasm32-unknown-unknown"
6
7; Function Attrs: nounwind
8define i32 @_start() local_unnamed_addr {
9entry:
10  %retval = alloca i32, align 4
11  ret i32 0
12}
13
14; CHECK:      --- !WASM
15; CHECK-NEXT: FileHeader:
16; CHECK-NEXT:   Version:         0x1
17; CHECK-NEXT: Sections:
18; CHECK-NEXT:   - Type:            TYPE
19; CHECK-NEXT:     Signatures:
20; CHECK-NEXT:       - Index:           0
21; CHECK-NEXT:         ParamTypes:
22; CHECK-NEXT:         ReturnTypes:
23; CHECK-NEXT:           - I32
24; CHECK-NEXT:   - Type:            IMPORT
25; CHECK-NEXT:     Imports:
26; CHECK-NEXT:       - Module:          env
27; CHECK-NEXT:         Field:           __stack_pointer
28; CHECK-NEXT:         Kind:            GLOBAL
29; CHECK-NEXT:         GlobalType:      I32
30; CHECK-NEXT:         GlobalMutable:   true
31; CHECK-NEXT:   - Type:            FUNCTION
32; CHECK-NEXT:     FunctionTypes:   [ 0 ]
33; CHECK-NEXT:   - Type:            TABLE
34; CHECK-NEXT:     Tables:
35; CHECK-NEXT:       - Index:           0
36; CHECK-NEXT:         ElemType:        FUNCREF
37; CHECK-NEXT:         Limits:
38; CHECK-NEXT:           Flags:           [ HAS_MAX ]
39; CHECK-NEXT:           Initial:         0x1
40; CHECK-NEXT:           Maximum:         0x1
41; CHECK-NEXT:   - Type:            MEMORY
42; CHECK-NEXT:     Memories:
43; CHECK-NEXT:       - Initial:         0x0
44; CHECK-NEXT:   - Type:            CODE
45; CHECK-NEXT:     Relocations:
46; CHECK-NEXT:       - Type:            R_WASM_GLOBAL_INDEX_LEB
47; CHECK-NEXT:         Index:           1
48; CHECK-NEXT:         Offset:          0x4
49; CHECK-NEXT:     Functions:
50; CHECK-NEXT:       - Index:           0
51; CHECK-NEXT:         Locals:
52; CHECK-NEXT:         Body:            23808080800041106B1A41000B
53; CHECK-NEXT:   - Type:            CUSTOM
54; CHECK-NEXT:     Name:            linking
55; CHECK-NEXT:     Version:         2
56; CHECK-NEXT:     SymbolTable:
57; CHECK-NEXT:       - Index:           0
58; CHECK-NEXT:         Kind:            FUNCTION
59; CHECK-NEXT:         Name:            _start
60; CHECK-NEXT:         Flags:           [  ]
61; CHECK-NEXT:         Function:        0
62; CHECK-NEXT:       - Index:           1
63; CHECK-NEXT:         Kind:            GLOBAL
64; CHECK-NEXT:         Name:            __stack_pointer
65; CHECK-NEXT:         Flags:           [ UNDEFINED ]
66; CHECK-NEXT:         Global:          0
67; CHECK-NEXT:   - Type:            CUSTOM
68; CHECK-NEXT:     Name:            name
69; CHECK-NEXT:     FunctionNames:
70; CHECK-NEXT:       - Index:           0
71; CHECK-NEXT:         Name:            _start
72; CHECK-NEXT:     GlobalNames:
73; CHECK-NEXT:       - Index:           0
74; CHECK-NEXT:         Name:            __stack_pointer
75; CHECK-NEXT: ...
76