[llvm-shlib] Fix the version naming style of libLLVM for Windows (#85710)
[llvm-project.git] / bolt / test / X86 / dwarf5-locexpr-addrx.s
blob1e8183b7527dfafce91b94bb04b63d9276483281
1 # REQUIRES: system-linux
3 # RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %s -o %tmain.o
4 # RUN: %clang %cflags -dwarf-5 %tmain.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=POSTCHECK %s
9 # This test checks that we correctly encode new index into .debug_addr section
10 # from DW_AT_location [DW_FORM_exprloc] (DW_OP_addrx 0x#)
12 # PRECHECK: version = 0x0005
13 # PRECHECK: DW_TAG_variable
14 # PRECHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addrx 0x0)
15 # PRECHECK: DW_TAG_variable
16 # PRECHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addrx 0x1)
17 # PRECHECK-EMPTY:
19 # POSTCHECK: version = 0x0005
20 # POSTCHECK: DW_TAG_variable
21 # POSTCHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addrx 0x2)
22 # POSTCHECK-EMPTY:
23 # POSTCHECK: DW_TAG_variable
24 # POSTCHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addrx 0x3)
25 # POSTCHECK-EMPTY:
27 # clang++ main.cpp -g -O2
28 # void use(int * x, int * y) {
29 # *x += 4;
30 # *y -= 2;
31 # }
33 # int x = 0;
34 # int y = 1;
35 # int main(int argc, char *argv[]) {
36 # x = argc;
37 # y = argc + 3;
38 # use(&x, &y);
39 # return x + y;
40 # }
42 .text
43 .file "main.cpp"
44 .file 0 "/testLocExprLoc" "main.cpp" md5 0xd4fd79ce0087c4cefd089752bf2182c6
45 .globl _Z3usePiS_ # -- Begin function _Z3usePiS_
46 .p2align 4, 0x90
47 .type _Z3usePiS_,@function
48 _Z3usePiS_: # @_Z3usePiS_
49 .Lfunc_begin0:
50 .loc 0 1 0 # main.cpp:1:0
51 .cfi_startproc
52 # %bb.0: # %entry
53 #DEBUG_VALUE: use:x <- $rdi
54 #DEBUG_VALUE: use:y <- $rsi
55 .loc 0 2 4 prologue_end # main.cpp:2:4
56 addl $4, (%rdi)
57 .loc 0 3 4 # main.cpp:3:4
58 addl $-2, (%rsi)
59 .loc 0 4 1 # main.cpp:4:1
60 retq
61 .Ltmp0:
62 .Lfunc_end0:
63 .size _Z3usePiS_, .Lfunc_end0-_Z3usePiS_
64 .cfi_endproc
65 # -- End function
66 .globl main # -- Begin function main
67 .p2align 4, 0x90
68 .type main,@function
69 main: # @main
70 .Lfunc_begin1:
71 .loc 0 8 0 # main.cpp:8:0
72 .cfi_startproc
73 # %bb.0: # %entry
74 #DEBUG_VALUE: main:argc <- $edi
75 #DEBUG_VALUE: main:argv <- $rsi
76 # kill: def $edi killed $edi def $rdi
77 .loc 0 2 4 prologue_end # main.cpp:2:4
78 leal 4(%rdi), %eax
79 movl %eax, x(%rip)
80 .Ltmp1:
81 #DEBUG_VALUE: use:x <- undef
82 .loc 0 3 4 # main.cpp:3:4
83 leal 1(%rdi), %eax
84 movl %eax, y(%rip)
85 .Ltmp2:
86 #DEBUG_VALUE: use:y <- undef
87 .loc 0 12 13 # main.cpp:12:13
88 leal (%rdi,%rdi), %eax
89 addl $5, %eax
90 .loc 0 12 4 is_stmt 0 # main.cpp:12:4
91 retq
92 .Ltmp3:
93 .Lfunc_end1:
94 .size main, .Lfunc_end1-main
95 .cfi_endproc
96 # -- End function
97 .type x,@object # @x
98 .bss
99 .globl x
100 .p2align 2
102 .long 0 # 0x0
103 .size x, 4
105 .type y,@object # @y
106 .data
107 .globl y
108 .p2align 2
110 .long 1 # 0x1
111 .size y, 4
113 .section .debug_abbrev,"",@progbits
114 .byte 1 # Abbreviation Code
115 .byte 17 # DW_TAG_compile_unit
116 .byte 1 # DW_CHILDREN_yes
117 .byte 37 # DW_AT_producer
118 .byte 37 # DW_FORM_strx1
119 .byte 19 # DW_AT_language
120 .byte 5 # DW_FORM_data2
121 .byte 3 # DW_AT_name
122 .byte 37 # DW_FORM_strx1
123 .byte 114 # DW_AT_str_offsets_base
124 .byte 23 # DW_FORM_sec_offset
125 .byte 16 # DW_AT_stmt_list
126 .byte 23 # DW_FORM_sec_offset
127 .byte 27 # DW_AT_comp_dir
128 .byte 37 # DW_FORM_strx1
129 .byte 17 # DW_AT_low_pc
130 .byte 27 # DW_FORM_addrx
131 .byte 18 # DW_AT_high_pc
132 .byte 6 # DW_FORM_data4
133 .byte 115 # DW_AT_addr_base
134 .byte 23 # DW_FORM_sec_offset
135 .byte 0 # EOM(1)
136 .byte 0 # EOM(2)
137 .byte 2 # Abbreviation Code
138 .byte 52 # DW_TAG_variable
139 .byte 0 # DW_CHILDREN_no
140 .byte 3 # DW_AT_name
141 .byte 37 # DW_FORM_strx1
142 .byte 73 # DW_AT_type
143 .byte 19 # DW_FORM_ref4
144 .byte 63 # DW_AT_external
145 .byte 25 # DW_FORM_flag_present
146 .byte 58 # DW_AT_decl_file
147 .byte 11 # DW_FORM_data1
148 .byte 59 # DW_AT_decl_line
149 .byte 11 # DW_FORM_data1
150 .byte 2 # DW_AT_location
151 .byte 24 # DW_FORM_exprloc
152 .byte 0 # EOM(1)
153 .byte 0 # EOM(2)
154 .byte 3 # Abbreviation Code
155 .byte 36 # DW_TAG_base_type
156 .byte 0 # DW_CHILDREN_no
157 .byte 3 # DW_AT_name
158 .byte 37 # DW_FORM_strx1
159 .byte 62 # DW_AT_encoding
160 .byte 11 # DW_FORM_data1
161 .byte 11 # DW_AT_byte_size
162 .byte 11 # DW_FORM_data1
163 .byte 0 # EOM(1)
164 .byte 0 # EOM(2)
165 .byte 4 # Abbreviation Code
166 .byte 46 # DW_TAG_subprogram
167 .byte 1 # DW_CHILDREN_yes
168 .byte 17 # DW_AT_low_pc
169 .byte 27 # DW_FORM_addrx
170 .byte 18 # DW_AT_high_pc
171 .byte 6 # DW_FORM_data4
172 .byte 64 # DW_AT_frame_base
173 .byte 24 # DW_FORM_exprloc
174 .byte 122 # DW_AT_call_all_calls
175 .byte 25 # DW_FORM_flag_present
176 .byte 49 # DW_AT_abstract_origin
177 .byte 19 # DW_FORM_ref4
178 .byte 0 # EOM(1)
179 .byte 0 # EOM(2)
180 .byte 5 # Abbreviation Code
181 .byte 5 # DW_TAG_formal_parameter
182 .byte 0 # DW_CHILDREN_no
183 .byte 2 # DW_AT_location
184 .byte 24 # DW_FORM_exprloc
185 .byte 49 # DW_AT_abstract_origin
186 .byte 19 # DW_FORM_ref4
187 .byte 0 # EOM(1)
188 .byte 0 # EOM(2)
189 .byte 6 # Abbreviation Code
190 .byte 46 # DW_TAG_subprogram
191 .byte 1 # DW_CHILDREN_yes
192 .byte 110 # DW_AT_linkage_name
193 .byte 37 # DW_FORM_strx1
194 .byte 3 # DW_AT_name
195 .byte 37 # DW_FORM_strx1
196 .byte 58 # DW_AT_decl_file
197 .byte 11 # DW_FORM_data1
198 .byte 59 # DW_AT_decl_line
199 .byte 11 # DW_FORM_data1
200 .byte 63 # DW_AT_external
201 .byte 25 # DW_FORM_flag_present
202 .byte 32 # DW_AT_inline
203 .byte 33 # DW_FORM_implicit_const
204 .byte 1
205 .byte 0 # EOM(1)
206 .byte 0 # EOM(2)
207 .byte 7 # Abbreviation Code
208 .byte 5 # DW_TAG_formal_parameter
209 .byte 0 # DW_CHILDREN_no
210 .byte 3 # DW_AT_name
211 .byte 37 # DW_FORM_strx1
212 .byte 58 # DW_AT_decl_file
213 .byte 11 # DW_FORM_data1
214 .byte 59 # DW_AT_decl_line
215 .byte 11 # DW_FORM_data1
216 .byte 73 # DW_AT_type
217 .byte 19 # DW_FORM_ref4
218 .byte 0 # EOM(1)
219 .byte 0 # EOM(2)
220 .byte 8 # Abbreviation Code
221 .byte 15 # DW_TAG_pointer_type
222 .byte 0 # DW_CHILDREN_no
223 .byte 73 # DW_AT_type
224 .byte 19 # DW_FORM_ref4
225 .byte 0 # EOM(1)
226 .byte 0 # EOM(2)
227 .byte 9 # Abbreviation Code
228 .byte 46 # DW_TAG_subprogram
229 .byte 1 # DW_CHILDREN_yes
230 .byte 17 # DW_AT_low_pc
231 .byte 27 # DW_FORM_addrx
232 .byte 18 # DW_AT_high_pc
233 .byte 6 # DW_FORM_data4
234 .byte 64 # DW_AT_frame_base
235 .byte 24 # DW_FORM_exprloc
236 .byte 122 # DW_AT_call_all_calls
237 .byte 25 # DW_FORM_flag_present
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 63 # DW_AT_external
247 .byte 25 # DW_FORM_flag_present
248 .byte 0 # EOM(1)
249 .byte 0 # EOM(2)
250 .byte 10 # Abbreviation Code
251 .byte 5 # DW_TAG_formal_parameter
252 .byte 0 # DW_CHILDREN_no
253 .byte 2 # DW_AT_location
254 .byte 24 # DW_FORM_exprloc
255 .byte 3 # DW_AT_name
256 .byte 37 # DW_FORM_strx1
257 .byte 58 # DW_AT_decl_file
258 .byte 11 # DW_FORM_data1
259 .byte 59 # DW_AT_decl_line
260 .byte 11 # DW_FORM_data1
261 .byte 73 # DW_AT_type
262 .byte 19 # DW_FORM_ref4
263 .byte 0 # EOM(1)
264 .byte 0 # EOM(2)
265 .byte 11 # Abbreviation Code
266 .byte 29 # DW_TAG_inlined_subroutine
267 .byte 0 # DW_CHILDREN_no
268 .byte 49 # DW_AT_abstract_origin
269 .byte 19 # DW_FORM_ref4
270 .byte 17 # DW_AT_low_pc
271 .byte 27 # DW_FORM_addrx
272 .byte 18 # DW_AT_high_pc
273 .byte 6 # DW_FORM_data4
274 .byte 88 # DW_AT_call_file
275 .byte 11 # DW_FORM_data1
276 .byte 89 # DW_AT_call_line
277 .byte 11 # DW_FORM_data1
278 .byte 87 # DW_AT_call_column
279 .byte 11 # DW_FORM_data1
280 .byte 0 # EOM(1)
281 .byte 0 # EOM(2)
282 .byte 0 # EOM(3)
283 .section .debug_info,"",@progbits
284 .Lcu_begin0:
285 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
286 .Ldebug_info_start0:
287 .short 5 # DWARF version number
288 .byte 1 # DWARF Unit Type
289 .byte 8 # Address Size (in bytes)
290 .long .debug_abbrev # Offset Into Abbrev. Section
291 .byte 1 # Abbrev [1] 0xc:0xa7 DW_TAG_compile_unit
292 .byte 0 # DW_AT_producer
293 .short 33 # DW_AT_language
294 .byte 1 # DW_AT_name
295 .long .Lstr_offsets_base0 # DW_AT_str_offsets_base
296 .long .Lline_table_start0 # DW_AT_stmt_list
297 .byte 2 # DW_AT_comp_dir
298 .byte 2 # DW_AT_low_pc
299 .long .Lfunc_end1-.Lfunc_begin0 # DW_AT_high_pc
300 .long .Laddr_table_base0 # DW_AT_addr_base
301 .byte 2 # Abbrev [2] 0x23:0xb DW_TAG_variable
302 .byte 3 # DW_AT_name
303 .long 46 # DW_AT_type
304 # DW_AT_external
305 .byte 0 # DW_AT_decl_file
306 .byte 6 # DW_AT_decl_line
307 .byte 2 # DW_AT_location
308 .byte 161
309 .byte 0
310 .byte 3 # Abbrev [3] 0x2e:0x4 DW_TAG_base_type
311 .byte 4 # DW_AT_name
312 .byte 5 # DW_AT_encoding
313 .byte 4 # DW_AT_byte_size
314 .byte 2 # Abbrev [2] 0x32:0xb DW_TAG_variable
315 .byte 5 # DW_AT_name
316 .long 46 # DW_AT_type
317 # DW_AT_external
318 .byte 0 # DW_AT_decl_file
319 .byte 7 # DW_AT_decl_line
320 .byte 2 # DW_AT_location
321 .byte 161
322 .byte 1
323 .byte 4 # Abbrev [4] 0x3d:0x1b DW_TAG_subprogram
324 .byte 2 # DW_AT_low_pc
325 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
326 .byte 1 # DW_AT_frame_base
327 .byte 87
328 # DW_AT_call_all_calls
329 .long 88 # DW_AT_abstract_origin
330 .byte 5 # Abbrev [5] 0x49:0x7 DW_TAG_formal_parameter
331 .byte 1 # DW_AT_location
332 .byte 85
333 .long 93 # DW_AT_abstract_origin
334 .byte 5 # Abbrev [5] 0x50:0x7 DW_TAG_formal_parameter
335 .byte 1 # DW_AT_location
336 .byte 84
337 .long 101 # DW_AT_abstract_origin
338 .byte 0 # End Of Children Mark
339 .byte 6 # Abbrev [6] 0x58:0x16 DW_TAG_subprogram
340 .byte 6 # DW_AT_linkage_name
341 .byte 7 # DW_AT_name
342 .byte 0 # DW_AT_decl_file
343 .byte 1 # DW_AT_decl_line
344 # DW_AT_external
345 # DW_AT_inline
346 .byte 7 # Abbrev [7] 0x5d:0x8 DW_TAG_formal_parameter
347 .byte 3 # DW_AT_name
348 .byte 0 # DW_AT_decl_file
349 .byte 1 # DW_AT_decl_line
350 .long 110 # DW_AT_type
351 .byte 7 # Abbrev [7] 0x65:0x8 DW_TAG_formal_parameter
352 .byte 5 # DW_AT_name
353 .byte 0 # DW_AT_decl_file
354 .byte 1 # DW_AT_decl_line
355 .long 110 # DW_AT_type
356 .byte 0 # End Of Children Mark
357 .byte 8 # Abbrev [8] 0x6e:0x5 DW_TAG_pointer_type
358 .long 46 # DW_AT_type
359 .byte 9 # Abbrev [9] 0x73:0x31 DW_TAG_subprogram
360 .byte 3 # DW_AT_low_pc
361 .long .Lfunc_end1-.Lfunc_begin1 # DW_AT_high_pc
362 .byte 1 # DW_AT_frame_base
363 .byte 87
364 # DW_AT_call_all_calls
365 .byte 8 # DW_AT_name
366 .byte 0 # DW_AT_decl_file
367 .byte 8 # DW_AT_decl_line
368 .long 46 # DW_AT_type
369 # DW_AT_external
370 .byte 10 # Abbrev [10] 0x82:0xa DW_TAG_formal_parameter
371 .byte 1 # DW_AT_location
372 .byte 85
373 .byte 9 # DW_AT_name
374 .byte 0 # DW_AT_decl_file
375 .byte 8 # DW_AT_decl_line
376 .long 46 # DW_AT_type
377 .byte 10 # Abbrev [10] 0x8c:0xa DW_TAG_formal_parameter
378 .byte 1 # DW_AT_location
379 .byte 84
380 .byte 10 # DW_AT_name
381 .byte 0 # DW_AT_decl_file
382 .byte 8 # DW_AT_decl_line
383 .long 164 # DW_AT_type
384 .byte 11 # Abbrev [11] 0x96:0xd DW_TAG_inlined_subroutine
385 .long 88 # DW_AT_abstract_origin
386 .byte 3 # DW_AT_low_pc
387 .long .Ltmp2-.Lfunc_begin1 # DW_AT_high_pc
388 .byte 0 # DW_AT_call_file
389 .byte 11 # DW_AT_call_line
390 .byte 4 # DW_AT_call_column
391 .byte 0 # End Of Children Mark
392 .byte 8 # Abbrev [8] 0xa4:0x5 DW_TAG_pointer_type
393 .long 169 # DW_AT_type
394 .byte 8 # Abbrev [8] 0xa9:0x5 DW_TAG_pointer_type
395 .long 174 # DW_AT_type
396 .byte 3 # Abbrev [3] 0xae:0x4 DW_TAG_base_type
397 .byte 11 # DW_AT_name
398 .byte 6 # DW_AT_encoding
399 .byte 1 # DW_AT_byte_size
400 .byte 0 # End Of Children Mark
401 .Ldebug_info_end0:
402 .section .debug_str_offsets,"",@progbits
403 .long 52 # Length of String Offsets Set
404 .short 5
405 .short 0
406 .Lstr_offsets_base0:
407 .section .debug_str,"MS",@progbits,1
408 .Linfo_string0:
409 .asciz "clang version 15.0.0" # string offset=0
410 .Linfo_string1:
411 .asciz "main.cpp" # string offset=134
412 .Linfo_string2:
413 .asciz "/testLocExprLoc" # string offset=143
414 .Linfo_string3:
415 .asciz "x" # string offset=195
416 .Linfo_string4:
417 .asciz "int" # string offset=197
418 .Linfo_string5:
419 .asciz "y" # string offset=201
420 .Linfo_string6:
421 .asciz "_Z3usePiS_" # string offset=203
422 .Linfo_string7:
423 .asciz "use" # string offset=214
424 .Linfo_string8:
425 .asciz "main" # string offset=218
426 .Linfo_string9:
427 .asciz "argc" # string offset=223
428 .Linfo_string10:
429 .asciz "argv" # string offset=228
430 .Linfo_string11:
431 .asciz "char" # string offset=233
432 .section .debug_str_offsets,"",@progbits
433 .long .Linfo_string0
434 .long .Linfo_string1
435 .long .Linfo_string2
436 .long .Linfo_string3
437 .long .Linfo_string4
438 .long .Linfo_string5
439 .long .Linfo_string6
440 .long .Linfo_string7
441 .long .Linfo_string8
442 .long .Linfo_string9
443 .long .Linfo_string10
444 .long .Linfo_string11
445 .section .debug_addr,"",@progbits
446 .long .Ldebug_addr_end0-.Ldebug_addr_start0 # Length of contribution
447 .Ldebug_addr_start0:
448 .short 5 # DWARF version number
449 .byte 8 # Address size
450 .byte 0 # Segment selector size
451 .Laddr_table_base0:
452 .quad x
453 .quad y
454 .quad .Lfunc_begin0
455 .quad .Lfunc_begin1
456 .Ldebug_addr_end0:
457 .ident "clang version 15.0.0"
458 .section ".note.GNU-stack","",@progbits
459 .addrsig
460 .section .debug_line,"",@progbits
461 .Lline_table_start0: