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