xref: /llvm-project/bolt/test/X86/Inputs/dwarf5-subprogram-single-gc-ranges-main.s (revision 75f770a68f70498f0b5229597f70dd8204c66e7c)
1# clang++ -ffunction-sections -g2 -gdwarf-5
2# Manually modified to use ranges like what generates sometimes -fbasic-block-sections=all,
3# and changed start of range to 0.
4# int doStuff(int val) {
5#   if (val)
6#     ++val;
7#   return val;
8# }
9#
10# int main(int argc, const char** argv) {
11#     return  doStuff(argc);
12# }
13	.text
14	.file	"main.cpp"
15	.section	.text._Z7doStuffi,"ax",@progbits
16	.globl	_Z7doStuffi                     # -- Begin function _Z7doStuffi
17	.p2align	4, 0x90
18	.type	_Z7doStuffi,@function
19_Z7doStuffi:                            # @_Z7doStuffi
20.Lfunc_begin0:
21	.file	0 "/subprogramRanges" "main.cpp" md5 0x45fd34ef778739dca24be206894f1d15
22	.loc	0 1 0                           # main.cpp:1:0
23	.cfi_startproc
24# %bb.0:                                # %entry
25	pushq	%rbp
26	.cfi_def_cfa_offset 16
27	.cfi_offset %rbp, -16
28	movq	%rsp, %rbp
29	.cfi_def_cfa_register %rbp
30	movl	%edi, -4(%rbp)
31.Ltmp0:
32	.loc	0 2 7 prologue_end              # main.cpp:2:7
33	cmpl	$0, -4(%rbp)
34.Ltmp1:
35	.loc	0 2 7 is_stmt 0                 # main.cpp:2:7
36	je	.LBB0_2
37# %bb.1:                                # %if.then
38.Ltmp2:
39	.loc	0 3 5 is_stmt 1                 # main.cpp:3:5
40	movl	-4(%rbp), %eax
41	addl	$1, %eax
42	movl	%eax, -4(%rbp)
43.Ltmp3:
44.LBB0_2:                                # %if.end
45	.loc	0 4 10                          # main.cpp:4:10
46	movl	-4(%rbp), %eax
47	.loc	0 4 3 epilogue_begin is_stmt 0  # main.cpp:4:3
48	popq	%rbp
49	.cfi_def_cfa %rsp, 8
50	retq
51.Ltmp4:
52.Lfunc_end0:
53	.size	_Z7doStuffi, .Lfunc_end0-_Z7doStuffi
54	.cfi_endproc
55                                        # -- End function
56	.section	.text.main,"ax",@progbits
57	.globl	main                            # -- Begin function main
58	.p2align	4, 0x90
59	.type	main,@function
60main:                                   # @main
61.Lfunc_begin1:
62	.loc	0 7 0 is_stmt 1                 # main.cpp:7:0
63	.cfi_startproc
64# %bb.0:                                # %entry
65	pushq	%rbp
66	.cfi_def_cfa_offset 16
67	.cfi_offset %rbp, -16
68	movq	%rsp, %rbp
69	.cfi_def_cfa_register %rbp
70	subq	$16, %rsp
71	movl	$0, -4(%rbp)
72	movl	%edi, -8(%rbp)
73	movq	%rsi, -16(%rbp)
74.Ltmp5:
75	.loc	0 8 21 prologue_end             # main.cpp:8:21
76	movl	-8(%rbp), %edi
77	.loc	0 8 13 is_stmt 0                # main.cpp:8:13
78	callq	_Z7doStuffi
79	.loc	0 8 5 epilogue_begin            # main.cpp:8:5
80	addq	$16, %rsp
81	popq	%rbp
82	.cfi_def_cfa %rsp, 8
83	retq
84.Ltmp6:
85.Lfunc_end1:
86	.size	main, .Lfunc_end1-main
87	.cfi_endproc
88                                        # -- End function
89	.section	.debug_abbrev,"",@progbits
90	.byte	1                               # Abbreviation Code
91	.byte	17                              # DW_TAG_compile_unit
92	.byte	1                               # DW_CHILDREN_yes
93	.byte	37                              # DW_AT_producer
94	.byte	37                              # DW_FORM_strx1
95	.byte	19                              # DW_AT_language
96	.byte	5                               # DW_FORM_data2
97	.byte	3                               # DW_AT_name
98	.byte	37                              # DW_FORM_strx1
99	.byte	114                             # DW_AT_str_offsets_base
100	.byte	23                              # DW_FORM_sec_offset
101	.byte	16                              # DW_AT_stmt_list
102	.byte	23                              # DW_FORM_sec_offset
103	.byte	27                              # DW_AT_comp_dir
104	.byte	37                              # DW_FORM_strx1
105	.byte	17                              # DW_AT_low_pc
106	.byte	1                               # DW_FORM_addr
107	.byte	85                              # DW_AT_ranges
108	.byte	35                              # DW_FORM_rnglistx
109	.byte	115                             # DW_AT_addr_base
110	.byte	23                              # DW_FORM_sec_offset
111	.byte	116                             # DW_AT_rnglists_base
112	.byte	23                              # DW_FORM_sec_offset
113	.byte	0                               # EOM(1)
114	.byte	0                               # EOM(2)
115	.byte	2                               # Abbreviation Code
116	.byte	46                              # DW_TAG_subprogram
117	.byte	1                               # DW_CHILDREN_yes
118	.byte	85                              # DW_AT_ranges
119	.byte	35                              # DW_FORM_rnglistx
120	.byte	64                              # DW_AT_frame_base
121	.byte	24                              # DW_FORM_exprloc
122	.byte	110                             # DW_AT_linkage_name
123	.byte	37                              # DW_FORM_strx1
124	.byte	3                               # DW_AT_name
125	.byte	37                              # DW_FORM_strx1
126	.byte	58                              # DW_AT_decl_file
127	.byte	11                              # DW_FORM_data1
128	.byte	59                              # DW_AT_decl_line
129	.byte	11                              # DW_FORM_data1
130	.byte	73                              # DW_AT_type
131	.byte	19                              # DW_FORM_ref4
132	.byte	63                              # DW_AT_external
133	.byte	25                              # DW_FORM_flag_present
134	.byte	0                               # EOM(1)
135	.byte	0                               # EOM(2)
136	.byte	3                               # Abbreviation Code
137	.byte	5                               # DW_TAG_formal_parameter
138	.byte	0                               # DW_CHILDREN_no
139	.byte	2                               # DW_AT_location
140	.byte	24                              # DW_FORM_exprloc
141	.byte	3                               # DW_AT_name
142	.byte	37                              # DW_FORM_strx1
143	.byte	58                              # DW_AT_decl_file
144	.byte	11                              # DW_FORM_data1
145	.byte	59                              # DW_AT_decl_line
146	.byte	11                              # DW_FORM_data1
147	.byte	73                              # DW_AT_type
148	.byte	19                              # DW_FORM_ref4
149	.byte	0                               # EOM(1)
150	.byte	0                               # EOM(2)
151	.byte	4                               # Abbreviation Code
152	.byte	46                              # DW_TAG_subprogram
153	.byte	1                               # DW_CHILDREN_yes
154	.byte	17                              # DW_AT_low_pc
155	.byte	27                              # DW_FORM_addrx
156	.byte	18                              # DW_AT_high_pc
157	.byte	6                               # DW_FORM_data4
158	.byte	64                              # DW_AT_frame_base
159	.byte	24                              # DW_FORM_exprloc
160	.byte	3                               # DW_AT_name
161	.byte	37                              # DW_FORM_strx1
162	.byte	58                              # DW_AT_decl_file
163	.byte	11                              # DW_FORM_data1
164	.byte	59                              # DW_AT_decl_line
165	.byte	11                              # DW_FORM_data1
166	.byte	73                              # DW_AT_type
167	.byte	19                              # DW_FORM_ref4
168	.byte	63                              # DW_AT_external
169	.byte	25                              # DW_FORM_flag_present
170	.byte	0                               # EOM(1)
171	.byte	0                               # EOM(2)
172	.byte	5                               # Abbreviation Code
173	.byte	36                              # DW_TAG_base_type
174	.byte	0                               # DW_CHILDREN_no
175	.byte	3                               # DW_AT_name
176	.byte	37                              # DW_FORM_strx1
177	.byte	62                              # DW_AT_encoding
178	.byte	11                              # DW_FORM_data1
179	.byte	11                              # DW_AT_byte_size
180	.byte	11                              # DW_FORM_data1
181	.byte	0                               # EOM(1)
182	.byte	0                               # EOM(2)
183	.byte	6                               # Abbreviation Code
184	.byte	15                              # DW_TAG_pointer_type
185	.byte	0                               # DW_CHILDREN_no
186	.byte	73                              # DW_AT_type
187	.byte	19                              # DW_FORM_ref4
188	.byte	0                               # EOM(1)
189	.byte	0                               # EOM(2)
190	.byte	7                               # Abbreviation Code
191	.byte	38                              # DW_TAG_const_type
192	.byte	0                               # DW_CHILDREN_no
193	.byte	73                              # DW_AT_type
194	.byte	19                              # DW_FORM_ref4
195	.byte	0                               # EOM(1)
196	.byte	0                               # EOM(2)
197	.byte	0                               # EOM(3)
198	.section	.debug_info,"",@progbits
199.Lcu_begin0:
200	.long	.Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
201.Ldebug_info_start0:
202	.short	5                               # DWARF version number
203	.byte	1                               # DWARF Unit Type
204	.byte	8                               # Address Size (in bytes)
205	.long	.debug_abbrev                   # Offset Into Abbrev. Section
206	.byte	1                               # Abbrev [1] 0xc:0x79 DW_TAG_compile_unit
207	.byte	0                               # DW_AT_producer
208	.short	33                              # DW_AT_language
209	.byte	1                               # DW_AT_name
210	.long	.Lstr_offsets_base0             # DW_AT_str_offsets_base
211	.long	.Lline_table_start0             # DW_AT_stmt_list
212	.byte	2                               # DW_AT_comp_dir
213	.quad	0                               # DW_AT_low_pc
214	.byte	0                               # DW_AT_ranges
215	.long	.Laddr_table_base0              # DW_AT_addr_base
216	.long	.Lrnglists_table_base0          # DW_AT_rnglists_base
217	.byte	2                               # Abbrev [2] 0x2b:0x1c DW_TAG_subprogram
218	.byte	1                               # DW_AT_ranges
219	.byte	1                               # DW_AT_frame_base
220	.byte	86
221	.byte	3                               # DW_AT_linkage_name
222	.byte	4                               # DW_AT_name
223	.byte	0                               # DW_AT_decl_file
224	.byte	1                               # DW_AT_decl_line
225	.long	109                             # DW_AT_type
226                                        # DW_AT_external
227	.byte	3                               # Abbrev [3] 0x3b:0xb DW_TAG_formal_parameter
228	.byte	2                               # DW_AT_location
229	.byte	145
230	.byte	124
231	.byte	7                               # DW_AT_name
232	.byte	0                               # DW_AT_decl_file
233	.byte	1                               # DW_AT_decl_line
234	.long	109                             # DW_AT_type
235	.byte	0                               # End Of Children Mark
236	.byte	4                               # Abbrev [4] 0x47:0x26 DW_TAG_subprogram
237	.byte	1                               # DW_AT_low_pc
238	.long	.Lfunc_end1-.Lfunc_begin1       # DW_AT_high_pc
239	.byte	1                               # DW_AT_frame_base
240	.byte	86
241	.byte	6                               # DW_AT_name
242	.byte	0                               # DW_AT_decl_file
243	.byte	7                               # DW_AT_decl_line
244	.long	109                             # DW_AT_type
245                                        # DW_AT_external
246	.byte	3                               # Abbrev [3] 0x56:0xb DW_TAG_formal_parameter
247	.byte	2                               # DW_AT_location
248	.byte	145
249	.byte	120
250	.byte	8                               # DW_AT_name
251	.byte	0                               # DW_AT_decl_file
252	.byte	7                               # DW_AT_decl_line
253	.long	109                             # DW_AT_type
254	.byte	3                               # Abbrev [3] 0x61:0xb DW_TAG_formal_parameter
255	.byte	2                               # DW_AT_location
256	.byte	145
257	.byte	112
258	.byte	9                               # DW_AT_name
259	.byte	0                               # DW_AT_decl_file
260	.byte	7                               # DW_AT_decl_line
261	.long	105                             # DW_AT_type
262	.byte	0                               # End Of Children Mark
263	.byte	5                               # Abbrev [5] 0x6d:0x4 DW_TAG_base_type
264	.byte	5                               # DW_AT_name
265	.byte	5                               # DW_AT_encoding
266	.byte	4                               # DW_AT_byte_size
267	.byte	6                               # Abbrev [6] 0x71:0x5 DW_TAG_pointer_type
268	.long	114                             # DW_AT_type
269	.byte	6                               # Abbrev [6] 0x76:0x5 DW_TAG_pointer_type
270	.long	119                             # DW_AT_type
271	.byte	7                               # Abbrev [7] 0x7b:0x5 DW_TAG_const_type
272	.long	124                             # DW_AT_type
273	.byte	5                               # Abbrev [5] 0x80:0x4 DW_TAG_base_type
274	.byte	10                              # DW_AT_name
275	.byte	6                               # DW_AT_encoding
276	.byte	1                               # DW_AT_byte_size
277	.byte	0                               # End Of Children Mark
278.Ldebug_info_end0:
279	.section	.debug_rnglists,"",@progbits
280	.long	.Ldebug_list_header_end0-.Ldebug_list_header_start0 # Length
281.Ldebug_list_header_start0:
282	.short	5                               # Version
283	.byte	8                               # Address size
284	.byte	0                               # Segment selector size
285	.long	1                               # Offset entry count
286.Lrnglists_table_base0:
287	.long	.Ldebug_ranges0-.Lrnglists_table_base0
288	.long	.Ldebug_ranges1-.Lrnglists_table_base0
289.Ldebug_ranges0:
290	.byte	3                               # DW_RLE_startx_length
291	.byte	0                               #   start index
292	.uleb128 .Lfunc_end0-.Lfunc_begin0      #   length
293	.byte	3                               # DW_RLE_startx_length
294	.byte	1                               #   start index
295	.uleb128 .Lfunc_end1-.Lfunc_begin1      #   length
296	.byte	0                               # DW_RLE_end_of_list
297.Ldebug_ranges1:
298	.byte	3                               # DW_RLE_startx_length
299	.byte	2                               #   start index
300	.uleb128 .Lfunc_end0-.Lfunc_begin0      #   length
301	.byte	0                               # DW_RLE_end_of_list
302.Ldebug_list_header_end0:
303	.section	.debug_str_offsets,"",@progbits
304	.long	48                              # Length of String Offsets Set
305	.short	5
306	.short	0
307.Lstr_offsets_base0:
308	.section	.debug_str,"MS",@progbits,1
309.Linfo_string0:
310	.asciz	"clang version 17.0.0 (https://github.com/llvm/llvm-project.git 640e07c49037cca41a1bfbeb916b569d8c950aea)" # string offset=0
311.Linfo_string1:
312	.asciz	"main.cpp"                      # string offset=105
313.Linfo_string2:
314	.asciz	"/subprogramRanges" # string offset=114
315.Linfo_string3:
316	.asciz	"_Z7doStuffi"                   # string offset=169
317.Linfo_string4:
318	.asciz	"doStuff"                       # string offset=181
319.Linfo_string5:
320	.asciz	"int"                           # string offset=189
321.Linfo_string6:
322	.asciz	"main"                          # string offset=193
323.Linfo_string7:
324	.asciz	"val"                           # string offset=198
325.Linfo_string8:
326	.asciz	"argc"                          # string offset=202
327.Linfo_string9:
328	.asciz	"argv"                          # string offset=207
329.Linfo_string10:
330	.asciz	"char"                          # string offset=212
331	.section	.debug_str_offsets,"",@progbits
332	.long	.Linfo_string0
333	.long	.Linfo_string1
334	.long	.Linfo_string2
335	.long	.Linfo_string3
336	.long	.Linfo_string4
337	.long	.Linfo_string5
338	.long	.Linfo_string6
339	.long	.Linfo_string7
340	.long	.Linfo_string8
341	.long	.Linfo_string9
342	.long	.Linfo_string10
343	.section	.debug_addr,"",@progbits
344	.long	.Ldebug_addr_end0-.Ldebug_addr_start0 # Length of contribution
345.Ldebug_addr_start0:
346	.short	5                               # DWARF version number
347	.byte	8                               # Address size
348	.byte	0                               # Segment selector size
349.Laddr_table_base0:
350	.quad	.Lfunc_begin0
351	.quad	.Lfunc_begin1
352	.quad	0x0
353.Ldebug_addr_end0:
354	.ident	"clang version 17.0.0 (https://github.com/llvm/llvm-project.git 640e07c49037cca41a1bfbeb916b569d8c950aea)"
355	.section	".note.GNU-stack","",@progbits
356	.addrsig
357	.addrsig_sym _Z7doStuffi
358	.section	.debug_line,"",@progbits
359.Lline_table_start0:
360