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: DATACOUNT
65 ; CHECK-NEXT: Count: 1
66 ; CHECK-NEXT: - Type: CODE
67 ; CHECK-NEXT: Relocations:
68 ; CHECK-NEXT: - Type: R_WASM_FUNCTION_INDEX_LEB
69 ; CHECK-NEXT: Index: 1
70 ; CHECK-NEXT: Offset: 0x00000004
71 ; CHECK-NEXT: - Type: R_WASM_TABLE_INDEX_SLEB
72 ; CHECK-NEXT: Index: 0
73 ; CHECK-NEXT: Offset: 0x0000000F
74 ; CHECK-NEXT: - Type: R_WASM_MEMORY_ADDR_SLEB
75 ; CHECK-NEXT: Index: 3
76 ; CHECK-NEXT: Offset: 0x00000017
77 ; CHECK-NEXT: - Type: R_WASM_FUNCTION_INDEX_LEB
78 ; CHECK-NEXT: Index: 4
79 ; CHECK-NEXT: Offset: 0x0000001D
80 ; CHECK-NEXT: - Type: R_WASM_FUNCTION_INDEX_LEB
81 ; CHECK-NEXT: Index: 6
82 ; CHECK-NEXT: Offset: 0x0000002C
83 ; CHECK-NEXT: - Type: R_WASM_TABLE_INDEX_SLEB
84 ; CHECK-NEXT: Index: 5
85 ; CHECK-NEXT: Offset: 0x00000037
86 ; CHECK-NEXT: - Type: R_WASM_MEMORY_ADDR_SLEB
87 ; CHECK-NEXT: Index: 3
88 ; CHECK-NEXT: Offset: 0x0000003F
89 ; CHECK-NEXT: - Type: R_WASM_FUNCTION_INDEX_LEB
90 ; CHECK-NEXT: Index: 4
91 ; CHECK-NEXT: Offset: 0x00000045
92 ; CHECK-NEXT: Functions:
93 ; CHECK-NEXT: - Index: 5
95 ; CHECK-NEXT: Body: 1080808080000B
96 ; CHECK-NEXT: - Index: 6
98 ; CHECK-NEXT: Body: 02404181808080004100418080808000108180808000450D0000000B0B
99 ; CHECK-NEXT: - Index: 7
100 ; CHECK-NEXT: Locals:
101 ; CHECK-NEXT: Body: 1082808080000B
102 ; CHECK-NEXT: - Index: 8
103 ; CHECK-NEXT: Locals:
104 ; CHECK-NEXT: Body: 02404182808080004100418080808000108180808000450D0000000B0B
105 ; CHECK-NEXT: - Type: DATA
106 ; CHECK-NEXT: Segments:
107 ; CHECK-NEXT: - SectionOffset: 6
108 ; CHECK-NEXT: InitFlags: 0
109 ; CHECK-NEXT: Offset:
110 ; CHECK-NEXT: Opcode: I32_CONST
111 ; CHECK-NEXT: Value: 0
112 ; CHECK-NEXT: Content: '01040000'
113 ; CHECK-NEXT: - Type: CUSTOM
114 ; CHECK-NEXT: Name: linking
115 ; CHECK-NEXT: Version: 2
116 ; CHECK-NEXT: SymbolTable:
117 ; CHECK-NEXT: - Index: 0
118 ; CHECK-NEXT: Kind: FUNCTION
119 ; CHECK-NEXT: Name: .Lcall_dtors.42
120 ; CHECK-NEXT: Flags: [ BINDING_LOCAL ]
121 ; CHECK-NEXT: Function: 5
122 ; CHECK-NEXT: - Index: 1
123 ; CHECK-NEXT: Kind: FUNCTION
124 ; CHECK-NEXT: Name: func3
125 ; CHECK-NEXT: Flags: [ UNDEFINED ]
126 ; CHECK-NEXT: Function: 0
127 ; CHECK-NEXT: - Index: 2
128 ; CHECK-NEXT: Kind: FUNCTION
129 ; CHECK-NEXT: Name: .Lregister_call_dtors.42
130 ; CHECK-NEXT: Flags: [ BINDING_LOCAL ]
131 ; CHECK-NEXT: Function: 6
132 ; CHECK-NEXT: - Index: 3
133 ; CHECK-NEXT: Kind: DATA
134 ; CHECK-NEXT: Name: __dso_handle
135 ; CHECK-NEXT: Flags: [ BINDING_WEAK, VISIBILITY_HIDDEN, UNDEFINED ]
136 ; CHECK-NEXT: - Index: 4
137 ; CHECK-NEXT: Kind: FUNCTION
138 ; CHECK-NEXT: Name: __cxa_atexit
139 ; CHECK-NEXT: Flags: [ UNDEFINED ]
140 ; CHECK-NEXT: Function: 1
141 ; CHECK-NEXT: - Index: 5
142 ; CHECK-NEXT: Kind: FUNCTION
143 ; CHECK-NEXT: Name: .Lcall_dtors
144 ; CHECK-NEXT: Flags: [ BINDING_LOCAL ]
145 ; CHECK-NEXT: Function: 7
146 ; CHECK-NEXT: - Index: 6
147 ; CHECK-NEXT: Kind: FUNCTION
148 ; CHECK-NEXT: Name: func2
149 ; CHECK-NEXT: Flags: [ UNDEFINED ]
150 ; CHECK-NEXT: Function: 2
151 ; CHECK-NEXT: - Index: 7
152 ; CHECK-NEXT: Kind: FUNCTION
153 ; CHECK-NEXT: Name: .Lregister_call_dtors
154 ; CHECK-NEXT: Flags: [ BINDING_LOCAL ]
155 ; CHECK-NEXT: Function: 8
156 ; CHECK-NEXT: - Index: 8
157 ; CHECK-NEXT: Kind: DATA
158 ; CHECK-NEXT: Name: global1
159 ; CHECK-NEXT: Flags: [ ]
160 ; CHECK-NEXT: Segment: 0
161 ; CHECK-NEXT: Size: 4
162 ; CHECK-NEXT: - Index: 9
163 ; CHECK-NEXT: Kind: FUNCTION
164 ; CHECK-NEXT: Name: func1
165 ; CHECK-NEXT: Flags: [ UNDEFINED ]
166 ; CHECK-NEXT: Function: 3
167 ; CHECK-NEXT: - Index: 10
168 ; CHECK-NEXT: Kind: FUNCTION
169 ; CHECK-NEXT: Name: func0
170 ; CHECK-NEXT: Flags: [ UNDEFINED ]
171 ; CHECK-NEXT: Function: 4
172 ; CHECK-NEXT: SegmentInfo:
173 ; CHECK-NEXT: - Index: 0
174 ; CHECK-NEXT: Name: .data.global1
175 ; CHECK-NEXT: Alignment: 3
176 ; CHECK-NEXT: Flags: [ ]
177 ; CHECK-NEXT: InitFunctions:
178 ; CHECK-NEXT: - Priority: 42
179 ; CHECK-NEXT: Symbol: 9
180 ; CHECK-NEXT: - Priority: 42
181 ; CHECK-NEXT: Symbol: 2
182 ; CHECK-NEXT: - Priority: 65535
183 ; CHECK-NEXT: Symbol: 10
184 ; CHECK-NEXT: - Priority: 65535
185 ; CHECK-NEXT: Symbol: 7