[llvm-shlib] Fix the version naming style of libLLVM for Windows (#85710)
[llvm-project.git] / bolt / test / X86 / dwarf5-multiple-dw-op-addrx-locexpr.s
blob6429ccd86b32535f2f3ce32c7856c37f180507d5
1 # REQUIRES: system-linux
3 # RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %s -o %t1.o
4 # RUN: %clang %cflags -dwarf-5 %t1.o -o %t.exe -Wl,-q
5 # RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections
6 # RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.exe | FileCheck --check-prefix=PRECHECK %s
7 # RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.bolt | FileCheck --check-prefix=CHECK %s
9 # PRECHECK: DW_TAG_variable
10 # PRECHECK: DW_AT_name [DW_FORM_strx1]
11 # PRECHECK: DW_AT_type [DW_FORM_ref4]
12 # PRECHECK: DW_AT_decl_file [DW_FORM_data1]
13 # PRECHECK: DW_AT_decl_line [DW_FORM_data1]
14 # PRECHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addrx 0x0, DW_OP_piece 0x4, DW_OP_addrx 0x1, DW_OP_piece 0x4)
17 # CHECK: DW_TAG_variable
18 # CHECK: DW_AT_name [DW_FORM_strx1]
19 # CHECK: DW_AT_type [DW_FORM_ref4]
20 # CHECK: DW_AT_decl_file [DW_FORM_data1]
21 # CHECK: DW_AT_decl_line [DW_FORM_data1]
22 # CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addrx 0x2, DW_OP_piece 0x4, DW_OP_addrx 0x3, DW_OP_piece 0x4)
24 # This test checks that we update DW_AT_location [DW_FORM_exprloc] with multiple DW_OP_addrx.
26 # struct pair {int i; int j; };
27 # static pair p;
28 # int load() {
29 # return p.i + p.j;
30 # }
31 # void store(int i, int j) {
32 # p.i = i;
33 # p.j = j;
34 # }
35 # int main() {
36 # return 0;
37 # }
38 .text
39 .file "main.cpp"
40 .file 0 "task" "main.cpp" md5 0x02662c1bdb2472436fee6b36e4dca0e0
41 .globl _Z4loadv # -- Begin function _Z4loadv
42 .p2align 4, 0x90
43 .type _Z4loadv,@function
44 _Z4loadv: # @_Z4loadv
45 .Lfunc_begin0:
46 .loc 0 3 0 # main.cpp:3:0
47 .cfi_startproc
48 # %bb.0: # %entry
49 .loc 0 4 20 prologue_end # main.cpp:4:20
50 movl _ZL1p.1(%rip), %eax
51 .loc 0 4 16 is_stmt 0 # main.cpp:4:16
52 addl _ZL1p.0(%rip), %eax
53 .loc 0 4 5 # main.cpp:4:5
54 retq
55 .Ltmp0:
56 .Lfunc_end0:
57 .size _Z4loadv, .Lfunc_end0-_Z4loadv
58 .cfi_endproc
59 # -- End function
60 .globl _Z5storeii # -- Begin function _Z5storeii
61 .p2align 4, 0x90
62 .type _Z5storeii,@function
63 _Z5storeii: # @_Z5storeii
64 .Lfunc_begin1:
65 .loc 0 6 0 is_stmt 1 # main.cpp:6:0
66 .cfi_startproc
67 # %bb.0: # %entry
68 #DEBUG_VALUE: store:i <- $edi
69 #DEBUG_VALUE: store:j <- $esi
70 .loc 0 7 9 prologue_end # main.cpp:7:9
71 movl %edi, _ZL1p.0(%rip)
72 .loc 0 8 11 # main.cpp:8:11
73 movl %esi, _ZL1p.1(%rip)
74 .loc 0 9 1 # main.cpp:9:1
75 retq
76 .Ltmp1:
77 .Lfunc_end1:
78 .size _Z5storeii, .Lfunc_end1-_Z5storeii
79 .cfi_endproc
80 # -- End function
81 .globl main # -- Begin function main
82 .p2align 4, 0x90
83 .type main,@function
84 main: # @main
85 .Lfunc_begin2:
86 .loc 0 10 0 # main.cpp:10:0
87 .cfi_startproc
88 # %bb.0: # %entry
89 .loc 0 11 1 prologue_end # main.cpp:11:1
90 xorl %eax, %eax
91 retq
92 .Ltmp2:
93 .Lfunc_end2:
94 .size main, .Lfunc_end2-main
95 .cfi_endproc
96 # -- End function
97 .type _ZL1p.0,@object # @_ZL1p.0
98 .local _ZL1p.0
99 .comm _ZL1p.0,4,4
100 .type _ZL1p.1,@object # @_ZL1p.1
101 .local _ZL1p.1
102 .comm _ZL1p.1,4,4
103 .section .debug_abbrev,"",@progbits
104 .byte 1 # Abbreviation Code
105 .byte 17 # DW_TAG_compile_unit
106 .byte 1 # DW_CHILDREN_yes
107 .byte 37 # DW_AT_producer
108 .byte 37 # DW_FORM_strx1
109 .byte 19 # DW_AT_language
110 .byte 5 # DW_FORM_data2
111 .byte 3 # DW_AT_name
112 .byte 37 # DW_FORM_strx1
113 .byte 114 # DW_AT_str_offsets_base
114 .byte 23 # DW_FORM_sec_offset
115 .byte 16 # DW_AT_stmt_list
116 .byte 23 # DW_FORM_sec_offset
117 .byte 27 # DW_AT_comp_dir
118 .byte 37 # DW_FORM_strx1
119 .byte 17 # DW_AT_low_pc
120 .byte 27 # DW_FORM_addrx
121 .byte 18 # DW_AT_high_pc
122 .byte 6 # DW_FORM_data4
123 .byte 115 # DW_AT_addr_base
124 .byte 23 # DW_FORM_sec_offset
125 .byte 0 # EOM(1)
126 .byte 0 # EOM(2)
127 .byte 2 # Abbreviation Code
128 .byte 52 # DW_TAG_variable
129 .byte 0 # DW_CHILDREN_no
130 .byte 3 # DW_AT_name
131 .byte 37 # DW_FORM_strx1
132 .byte 73 # DW_AT_type
133 .byte 19 # DW_FORM_ref4
134 .byte 58 # DW_AT_decl_file
135 .byte 11 # DW_FORM_data1
136 .byte 59 # DW_AT_decl_line
137 .byte 11 # DW_FORM_data1
138 .byte 2 # DW_AT_location
139 .byte 24 # DW_FORM_exprloc
140 .byte 110 # DW_AT_linkage_name
141 .byte 37 # DW_FORM_strx1
142 .byte 0 # EOM(1)
143 .byte 0 # EOM(2)
144 .byte 3 # Abbreviation Code
145 .byte 19 # DW_TAG_structure_type
146 .byte 1 # DW_CHILDREN_yes
147 .byte 54 # DW_AT_calling_convention
148 .byte 11 # DW_FORM_data1
149 .byte 3 # DW_AT_name
150 .byte 37 # DW_FORM_strx1
151 .byte 11 # DW_AT_byte_size
152 .byte 11 # DW_FORM_data1
153 .byte 58 # DW_AT_decl_file
154 .byte 11 # DW_FORM_data1
155 .byte 59 # DW_AT_decl_line
156 .byte 11 # DW_FORM_data1
157 .byte 0 # EOM(1)
158 .byte 0 # EOM(2)
159 .byte 4 # Abbreviation Code
160 .byte 13 # DW_TAG_member
161 .byte 0 # DW_CHILDREN_no
162 .byte 3 # DW_AT_name
163 .byte 37 # DW_FORM_strx1
164 .byte 73 # DW_AT_type
165 .byte 19 # DW_FORM_ref4
166 .byte 58 # DW_AT_decl_file
167 .byte 11 # DW_FORM_data1
168 .byte 59 # DW_AT_decl_line
169 .byte 11 # DW_FORM_data1
170 .byte 56 # DW_AT_data_member_location
171 .byte 11 # DW_FORM_data1
172 .byte 0 # EOM(1)
173 .byte 0 # EOM(2)
174 .byte 5 # Abbreviation Code
175 .byte 36 # DW_TAG_base_type
176 .byte 0 # DW_CHILDREN_no
177 .byte 3 # DW_AT_name
178 .byte 37 # DW_FORM_strx1
179 .byte 62 # DW_AT_encoding
180 .byte 11 # DW_FORM_data1
181 .byte 11 # DW_AT_byte_size
182 .byte 11 # DW_FORM_data1
183 .byte 0 # EOM(1)
184 .byte 0 # EOM(2)
185 .byte 6 # Abbreviation Code
186 .byte 46 # DW_TAG_subprogram
187 .byte 0 # DW_CHILDREN_no
188 .byte 17 # DW_AT_low_pc
189 .byte 27 # DW_FORM_addrx
190 .byte 18 # DW_AT_high_pc
191 .byte 6 # DW_FORM_data4
192 .byte 64 # DW_AT_frame_base
193 .byte 24 # DW_FORM_exprloc
194 .byte 122 # DW_AT_call_all_calls
195 .byte 25 # DW_FORM_flag_present
196 .byte 110 # DW_AT_linkage_name
197 .byte 37 # DW_FORM_strx1
198 .byte 3 # DW_AT_name
199 .byte 37 # DW_FORM_strx1
200 .byte 58 # DW_AT_decl_file
201 .byte 11 # DW_FORM_data1
202 .byte 59 # DW_AT_decl_line
203 .byte 11 # DW_FORM_data1
204 .byte 73 # DW_AT_type
205 .byte 19 # DW_FORM_ref4
206 .byte 63 # DW_AT_external
207 .byte 25 # DW_FORM_flag_present
208 .byte 0 # EOM(1)
209 .byte 0 # EOM(2)
210 .byte 7 # Abbreviation Code
211 .byte 46 # DW_TAG_subprogram
212 .byte 1 # DW_CHILDREN_yes
213 .byte 17 # DW_AT_low_pc
214 .byte 27 # DW_FORM_addrx
215 .byte 18 # DW_AT_high_pc
216 .byte 6 # DW_FORM_data4
217 .byte 64 # DW_AT_frame_base
218 .byte 24 # DW_FORM_exprloc
219 .byte 122 # DW_AT_call_all_calls
220 .byte 25 # DW_FORM_flag_present
221 .byte 110 # DW_AT_linkage_name
222 .byte 37 # DW_FORM_strx1
223 .byte 3 # DW_AT_name
224 .byte 37 # DW_FORM_strx1
225 .byte 58 # DW_AT_decl_file
226 .byte 11 # DW_FORM_data1
227 .byte 59 # DW_AT_decl_line
228 .byte 11 # DW_FORM_data1
229 .byte 63 # DW_AT_external
230 .byte 25 # DW_FORM_flag_present
231 .byte 0 # EOM(1)
232 .byte 0 # EOM(2)
233 .byte 8 # Abbreviation Code
234 .byte 5 # DW_TAG_formal_parameter
235 .byte 0 # DW_CHILDREN_no
236 .byte 2 # DW_AT_location
237 .byte 24 # DW_FORM_exprloc
238 .byte 3 # DW_AT_name
239 .byte 37 # DW_FORM_strx1
240 .byte 58 # DW_AT_decl_file
241 .byte 11 # DW_FORM_data1
242 .byte 59 # DW_AT_decl_line
243 .byte 11 # DW_FORM_data1
244 .byte 73 # DW_AT_type
245 .byte 19 # DW_FORM_ref4
246 .byte 0 # EOM(1)
247 .byte 0 # EOM(2)
248 .byte 9 # Abbreviation Code
249 .byte 46 # DW_TAG_subprogram
250 .byte 0 # DW_CHILDREN_no
251 .byte 17 # DW_AT_low_pc
252 .byte 27 # DW_FORM_addrx
253 .byte 18 # DW_AT_high_pc
254 .byte 6 # DW_FORM_data4
255 .byte 64 # DW_AT_frame_base
256 .byte 24 # DW_FORM_exprloc
257 .byte 122 # DW_AT_call_all_calls
258 .byte 25 # DW_FORM_flag_present
259 .byte 3 # DW_AT_name
260 .byte 37 # DW_FORM_strx1
261 .byte 58 # DW_AT_decl_file
262 .byte 11 # DW_FORM_data1
263 .byte 59 # DW_AT_decl_line
264 .byte 11 # DW_FORM_data1
265 .byte 73 # DW_AT_type
266 .byte 19 # DW_FORM_ref4
267 .byte 63 # DW_AT_external
268 .byte 25 # DW_FORM_flag_present
269 .byte 0 # EOM(1)
270 .byte 0 # EOM(2)
271 .byte 0 # EOM(3)
272 .section .debug_info,"",@progbits
273 .Lcu_begin0:
274 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
275 .Ldebug_info_start0:
276 .short 5 # DWARF version number
277 .byte 1 # DWARF Unit Type
278 .byte 8 # Address Size (in bytes)
279 .long .debug_abbrev # Offset Into Abbrev. Section
280 .byte 1 # Abbrev [1] 0xc:0x87 DW_TAG_compile_unit
281 .byte 0 # DW_AT_producer
282 .short 33 # DW_AT_language
283 .byte 1 # DW_AT_name
284 .long .Lstr_offsets_base0 # DW_AT_str_offsets_base
285 .long .Lline_table_start0 # DW_AT_stmt_list
286 .byte 2 # DW_AT_comp_dir
287 .byte 2 # DW_AT_low_pc
288 .long .Lfunc_end2-.Lfunc_begin0 # DW_AT_high_pc
289 .long .Laddr_table_base0 # DW_AT_addr_base
290 .byte 2 # Abbrev [2] 0x23:0x12 DW_TAG_variable
291 .byte 3 # DW_AT_name
292 .long 53 # DW_AT_type
293 .byte 0 # DW_AT_decl_file
294 .byte 2 # DW_AT_decl_line
295 .byte 8 # DW_AT_location
296 .byte 161
297 .byte 0
298 .byte 147
299 .byte 4
300 .byte 161
301 .byte 1
302 .byte 147
303 .byte 4
304 .byte 8 # DW_AT_linkage_name
305 .byte 3 # Abbrev [3] 0x35:0x19 DW_TAG_structure_type
306 .byte 5 # DW_AT_calling_convention
307 .byte 7 # DW_AT_name
308 .byte 8 # DW_AT_byte_size
309 .byte 0 # DW_AT_decl_file
310 .byte 1 # DW_AT_decl_line
311 .byte 4 # Abbrev [4] 0x3b:0x9 DW_TAG_member
312 .byte 4 # DW_AT_name
313 .long 78 # DW_AT_type
314 .byte 0 # DW_AT_decl_file
315 .byte 1 # DW_AT_decl_line
316 .byte 0 # DW_AT_data_member_location
317 .byte 4 # Abbrev [4] 0x44:0x9 DW_TAG_member
318 .byte 6 # DW_AT_name
319 .long 78 # DW_AT_type
320 .byte 0 # DW_AT_decl_file
321 .byte 1 # DW_AT_decl_line
322 .byte 4 # DW_AT_data_member_location
323 .byte 0 # End Of Children Mark
324 .byte 5 # Abbrev [5] 0x4e:0x4 DW_TAG_base_type
325 .byte 5 # DW_AT_name
326 .byte 5 # DW_AT_encoding
327 .byte 4 # DW_AT_byte_size
328 .byte 6 # Abbrev [6] 0x52:0x10 DW_TAG_subprogram
329 .byte 2 # DW_AT_low_pc
330 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
331 .byte 1 # DW_AT_frame_base
332 .byte 87
333 # DW_AT_call_all_calls
334 .byte 9 # DW_AT_linkage_name
335 .byte 10 # DW_AT_name
336 .byte 0 # DW_AT_decl_file
337 .byte 3 # DW_AT_decl_line
338 .long 78 # DW_AT_type
339 # DW_AT_external
340 .byte 7 # Abbrev [7] 0x62:0x21 DW_TAG_subprogram
341 .byte 3 # DW_AT_low_pc
342 .long .Lfunc_end1-.Lfunc_begin1 # DW_AT_high_pc
343 .byte 1 # DW_AT_frame_base
344 .byte 87
345 # DW_AT_call_all_calls
346 .byte 11 # DW_AT_linkage_name
347 .byte 12 # DW_AT_name
348 .byte 0 # DW_AT_decl_file
349 .byte 6 # DW_AT_decl_line
350 # DW_AT_external
351 .byte 8 # Abbrev [8] 0x6e:0xa DW_TAG_formal_parameter
352 .byte 1 # DW_AT_location
353 .byte 85
354 .byte 4 # DW_AT_name
355 .byte 0 # DW_AT_decl_file
356 .byte 6 # DW_AT_decl_line
357 .long 78 # DW_AT_type
358 .byte 8 # Abbrev [8] 0x78:0xa DW_TAG_formal_parameter
359 .byte 1 # DW_AT_location
360 .byte 84
361 .byte 6 # DW_AT_name
362 .byte 0 # DW_AT_decl_file
363 .byte 6 # DW_AT_decl_line
364 .long 78 # DW_AT_type
365 .byte 0 # End Of Children Mark
366 .byte 9 # Abbrev [9] 0x83:0xf DW_TAG_subprogram
367 .byte 4 # DW_AT_low_pc
368 .long .Lfunc_end2-.Lfunc_begin2 # DW_AT_high_pc
369 .byte 1 # DW_AT_frame_base
370 .byte 87
371 # DW_AT_call_all_calls
372 .byte 13 # DW_AT_name
373 .byte 0 # DW_AT_decl_file
374 .byte 10 # DW_AT_decl_line
375 .long 78 # DW_AT_type
376 # DW_AT_external
377 .byte 0 # End Of Children Mark
378 .Ldebug_info_end0:
379 .section .debug_str_offsets,"",@progbits
380 .long 60 # Length of String Offsets Set
381 .short 5
382 .short 0
383 .Lstr_offsets_base0:
384 .section .debug_str,"MS",@progbits,1
385 .Linfo_string0:
386 .asciz "clang version 15.0.0" # string offset=0
387 .Linfo_string1:
388 .asciz "main.cpp" # string offset=134
389 .Linfo_string2:
390 .asciz "test" # string offset=143
391 .Linfo_string3:
392 .asciz "p" # string offset=181
393 .Linfo_string4:
394 .asciz "i" # string offset=183
395 .Linfo_string5:
396 .asciz "int" # string offset=185
397 .Linfo_string6:
398 .asciz "j" # string offset=189
399 .Linfo_string7:
400 .asciz "pair" # string offset=191
401 .Linfo_string8:
402 .asciz "_ZL1p" # string offset=196
403 .Linfo_string9:
404 .asciz "_Z4loadv" # string offset=202
405 .Linfo_string10:
406 .asciz "load" # string offset=211
407 .Linfo_string11:
408 .asciz "_Z5storeii" # string offset=216
409 .Linfo_string12:
410 .asciz "store" # string offset=227
411 .Linfo_string13:
412 .asciz "main" # string offset=233
413 .section .debug_str_offsets,"",@progbits
414 .long .Linfo_string0
415 .long .Linfo_string1
416 .long .Linfo_string2
417 .long .Linfo_string3
418 .long .Linfo_string4
419 .long .Linfo_string5
420 .long .Linfo_string6
421 .long .Linfo_string7
422 .long .Linfo_string8
423 .long .Linfo_string9
424 .long .Linfo_string10
425 .long .Linfo_string11
426 .long .Linfo_string12
427 .long .Linfo_string13
428 .section .debug_addr,"",@progbits
429 .long .Ldebug_addr_end0-.Ldebug_addr_start0 # Length of contribution
430 .Ldebug_addr_start0:
431 .short 5 # DWARF version number
432 .byte 8 # Address size
433 .byte 0 # Segment selector size
434 .Laddr_table_base0:
435 .quad _ZL1p.0
436 .quad _ZL1p.1
437 .quad .Lfunc_begin0
438 .quad .Lfunc_begin1
439 .quad .Lfunc_begin2
440 .Ldebug_addr_end0:
441 .ident "clang version 15.0.0"
442 .section ".note.GNU-stack","",@progbits
443 .addrsig
444 .section .debug_line,"",@progbits
445 .Lline_table_start0: