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