[AMDGPU][True16][CodeGen] true16 codegen pattern for v_med3_u/i16 (#121850)
[llvm-project.git] / llvm / test / MC / WebAssembly / reloc-pic64.s
blob4c5ec4f30666aae2f658a677d501c87495aa6b80
1 # RUN: llvm-mc -triple=wasm64-unknown-unknown -filetype=obj < %s | obj2yaml | FileCheck %s
2 # RUN: llvm-mc -triple=wasm64-unknown-unknown -mattr=+reference-types -filetype=obj < %s | obj2yaml | FileCheck --check-prefix=REF %s
4 # Verify that @GOT relocation entries result in R_WASM_GLOBAL_INDEX_LEB against
5 # against the corrsponding function or data symbol and that the corresponding
6 # data symbols are imported as a wasm globals.
8 .functype default_func () -> (i32)
10 .globaltype __memory_base, i64
11 .globaltype __table_base, i64
13 load_default_data:
14 .functype load_default_data () -> (i32)
15 global.get default_data@GOT
16 i32.load 0
17 end_function
19 load_default_func:
20 .functype load_default_func () -> (i32)
21 global.get default_func@GOT
22 i32.load 0
23 end_function
25 load_hidden_data:
26 .functype load_hidden_data () -> (i64)
27 global.get __memory_base
28 i64.const .L.hidden_data@MBREL
29 i64.add
30 end_function
32 load_hidden_func:
33 .functype load_hidden_func () -> (i64)
34 global.get __table_base
35 i64.const hidden_func@TBREL
36 i64.add
37 end_function
39 hidden_func:
40 .functype hidden_func () -> (i32)
41 i32.const 0
42 end_function
44 .section .rodata.hidden_data,"",@
45 .L.hidden_data:
46 .int8 100
47 .size .L.hidden_data, 1
49 #.hidden hidden_func
50 #.hidden hidden_data
51 .size default_data, 4
53 # CHECK: --- !WASM
54 # CHECK-NEXT: FileHeader:
55 # CHECK-NEXT: Version: 0x1
56 # CHECK-NEXT: Sections:
57 # CHECK-NEXT: - Type: TYPE
58 # CHECK-NEXT: Signatures:
59 # CHECK-NEXT: - Index: 0
60 # CHECK-NEXT: ParamTypes: []
61 # CHECK-NEXT: ReturnTypes:
62 # CHECK-NEXT: - I32
63 # CHECK-NEXT: - Index: 1
64 # CHECK-NEXT: ParamTypes: []
65 # CHECK-NEXT: ReturnTypes:
66 # CHECK-NEXT: - I64
67 # CHECK-NEXT: - Type: IMPORT
68 # CHECK-NEXT: Imports:
69 # CHECK-NEXT: - Module: env
70 # CHECK-NEXT: Field: __linear_memory
71 # CHECK-NEXT: Kind: MEMORY
72 # CHECK-NEXT: Memory:
73 # CHECK-NEXT: Flags: [ IS_64 ]
74 # CHECK-NEXT: Minimum: 0x1
75 # CHECK-NEXT: - Module: env
76 # CHECK-NEXT: Field: default_func
77 # CHECK-NEXT: Kind: FUNCTION
78 # CHECK-NEXT: SigIndex: 0
79 # CHECK-NEXT: - Module: env
80 # CHECK-NEXT: Field: __memory_base
81 # CHECK-NEXT: Kind: GLOBAL
82 # CHECK-NEXT: GlobalType: I64
83 # CHECK-NEXT: GlobalMutable: true
84 # CHECK-NEXT: - Module: env
85 # CHECK-NEXT: Field: __table_base
86 # CHECK-NEXT: Kind: GLOBAL
87 # CHECK-NEXT: GlobalType: I64
88 # CHECK-NEXT: GlobalMutable: true
89 # CHECK-NEXT: - Module: env
90 # CHECK-NEXT: Field: __indirect_function_table
91 # CHECK-NEXT: Kind: TABLE
92 # CHECK-NEXT: Table:
93 # CHECK-NEXT: Index: 0
94 # CHECK-NEXT: ElemType: FUNCREF
95 # CHECK-NEXT: Limits:
96 # CHECK-NEXT: Flags: [ IS_64 ]
97 # CHECK-NEXT: Minimum: 0x1
98 # CHECK-NEXT: - Module: GOT.mem
99 # CHECK-NEXT: Field: default_data
100 # CHECK-NEXT: Kind: GLOBAL
101 # CHECK-NEXT: GlobalType: I32
102 # CHECK-NEXT: GlobalMutable: true
103 # CHECK-NEXT: - Module: GOT.func
104 # CHECK-NEXT: Field: default_func
105 # CHECK-NEXT: Kind: GLOBAL
106 # CHECK-NEXT: GlobalType: I32
107 # CHECK-NEXT: GlobalMutable: true
108 # CHECK-NEXT: - Type: FUNCTION
109 # CHECK-NEXT: FunctionTypes: [ 0, 0, 1, 1, 0 ]
110 # CHECK-NEXT: - Type: ELEM
111 # CHECK-NEXT: Segments:
112 # CHECK-NEXT: Offset:
113 # CHECK-NEXT: Opcode: I64_CONST
114 # CHECK-NEXT: Value: 1
115 # CHECK-NEXT: Functions: [ 5 ]
116 # CHECK-NEXT: - Type: DATACOUNT
117 # CHECK-NEXT: Count: 1
118 # CHECK-NEXT: - Type: CODE
119 # CHECK-NEXT: Relocations:
120 # CHECK-NEXT: - Type: R_WASM_GLOBAL_INDEX_LEB
121 # CHECK-NEXT: Index: 1
122 # CHECK-NEXT: Offset: 0x4
123 # CHECK-NEXT: - Type: R_WASM_GLOBAL_INDEX_LEB
124 # CHECK-NEXT: Index: 3
125 # CHECK-NEXT: Offset: 0x10
126 # CHECK-NEXT: - Type: R_WASM_GLOBAL_INDEX_LEB
127 # CHECK-NEXT: Index: 5
128 # CHECK-NEXT: Offset: 0x1C
129 # CHECK-NEXT: - Type: R_WASM_MEMORY_ADDR_REL_SLEB64
130 # CHECK-NEXT: Index: 6
131 # CHECK-NEXT: Offset: 0x22
132 # CHECK-NEXT: - Type: R_WASM_GLOBAL_INDEX_LEB
133 # CHECK-NEXT: Index: 8
134 # CHECK-NEXT: Offset: 0x31
135 # CHECK-NEXT: - Type: R_WASM_TABLE_INDEX_REL_SLEB64
136 # CHECK-NEXT: Index: 9
137 # CHECK-NEXT: Offset: 0x37
138 # CHECK-NEXT: Functions:
139 # CHECK-NEXT: - Index: 1
140 # CHECK-NEXT: Locals: []
141 # CHECK-NEXT: Body: 2382808080002802000B
142 # CHECK-NEXT: - Index: 2
143 # CHECK-NEXT: Locals: []
144 # CHECK-NEXT: Body: 2383808080002802000B
145 # CHECK-NEXT: - Index: 3
146 # CHECK-NEXT: Locals: []
147 # CHECK-NEXT: Body: 23808080800042808080808080808080007C0B
148 # CHECK-NEXT: - Index: 4
149 # CHECK-NEXT: Locals: []
150 # CHECK-NEXT: Body: 23818080800042808080808080808080007C0B
151 # CHECK-NEXT: - Index: 5
152 # CHECK-NEXT: Locals: []
153 # CHECK-NEXT: Body: 41000B
154 # CHECK-NEXT: - Type: DATA
155 # CHECK-NEXT: Segments:
156 # CHECK-NEXT: - SectionOffset: 6
157 # CHECK-NEXT: InitFlags: 0
158 # CHECK-NEXT: Offset:
159 # CHECK-NEXT: Opcode: I64_CONST
160 # CHECK-NEXT: Value: 0
161 # CHECK-NEXT: Content: '64'
162 # CHECK-NEXT: - Type: CUSTOM
163 # CHECK-NEXT: Name: linking
164 # CHECK-NEXT: Version: 2
165 # CHECK-NEXT: SymbolTable:
166 # CHECK-NEXT: - Index: 0
167 # CHECK-NEXT: Kind: FUNCTION
168 # CHECK-NEXT: Name: load_default_data
169 # CHECK-NEXT: Flags: [ BINDING_LOCAL ]
170 # CHECK-NEXT: Function: 1
171 # CHECK-NEXT: - Index: 1
172 # CHECK-NEXT: Kind: DATA
173 # CHECK-NEXT: Name: default_data
174 # CHECK-NEXT: Flags: [ UNDEFINED ]
175 # CHECK-NEXT: - Index: 2
176 # CHECK-NEXT: Kind: FUNCTION
177 # CHECK-NEXT: Name: load_default_func
178 # CHECK-NEXT: Flags: [ BINDING_LOCAL ]
179 # CHECK-NEXT: Function: 2
180 # CHECK-NEXT: - Index: 3
181 # CHECK-NEXT: Kind: FUNCTION
182 # CHECK-NEXT: Name: default_func
183 # CHECK-NEXT: Flags: [ UNDEFINED ]
184 # CHECK-NEXT: Function: 0
185 # CHECK-NEXT: - Index: 4
186 # CHECK-NEXT: Kind: FUNCTION
187 # CHECK-NEXT: Name: load_hidden_data
188 # CHECK-NEXT: Flags: [ BINDING_LOCAL ]
189 # CHECK-NEXT: Function: 3
190 # CHECK-NEXT: - Index: 5
191 # CHECK-NEXT: Kind: GLOBAL
192 # CHECK-NEXT: Name: __memory_base
193 # CHECK-NEXT: Flags: [ UNDEFINED ]
194 # CHECK-NEXT: Global: 0
195 # CHECK-NEXT: - Index: 6
196 # CHECK-NEXT: Kind: DATA
197 # CHECK-NEXT: Name: .L.hidden_data
198 # CHECK-NEXT: Flags: [ BINDING_LOCAL ]
199 # CHECK-NEXT: Segment: 0
200 # CHECK-NEXT: Size: 1
201 # CHECK-NEXT: - Index: 7
202 # CHECK-NEXT: Kind: FUNCTION
203 # CHECK-NEXT: Name: load_hidden_func
204 # CHECK-NEXT: Flags: [ BINDING_LOCAL ]
205 # CHECK-NEXT: Function: 4
206 # CHECK-NEXT: - Index: 8
207 # CHECK-NEXT: Kind: GLOBAL
208 # CHECK-NEXT: Name: __table_base
209 # CHECK-NEXT: Flags: [ UNDEFINED ]
210 # CHECK-NEXT: Global: 1
211 # CHECK-NEXT: - Index: 9
212 # CHECK-NEXT: Kind: FUNCTION
213 # CHECK-NEXT: Name: hidden_func
214 # CHECK-NEXT: Flags: [ BINDING_LOCAL ]
215 # CHECK-NEXT: Function: 5
216 # REF: - Index: 10
217 # REF-NEXT: Kind: TABLE
218 # REF-NEXT: Name: __indirect_function_table
219 # REF-NEXT: Flags: [ UNDEFINED, NO_STRIP ]
220 # REF-NEXT: Table: 0
221 # CHECK-NEXT: SegmentInfo:
222 # CHECK-NEXT: - Index: 0
223 # CHECK-NEXT: Name: .rodata.hidden_data
224 # CHECK-NEXT: Alignment: 0
225 # CHECK-NEXT: Flags: [ ]
226 # CHECK-NEXT: ...