1 ; RUN: llc -filetype=obj %s -o - | obj2yaml | FileCheck %s
3 target triple = "wasm32-unknown-unknown"
5 @global1 = global i32 1025, align 8
12 @llvm.global_ctors = appending global [2 x { i32, void ()*, i8* }] [
13 { i32, void ()*, i8* } { i32 65535, void ()* @func0, i8* null },
14 { i32, void ()*, i8* } { i32 42, void ()* @func1, i8* null }
17 @llvm.global_dtors = appending global [2 x { i32, void ()*, i8* }] [
18 { i32, void ()*, i8* } { i32 65535, void ()* @func2, i8* null },
19 { i32, void ()*, i8* } { i32 42, void ()* @func3, i8* null }
22 ; CHECK: - Type: IMPORT
23 ; CHECK-NEXT: Imports:
24 ; CHECK-NEXT: - Module: env
25 ; CHECK-NEXT: Field: __linear_memory
26 ; CHECK-NEXT: Kind: MEMORY
28 ; CHECK-NEXT: Initial: 0x00000001
29 ; CHECK-NEXT: - Module: env
30 ; CHECK-NEXT: Field: __indirect_function_table
31 ; CHECK-NEXT: Kind: TABLE
33 ; CHECK-NEXT: ElemType: FUNCREF
35 ; CHECK-NEXT: Initial: 0x00000002
36 ; CHECK-NEXT: - Module: env
37 ; CHECK-NEXT: Field: func3
38 ; CHECK-NEXT: Kind: FUNCTION
39 ; CHECK-NEXT: SigIndex: 1
40 ; CHECK-NEXT: - Module: env
41 ; CHECK-NEXT: Field: __cxa_atexit
42 ; CHECK-NEXT: Kind: FUNCTION
43 ; CHECK-NEXT: SigIndex: 2
44 ; CHECK-NEXT: - Module: env
45 ; CHECK-NEXT: Field: func2
46 ; CHECK-NEXT: Kind: FUNCTION
47 ; CHECK-NEXT: SigIndex: 1
48 ; CHECK-NEXT: - Module: env
49 ; CHECK-NEXT: Field: func1
50 ; CHECK-NEXT: Kind: FUNCTION
51 ; CHECK-NEXT: SigIndex: 1
52 ; CHECK-NEXT: - Module: env
53 ; CHECK-NEXT: Field: func0
54 ; CHECK-NEXT: Kind: FUNCTION
55 ; CHECK-NEXT: SigIndex: 1
56 ; CHECK-NEXT: - Type: FUNCTION
57 ; CHECK-NEXT: FunctionTypes: [ 0, 1, 0, 1 ]
58 ; CHECK-NEXT: - Type: ELEM
59 ; CHECK-NEXT: Segments:
60 ; CHECK-NEXT: - Offset:
61 ; CHECK-NEXT: Opcode: I32_CONST
62 ; CHECK-NEXT: Value: 1
63 ; CHECK-NEXT: Functions: [ 5, 7 ]
64 ; CHECK-NEXT: - Type: CODE
65 ; CHECK-NEXT: Relocations:
66 ; CHECK-NEXT: - Type: R_WASM_FUNCTION_INDEX_LEB
67 ; CHECK-NEXT: Index: 1
68 ; CHECK-NEXT: Offset: 0x00000004
69 ; CHECK-NEXT: - Type: R_WASM_TABLE_INDEX_SLEB
70 ; CHECK-NEXT: Index: 0
71 ; CHECK-NEXT: Offset: 0x0000000F
72 ; CHECK-NEXT: - Type: R_WASM_MEMORY_ADDR_SLEB
73 ; CHECK-NEXT: Index: 3
74 ; CHECK-NEXT: Offset: 0x00000017
75 ; CHECK-NEXT: - Type: R_WASM_FUNCTION_INDEX_LEB
76 ; CHECK-NEXT: Index: 4
77 ; CHECK-NEXT: Offset: 0x0000001D
78 ; CHECK-NEXT: - Type: R_WASM_FUNCTION_INDEX_LEB
79 ; CHECK-NEXT: Index: 6
80 ; CHECK-NEXT: Offset: 0x0000002C
81 ; CHECK-NEXT: - Type: R_WASM_TABLE_INDEX_SLEB
82 ; CHECK-NEXT: Index: 5
83 ; CHECK-NEXT: Offset: 0x00000037
84 ; CHECK-NEXT: - Type: R_WASM_MEMORY_ADDR_SLEB
85 ; CHECK-NEXT: Index: 3
86 ; CHECK-NEXT: Offset: 0x0000003F
87 ; CHECK-NEXT: - Type: R_WASM_FUNCTION_INDEX_LEB
88 ; CHECK-NEXT: Index: 4
89 ; CHECK-NEXT: Offset: 0x00000045
90 ; CHECK-NEXT: Functions:
91 ; CHECK-NEXT: - Index: 5
93 ; CHECK-NEXT: Body: 1080808080000B
94 ; CHECK-NEXT: - Index: 6
96 ; CHECK-NEXT: Body: 024041818080800041004180808080001081808080000D000F0B00000B
97 ; CHECK-NEXT: - Index: 7
99 ; CHECK-NEXT: Body: 1082808080000B
100 ; CHECK-NEXT: - Index: 8
101 ; CHECK-NEXT: Locals:
102 ; CHECK-NEXT: Body: 024041828080800041004180808080001081808080000D000F0B00000B
103 ; CHECK-NEXT: - Type: DATA
104 ; CHECK-NEXT: Segments:
105 ; CHECK-NEXT: - SectionOffset: 6
106 ; CHECK-NEXT: MemoryIndex: 0
107 ; CHECK-NEXT: Offset:
108 ; CHECK-NEXT: Opcode: I32_CONST
109 ; CHECK-NEXT: Value: 0
110 ; CHECK-NEXT: Content: '01040000'
111 ; CHECK-NEXT: - Type: CUSTOM
112 ; CHECK-NEXT: Name: linking
113 ; CHECK-NEXT: Version: 2
114 ; CHECK-NEXT: SymbolTable:
115 ; CHECK-NEXT: - Index: 0
116 ; CHECK-NEXT: Kind: FUNCTION
117 ; CHECK-NEXT: Name: .Lcall_dtors.42
118 ; CHECK-NEXT: Flags: [ BINDING_LOCAL ]
119 ; CHECK-NEXT: Function: 5
120 ; CHECK-NEXT: - Index: 1
121 ; CHECK-NEXT: Kind: FUNCTION
122 ; CHECK-NEXT: Name: func3
123 ; CHECK-NEXT: Flags: [ UNDEFINED ]
124 ; CHECK-NEXT: Function: 0
125 ; CHECK-NEXT: - Index: 2
126 ; CHECK-NEXT: Kind: FUNCTION
127 ; CHECK-NEXT: Name: .Lregister_call_dtors.42
128 ; CHECK-NEXT: Flags: [ BINDING_LOCAL ]
129 ; CHECK-NEXT: Function: 6
130 ; CHECK-NEXT: - Index: 3
131 ; CHECK-NEXT: Kind: DATA
132 ; CHECK-NEXT: Name: __dso_handle
133 ; CHECK-NEXT: Flags: [ BINDING_WEAK, VISIBILITY_HIDDEN, UNDEFINED ]
134 ; CHECK-NEXT: - Index: 4
135 ; CHECK-NEXT: Kind: FUNCTION
136 ; CHECK-NEXT: Name: __cxa_atexit
137 ; CHECK-NEXT: Flags: [ UNDEFINED ]
138 ; CHECK-NEXT: Function: 1
139 ; CHECK-NEXT: - Index: 5
140 ; CHECK-NEXT: Kind: FUNCTION
141 ; CHECK-NEXT: Name: .Lcall_dtors
142 ; CHECK-NEXT: Flags: [ BINDING_LOCAL ]
143 ; CHECK-NEXT: Function: 7
144 ; CHECK-NEXT: - Index: 6
145 ; CHECK-NEXT: Kind: FUNCTION
146 ; CHECK-NEXT: Name: func2
147 ; CHECK-NEXT: Flags: [ UNDEFINED ]
148 ; CHECK-NEXT: Function: 2
149 ; CHECK-NEXT: - Index: 7
150 ; CHECK-NEXT: Kind: FUNCTION
151 ; CHECK-NEXT: Name: .Lregister_call_dtors
152 ; CHECK-NEXT: Flags: [ BINDING_LOCAL ]
153 ; CHECK-NEXT: Function: 8
154 ; CHECK-NEXT: - Index: 8
155 ; CHECK-NEXT: Kind: DATA
156 ; CHECK-NEXT: Name: global1
157 ; CHECK-NEXT: Flags: [ ]
158 ; CHECK-NEXT: Segment: 0
159 ; CHECK-NEXT: Size: 4
160 ; CHECK-NEXT: - Index: 9
161 ; CHECK-NEXT: Kind: FUNCTION
162 ; CHECK-NEXT: Name: func1
163 ; CHECK-NEXT: Flags: [ UNDEFINED ]
164 ; CHECK-NEXT: Function: 3
165 ; CHECK-NEXT: - Index: 10
166 ; CHECK-NEXT: Kind: FUNCTION
167 ; CHECK-NEXT: Name: func0
168 ; CHECK-NEXT: Flags: [ UNDEFINED ]
169 ; CHECK-NEXT: Function: 4
170 ; CHECK-NEXT: SegmentInfo:
171 ; CHECK-NEXT: - Index: 0
172 ; CHECK-NEXT: Name: .data.global1
173 ; CHECK-NEXT: Alignment: 3
174 ; CHECK-NEXT: Flags: [ ]
175 ; CHECK-NEXT: InitFunctions:
176 ; CHECK-NEXT: - Priority: 42
177 ; CHECK-NEXT: Symbol: 9
178 ; CHECK-NEXT: - Priority: 42
179 ; CHECK-NEXT: Symbol: 2
180 ; CHECK-NEXT: - Priority: 65535
181 ; CHECK-NEXT: Symbol: 10
182 ; CHECK-NEXT: - Priority: 65535
183 ; CHECK-NEXT: Symbol: 7