[llvm-shlib] Fix the version naming style of libLLVM for Windows (#85710)
[llvm-project.git] / bolt / test / X86 / dwarf3-lowpc-highpc-convert.s
blobfaa4dc418f3b118028f3ae00d79c98c950ad99f4
1 # REQUIRES: system-linux
3 # RUN: llvm-mc -dwarf-version=3 -filetype=obj -triple x86_64-unknown-linux %s -o %t1.o
4 # RUN: %clang %cflags -dwarf-3 %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-ranges %t.bolt > %t.txt
8 # RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.bolt >> %t.txt
9 # RUN: cat %t.txt | FileCheck --check-prefix=POSTCHECK %s
11 # This tests checks that DW_AT_high_pc[DW_FORM_ADDR] can be converted to DW_AT_ranges correctly in Dwarf3
13 # PRECHECK: version = 0x0003
14 # PRECHECK: DW_AT_low_pc
15 # PRECHECK-SAME: DW_FORM_addr
16 # PRECHECK-SAME: 0x[[#%.16x,ADDR_LOW:]]
17 # PRECHECK-NEXT: DW_AT_high_pc [DW_FORM_addr] (0x[[#ADDR_LOW + 41]])
19 # POSTCHECK: [[#%.8x,OFFSET:]] [[#%.16x, ADDR_1_BEGIN:]]
20 # POSTCHECK-SAME: [[#%.16x, ADDR_1_END:]]
21 # POSTCHECK-NEXT: [[#OFFSET]]
22 # POSTCHECK-SAME: [[#%.16x, ADDR_2_BEGIN:]]
23 # POSTCHECK-SAME: [[#%.16x, ADDR_2_END:]]
24 # POSTCHECK: version = 0x0003
25 # POSTCHECK: DW_AT_low_pc
26 # POSTCHECK-SAME: DW_FORM_addr
27 # POSTCHECK-SAME: (0x0000000000000000)
28 # POSTCHECK-NEXT: DW_AT_ranges
29 # POSTCHECK-SAME: DW_FORM_data4
30 # POSTCHECK-SAME: (0x[[#OFFSET]]
31 # POSTCHECK-NEXT: [0x[[#ADDR_1_BEGIN]]
32 # POSTCHECK-SAME: 0x[[#ADDR_1_END]]
33 # POSTCHECK-NEXT: [0x[[#ADDR_2_BEGIN]]
34 # POSTCHECK-SAME: 0x[[#ADDR_2_END]]
37 # clang++ -g -gdwarf-3 -emit-llvm -S -O2 main.cpp
39 # void use(int * x, int * y) {
40 # *x += 4;
41 # *y -= 2;
42 # }
44 # int x = 0;
45 # int y = 1;
46 # int main(int argc, char *argv[]) {
47 # x = argc;
48 # y = argc + 3;
49 # use(&x, &y);
50 # return x+y;
51 # }
53 .text
54 .file "main.cpp"
55 .file 1 "/home/test" "main.cpp"
56 .globl _Z3usePiS_ # -- Begin function _Z3usePiS_
57 .p2align 4, 0x90
58 .type _Z3usePiS_,@function
59 _Z3usePiS_: # @_Z3usePiS_
60 .Lfunc_begin0:
61 .loc 1 1 0 # main.cpp:1:0
62 .cfi_startproc
63 # %bb.0: # %entry
64 #DEBUG_VALUE: use:x <- $rdi
65 #DEBUG_VALUE: use:y <- $rsi
66 .loc 1 2 4 prologue_end # main.cpp:2:4
67 addl $4, (%rdi)
68 .loc 1 3 4 # main.cpp:3:4
69 addl $-2, (%rsi)
70 .loc 1 4 1 # main.cpp:4:1
71 retq
72 .Ltmp0:
73 .Lfunc_end0:
74 .size _Z3usePiS_, .Lfunc_end0-_Z3usePiS_
75 .cfi_endproc
76 # -- End function
77 .globl main # -- Begin function main
78 .p2align 4, 0x90
79 .type main,@function
80 main: # @main
81 .Lfunc_begin1:
82 .loc 1 8 0 # main.cpp:8:0
83 .cfi_startproc
84 # %bb.0: # %entry
85 #DEBUG_VALUE: main:argc <- $edi
86 #DEBUG_VALUE: main:argv <- $rsi
87 # kill: def $edi killed $edi def $rdi
88 .loc 1 2 4 prologue_end # main.cpp:2:4
89 leal 4(%rdi), %eax
90 movl %eax, x(%rip)
91 .Ltmp1:
92 #DEBUG_VALUE: use:x <- undef
93 .loc 1 3 4 # main.cpp:3:4
94 leal 1(%rdi), %eax
95 movl %eax, y(%rip)
96 .Ltmp2:
97 #DEBUG_VALUE: use:y <- undef
98 .loc 1 12 13 # main.cpp:12:13
99 leal (%rdi,%rdi), %eax
100 addl $5, %eax
101 .loc 1 12 5 is_stmt 0 # main.cpp:12:5
102 retq
103 .Ltmp3:
104 .Lfunc_end1:
105 .size main, .Lfunc_end1-main
106 .cfi_endproc
107 # -- End function
108 .type x,@object # @x
109 .bss
110 .globl x
111 .p2align 2
113 .long 0 # 0x0
114 .size x, 4
116 .type y,@object # @y
117 .data
118 .globl y
119 .p2align 2
121 .long 1 # 0x1
122 .size y, 4
124 .section .debug_abbrev,"",@progbits
125 .byte 1 # Abbreviation Code
126 .byte 17 # DW_TAG_compile_unit
127 .byte 1 # DW_CHILDREN_yes
128 .byte 37 # DW_AT_producer
129 .byte 14 # DW_FORM_strp
130 .byte 19 # DW_AT_language
131 .byte 5 # DW_FORM_data2
132 .byte 3 # DW_AT_name
133 .byte 14 # DW_FORM_strp
134 .byte 16 # DW_AT_stmt_list
135 .byte 6 # DW_FORM_data4
136 .byte 27 # DW_AT_comp_dir
137 .byte 14 # DW_FORM_strp
138 .byte 17 # DW_AT_low_pc
139 .byte 1 # DW_FORM_addr
140 .byte 18 # DW_AT_high_pc
141 .byte 1 # DW_FORM_addr
142 .byte 0 # EOM(1)
143 .byte 0 # EOM(2)
144 .byte 2 # Abbreviation Code
145 .byte 52 # DW_TAG_variable
146 .byte 0 # DW_CHILDREN_no
147 .byte 3 # DW_AT_name
148 .byte 14 # DW_FORM_strp
149 .byte 73 # DW_AT_type
150 .byte 19 # DW_FORM_ref4
151 .byte 63 # DW_AT_external
152 .byte 12 # DW_FORM_flag
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 2 # DW_AT_location
158 .byte 10 # DW_FORM_block1
159 .byte 0 # EOM(1)
160 .byte 0 # EOM(2)
161 .byte 3 # Abbreviation Code
162 .byte 36 # DW_TAG_base_type
163 .byte 0 # DW_CHILDREN_no
164 .byte 3 # DW_AT_name
165 .byte 14 # DW_FORM_strp
166 .byte 62 # DW_AT_encoding
167 .byte 11 # DW_FORM_data1
168 .byte 11 # DW_AT_byte_size
169 .byte 11 # DW_FORM_data1
170 .byte 0 # EOM(1)
171 .byte 0 # EOM(2)
172 .byte 4 # Abbreviation Code
173 .byte 46 # DW_TAG_subprogram
174 .byte 1 # DW_CHILDREN_yes
175 .byte 17 # DW_AT_low_pc
176 .byte 1 # DW_FORM_addr
177 .byte 18 # DW_AT_high_pc
178 .byte 1 # DW_FORM_addr
179 .byte 64 # DW_AT_frame_base
180 .byte 10 # DW_FORM_block1
181 .byte 49 # DW_AT_abstract_origin
182 .byte 19 # DW_FORM_ref4
183 .byte 0 # EOM(1)
184 .byte 0 # EOM(2)
185 .byte 5 # Abbreviation Code
186 .byte 5 # DW_TAG_formal_parameter
187 .byte 0 # DW_CHILDREN_no
188 .byte 2 # DW_AT_location
189 .byte 10 # DW_FORM_block1
190 .byte 49 # DW_AT_abstract_origin
191 .byte 19 # DW_FORM_ref4
192 .byte 0 # EOM(1)
193 .byte 0 # EOM(2)
194 .byte 6 # Abbreviation Code
195 .byte 46 # DW_TAG_subprogram
196 .byte 1 # DW_CHILDREN_yes
197 .ascii "\207@" # DW_AT_MIPS_linkage_name
198 .byte 14 # DW_FORM_strp
199 .byte 3 # DW_AT_name
200 .byte 14 # DW_FORM_strp
201 .byte 58 # DW_AT_decl_file
202 .byte 11 # DW_FORM_data1
203 .byte 59 # DW_AT_decl_line
204 .byte 11 # DW_FORM_data1
205 .byte 63 # DW_AT_external
206 .byte 12 # DW_FORM_flag
207 .byte 32 # DW_AT_inline
208 .byte 11 # DW_FORM_data1
209 .byte 0 # EOM(1)
210 .byte 0 # EOM(2)
211 .byte 7 # Abbreviation Code
212 .byte 5 # DW_TAG_formal_parameter
213 .byte 0 # DW_CHILDREN_no
214 .byte 3 # DW_AT_name
215 .byte 14 # DW_FORM_strp
216 .byte 58 # DW_AT_decl_file
217 .byte 11 # DW_FORM_data1
218 .byte 59 # DW_AT_decl_line
219 .byte 11 # DW_FORM_data1
220 .byte 73 # DW_AT_type
221 .byte 19 # DW_FORM_ref4
222 .byte 0 # EOM(1)
223 .byte 0 # EOM(2)
224 .byte 8 # Abbreviation Code
225 .byte 15 # DW_TAG_pointer_type
226 .byte 0 # DW_CHILDREN_no
227 .byte 73 # DW_AT_type
228 .byte 19 # DW_FORM_ref4
229 .byte 0 # EOM(1)
230 .byte 0 # EOM(2)
231 .byte 9 # Abbreviation Code
232 .byte 46 # DW_TAG_subprogram
233 .byte 1 # DW_CHILDREN_yes
234 .byte 17 # DW_AT_low_pc
235 .byte 1 # DW_FORM_addr
236 .byte 18 # DW_AT_high_pc
237 .byte 1 # DW_FORM_addr
238 .byte 64 # DW_AT_frame_base
239 .byte 10 # DW_FORM_block1
240 .byte 3 # DW_AT_name
241 .byte 14 # DW_FORM_strp
242 .byte 58 # DW_AT_decl_file
243 .byte 11 # DW_FORM_data1
244 .byte 59 # DW_AT_decl_line
245 .byte 11 # DW_FORM_data1
246 .byte 73 # DW_AT_type
247 .byte 19 # DW_FORM_ref4
248 .byte 63 # DW_AT_external
249 .byte 12 # DW_FORM_flag
250 .byte 0 # EOM(1)
251 .byte 0 # EOM(2)
252 .byte 10 # Abbreviation Code
253 .byte 5 # DW_TAG_formal_parameter
254 .byte 0 # DW_CHILDREN_no
255 .byte 2 # DW_AT_location
256 .byte 10 # DW_FORM_block1
257 .byte 3 # DW_AT_name
258 .byte 14 # DW_FORM_strp
259 .byte 58 # DW_AT_decl_file
260 .byte 11 # DW_FORM_data1
261 .byte 59 # DW_AT_decl_line
262 .byte 11 # DW_FORM_data1
263 .byte 73 # DW_AT_type
264 .byte 19 # DW_FORM_ref4
265 .byte 0 # EOM(1)
266 .byte 0 # EOM(2)
267 .byte 11 # Abbreviation Code
268 .byte 29 # DW_TAG_inlined_subroutine
269 .byte 0 # DW_CHILDREN_no
270 .byte 49 # DW_AT_abstract_origin
271 .byte 19 # DW_FORM_ref4
272 .byte 17 # DW_AT_low_pc
273 .byte 1 # DW_FORM_addr
274 .byte 18 # DW_AT_high_pc
275 .byte 1 # DW_FORM_addr
276 .byte 88 # DW_AT_call_file
277 .byte 11 # DW_FORM_data1
278 .byte 89 # DW_AT_call_line
279 .byte 11 # DW_FORM_data1
280 .byte 87 # DW_AT_call_column
281 .byte 11 # DW_FORM_data1
282 .byte 0 # EOM(1)
283 .byte 0 # EOM(2)
284 .byte 0 # EOM(3)
285 .section .debug_info,"",@progbits
286 .Lcu_begin0:
287 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
288 .Ldebug_info_start0:
289 .short 3 # DWARF version number
290 .long .debug_abbrev # Offset Into Abbrev. Section
291 .byte 8 # Address Size (in bytes)
292 .byte 1 # Abbrev [1] 0xb:0x108 DW_TAG_compile_unit
293 .long .Linfo_string0 # DW_AT_producer
294 .short 33 # DW_AT_language
295 .long .Linfo_string1 # DW_AT_name
296 .long .Lline_table_start0 # DW_AT_stmt_list
297 .long .Linfo_string2 # DW_AT_comp_dir
298 .quad .Lfunc_begin0 # DW_AT_low_pc
299 .quad .Lfunc_end1 # DW_AT_high_pc
300 .byte 2 # Abbrev [2] 0x2e:0x16 DW_TAG_variable
301 .long .Linfo_string3 # DW_AT_name
302 .long 68 # DW_AT_type
303 .byte 1 # DW_AT_external
304 .byte 1 # DW_AT_decl_file
305 .byte 6 # DW_AT_decl_line
306 .byte 9 # DW_AT_location
307 .byte 3
308 .quad x
309 .byte 3 # Abbrev [3] 0x44:0x7 DW_TAG_base_type
310 .long .Linfo_string4 # DW_AT_name
311 .byte 5 # DW_AT_encoding
312 .byte 4 # DW_AT_byte_size
313 .byte 2 # Abbrev [2] 0x4b:0x16 DW_TAG_variable
314 .long .Linfo_string5 # DW_AT_name
315 .long 68 # DW_AT_type
316 .byte 1 # DW_AT_external
317 .byte 1 # DW_AT_decl_file
318 .byte 7 # DW_AT_decl_line
319 .byte 9 # DW_AT_location
320 .byte 3
321 .quad y
322 .byte 4 # Abbrev [4] 0x61:0x26 DW_TAG_subprogram
323 .quad .Lfunc_begin0 # DW_AT_low_pc
324 .quad .Lfunc_end0 # DW_AT_high_pc
325 .byte 1 # DW_AT_frame_base
326 .byte 87
327 .long 135 # DW_AT_abstract_origin
328 .byte 5 # Abbrev [5] 0x78:0x7 DW_TAG_formal_parameter
329 .byte 1 # DW_AT_location
330 .byte 85
331 .long 148 # DW_AT_abstract_origin
332 .byte 5 # Abbrev [5] 0x7f:0x7 DW_TAG_formal_parameter
333 .byte 1 # DW_AT_location
334 .byte 84
335 .long 159 # DW_AT_abstract_origin
336 .byte 0 # End Of Children Mark
337 .byte 6 # Abbrev [6] 0x87:0x24 DW_TAG_subprogram
338 .long .Linfo_string6 # DW_AT_MIPS_linkage_name
339 .long .Linfo_string7 # DW_AT_name
340 .byte 1 # DW_AT_decl_file
341 .byte 1 # DW_AT_decl_line
342 .byte 1 # DW_AT_external
343 .byte 1 # DW_AT_inline
344 .byte 7 # Abbrev [7] 0x94:0xb DW_TAG_formal_parameter
345 .long .Linfo_string3 # DW_AT_name
346 .byte 1 # DW_AT_decl_file
347 .byte 1 # DW_AT_decl_line
348 .long 171 # DW_AT_type
349 .byte 7 # Abbrev [7] 0x9f:0xb DW_TAG_formal_parameter
350 .long .Linfo_string5 # DW_AT_name
351 .byte 1 # DW_AT_decl_file
352 .byte 1 # DW_AT_decl_line
353 .long 171 # DW_AT_type
354 .byte 0 # End Of Children Mark
355 .byte 8 # Abbrev [8] 0xab:0x5 DW_TAG_pointer_type
356 .long 68 # DW_AT_type
357 .byte 9 # Abbrev [9] 0xb0:0x51 DW_TAG_subprogram
358 .quad .Lfunc_begin1 # DW_AT_low_pc
359 .quad .Lfunc_end1 # DW_AT_high_pc
360 .byte 1 # DW_AT_frame_base
361 .byte 87
362 .long .Linfo_string8 # DW_AT_name
363 .byte 1 # DW_AT_decl_file
364 .byte 8 # DW_AT_decl_line
365 .long 68 # DW_AT_type
366 .byte 1 # DW_AT_external
367 .byte 10 # Abbrev [10] 0xce:0xd DW_TAG_formal_parameter
368 .byte 1 # DW_AT_location
369 .byte 85
370 .long .Linfo_string9 # DW_AT_name
371 .byte 1 # DW_AT_decl_file
372 .byte 8 # DW_AT_decl_line
373 .long 68 # DW_AT_type
374 .byte 10 # Abbrev [10] 0xdb:0xd DW_TAG_formal_parameter
375 .byte 1 # DW_AT_location
376 .byte 84
377 .long .Linfo_string10 # DW_AT_name
378 .byte 1 # DW_AT_decl_file
379 .byte 8 # DW_AT_decl_line
380 .long 257 # DW_AT_type
381 .byte 11 # Abbrev [11] 0xe8:0x18 DW_TAG_inlined_subroutine
382 .long 135 # DW_AT_abstract_origin
383 .quad .Lfunc_begin1 # DW_AT_low_pc
384 .quad .Ltmp2 # DW_AT_high_pc
385 .byte 1 # DW_AT_call_file
386 .byte 11 # DW_AT_call_line
387 .byte 5 # DW_AT_call_column
388 .byte 0 # End Of Children Mark
389 .byte 8 # Abbrev [8] 0x101:0x5 DW_TAG_pointer_type
390 .long 262 # DW_AT_type
391 .byte 8 # Abbrev [8] 0x106:0x5 DW_TAG_pointer_type
392 .long 267 # DW_AT_type
393 .byte 3 # Abbrev [3] 0x10b:0x7 DW_TAG_base_type
394 .long .Linfo_string11 # DW_AT_name
395 .byte 6 # DW_AT_encoding
396 .byte 1 # DW_AT_byte_size
397 .byte 0 # End Of Children Mark
398 .Ldebug_info_end0:
399 .section .debug_str,"MS",@progbits,1
400 .Linfo_string0:
401 .asciz "clang version 14.0.0" # string offset=0
402 .Linfo_string1:
403 .asciz "main.cpp" # string offset=134
404 .Linfo_string2:
405 .asciz "/home/test" # string offset=143
406 .Linfo_string3:
407 .asciz "x" # string offset=159
408 .Linfo_string4:
409 .asciz "int" # string offset=161
410 .Linfo_string5:
411 .asciz "y" # string offset=165
412 .Linfo_string6:
413 .asciz "_Z3usePiS_" # string offset=167
414 .Linfo_string7:
415 .asciz "use" # string offset=178
416 .Linfo_string8:
417 .asciz "main" # string offset=182
418 .Linfo_string9:
419 .asciz "argc" # string offset=187
420 .Linfo_string10:
421 .asciz "argv" # string offset=192
422 .Linfo_string11:
423 .asciz "char" # string offset=197
424 .ident "clang version 14.0.0"
425 .section ".note.GNU-stack","",@progbits
426 .section .debug_line,"",@progbits
427 .Lline_table_start0: