xref: /llvm-project/bolt/test/X86/Inputs/dwarf5-call-pc-function-null-check-main.s (revision b786e01f9340cc009a90e02033a9c84144740017)
1# clang++ main.cpp -g2 -O2 -S
2# int helper(int z_, int d_);
3# int x = 0;
4# int y = 1;
5# int  main(int argc, char *argv[]) {
6#   return helper(x, y);
7# }
8
9# This file was manually modified so that DW_AT_call_pc points to invalid address.
10
11	.text
12	.file	"main.cpp"
13	.file	0 "." "main.cpp" md5 0xcd4b01475ec2d380058dc5a69f9dd741
14	.globl	main                            # -- Begin function main
15	.p2align	4, 0x90
16	.type	main,@function
17main:                                   # @main
18.Lfunc_begin0:
19	.loc	0 4 0                           # main.cpp:4:0
20	.cfi_startproc
21# %bb.0:                                # %entry
22	#DEBUG_VALUE: main:argc <- $edi
23	#DEBUG_VALUE: main:argv <- $rsi
24	.loc	0 5 17 prologue_end             # main.cpp:5:17
25	movl	x(%rip), %edi
26.Ltmp0:
27	#DEBUG_VALUE: main:argc <- [DW_OP_LLVM_entry_value 1] $edi
28	.loc	0 5 20 is_stmt 0                # main.cpp:5:20
29	movl	y(%rip), %esi
30.Ltmp1:
31	#DEBUG_VALUE: main:argv <- [DW_OP_LLVM_entry_value 1] $rsi
32	.loc	0 5 10                          # main.cpp:5:10
33	jmp	_Z6helperii@PLT                 # TAILCALL
34.Ltmp2:
35.Lfunc_end0:
36	.size	main, .Lfunc_end0-main
37	.cfi_endproc
38                                        # -- End function
39	.type	x,@object                       # @x
40	.bss
41	.globl	x
42	.p2align	2
43x:
44	.long	0                               # 0x0
45	.size	x, 4
46
47	.type	y,@object                       # @y
48	.data
49	.globl	y
50	.p2align	2
51y:
52	.long	1                               # 0x1
53	.size	y, 4
54
55	.section	.debug_loclists,"",@progbits
56	.long	.Ldebug_list_header_end0-.Ldebug_list_header_start0 # Length
57.Ldebug_list_header_start0:
58	.short	5                               # Version
59	.byte	8                               # Address size
60	.byte	0                               # Segment selector size
61	.long	2                               # Offset entry count
62.Lloclists_table_base0:
63	.long	.Ldebug_loc0-.Lloclists_table_base0
64	.long	.Ldebug_loc1-.Lloclists_table_base0
65.Ldebug_loc0:
66	.byte	4                               # DW_LLE_offset_pair
67	.uleb128 .Lfunc_begin0-.Lfunc_begin0    #   starting offset
68	.uleb128 .Ltmp0-.Lfunc_begin0           #   ending offset
69	.byte	1                               # Loc expr size
70	.byte	85                              # super-register DW_OP_reg5
71	.byte	4                               # DW_LLE_offset_pair
72	.uleb128 .Ltmp0-.Lfunc_begin0           #   starting offset
73	.uleb128 .Lfunc_end0-.Lfunc_begin0      #   ending offset
74	.byte	4                               # Loc expr size
75	.byte	163                             # DW_OP_entry_value
76	.byte	1                               # 1
77	.byte	85                              # super-register DW_OP_reg5
78	.byte	159                             # DW_OP_stack_value
79	.byte	0                               # DW_LLE_end_of_list
80.Ldebug_loc1:
81	.byte	4                               # DW_LLE_offset_pair
82	.uleb128 .Lfunc_begin0-.Lfunc_begin0    #   starting offset
83	.uleb128 .Ltmp1-.Lfunc_begin0           #   ending offset
84	.byte	1                               # Loc expr size
85	.byte	84                              # DW_OP_reg4
86	.byte	4                               # DW_LLE_offset_pair
87	.uleb128 .Ltmp1-.Lfunc_begin0           #   starting offset
88	.uleb128 .Lfunc_end0-.Lfunc_begin0      #   ending offset
89	.byte	4                               # Loc expr size
90	.byte	163                             # DW_OP_entry_value
91	.byte	1                               # 1
92	.byte	84                              # DW_OP_reg4
93	.byte	159                             # DW_OP_stack_value
94	.byte	0                               # DW_LLE_end_of_list
95.Ldebug_list_header_end0:
96	.section	.debug_abbrev,"",@progbits
97	.byte	1                               # Abbreviation Code
98	.byte	17                              # DW_TAG_compile_unit
99	.byte	1                               # DW_CHILDREN_yes
100	.byte	37                              # DW_AT_producer
101	.byte	37                              # DW_FORM_strx1
102	.byte	19                              # DW_AT_language
103	.byte	5                               # DW_FORM_data2
104	.byte	3                               # DW_AT_name
105	.byte	37                              # DW_FORM_strx1
106	.byte	114                             # DW_AT_str_offsets_base
107	.byte	23                              # DW_FORM_sec_offset
108	.byte	16                              # DW_AT_stmt_list
109	.byte	23                              # DW_FORM_sec_offset
110	.byte	27                              # DW_AT_comp_dir
111	.byte	37                              # DW_FORM_strx1
112	.byte	17                              # DW_AT_low_pc
113	.byte	27                              # DW_FORM_addrx
114	.byte	18                              # DW_AT_high_pc
115	.byte	6                               # DW_FORM_data4
116	.byte	115                             # DW_AT_addr_base
117	.byte	23                              # DW_FORM_sec_offset
118	.ascii	"\214\001"                      # DW_AT_loclists_base
119	.byte	23                              # DW_FORM_sec_offset
120	.byte	0                               # EOM(1)
121	.byte	0                               # EOM(2)
122	.byte	2                               # Abbreviation Code
123	.byte	52                              # DW_TAG_variable
124	.byte	0                               # DW_CHILDREN_no
125	.byte	3                               # DW_AT_name
126	.byte	37                              # DW_FORM_strx1
127	.byte	73                              # DW_AT_type
128	.byte	19                              # DW_FORM_ref4
129	.byte	63                              # DW_AT_external
130	.byte	25                              # DW_FORM_flag_present
131	.byte	58                              # DW_AT_decl_file
132	.byte	11                              # DW_FORM_data1
133	.byte	59                              # DW_AT_decl_line
134	.byte	11                              # DW_FORM_data1
135	.byte	2                               # DW_AT_location
136	.byte	24                              # DW_FORM_exprloc
137	.byte	0                               # EOM(1)
138	.byte	0                               # EOM(2)
139	.byte	3                               # Abbreviation Code
140	.byte	36                              # DW_TAG_base_type
141	.byte	0                               # DW_CHILDREN_no
142	.byte	3                               # DW_AT_name
143	.byte	37                              # DW_FORM_strx1
144	.byte	62                              # DW_AT_encoding
145	.byte	11                              # DW_FORM_data1
146	.byte	11                              # DW_AT_byte_size
147	.byte	11                              # DW_FORM_data1
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	122                             # DW_AT_call_all_calls
160	.byte	25                              # DW_FORM_flag_present
161	.byte	3                               # DW_AT_name
162	.byte	37                              # DW_FORM_strx1
163	.byte	58                              # DW_AT_decl_file
164	.byte	11                              # DW_FORM_data1
165	.byte	59                              # DW_AT_decl_line
166	.byte	11                              # DW_FORM_data1
167	.byte	73                              # DW_AT_type
168	.byte	19                              # DW_FORM_ref4
169	.byte	63                              # DW_AT_external
170	.byte	25                              # DW_FORM_flag_present
171	.byte	0                               # EOM(1)
172	.byte	0                               # EOM(2)
173	.byte	5                               # Abbreviation Code
174	.byte	5                               # DW_TAG_formal_parameter
175	.byte	0                               # DW_CHILDREN_no
176	.byte	2                               # DW_AT_location
177	.byte	34                              # DW_FORM_loclistx
178	.byte	3                               # DW_AT_name
179	.byte	37                              # DW_FORM_strx1
180	.byte	58                              # DW_AT_decl_file
181	.byte	11                              # DW_FORM_data1
182	.byte	59                              # DW_AT_decl_line
183	.byte	11                              # DW_FORM_data1
184	.byte	73                              # DW_AT_type
185	.byte	19                              # DW_FORM_ref4
186	.byte	0                               # EOM(1)
187	.byte	0                               # EOM(2)
188	.byte	6                               # Abbreviation Code
189	.byte	72                              # DW_TAG_call_site
190	.byte	0                               # DW_CHILDREN_no
191	.byte	127                             # DW_AT_call_origin
192	.byte	19                              # DW_FORM_ref4
193	.ascii	"\202\001"                      # DW_AT_call_tail_call
194	.byte	25                              # DW_FORM_flag_present
195	.ascii	"\201\001"                      # DW_AT_call_pc
196	.byte	27                              # DW_FORM_addrx
197	.byte	0                               # EOM(1)
198	.byte	0                               # EOM(2)
199	.byte	7                               # Abbreviation Code
200	.byte	46                              # DW_TAG_subprogram
201	.byte	1                               # DW_CHILDREN_yes
202	.byte	110                             # DW_AT_linkage_name
203	.byte	37                              # DW_FORM_strx1
204	.byte	3                               # DW_AT_name
205	.byte	37                              # DW_FORM_strx1
206	.byte	58                              # DW_AT_decl_file
207	.byte	11                              # DW_FORM_data1
208	.byte	59                              # DW_AT_decl_line
209	.byte	11                              # DW_FORM_data1
210	.byte	73                              # DW_AT_type
211	.byte	19                              # DW_FORM_ref4
212	.byte	60                              # DW_AT_declaration
213	.byte	25                              # DW_FORM_flag_present
214	.byte	63                              # DW_AT_external
215	.byte	25                              # DW_FORM_flag_present
216	.byte	0                               # EOM(1)
217	.byte	0                               # EOM(2)
218	.byte	8                               # Abbreviation Code
219	.byte	5                               # DW_TAG_formal_parameter
220	.byte	0                               # DW_CHILDREN_no
221	.byte	73                              # DW_AT_type
222	.byte	19                              # DW_FORM_ref4
223	.byte	0                               # EOM(1)
224	.byte	0                               # EOM(2)
225	.byte	9                               # Abbreviation Code
226	.byte	15                              # DW_TAG_pointer_type
227	.byte	0                               # DW_CHILDREN_no
228	.byte	73                              # DW_AT_type
229	.byte	19                              # DW_FORM_ref4
230	.byte	0                               # EOM(1)
231	.byte	0                               # EOM(2)
232	.byte	0                               # EOM(3)
233	.section	.debug_info,"",@progbits
234.Lcu_begin0:
235	.long	.Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
236.Ldebug_info_start0:
237	.short	5                               # DWARF version number
238	.byte	1                               # DWARF Unit Type
239	.byte	8                               # Address Size (in bytes)
240	.long	.debug_abbrev                   # Offset Into Abbrev. Section
241	.byte	1                               # Abbrev [1] 0xc:0x80 DW_TAG_compile_unit
242	.byte	0                               # DW_AT_producer
243	.short	33                              # DW_AT_language
244	.byte	1                               # DW_AT_name
245	.long	.Lstr_offsets_base0             # DW_AT_str_offsets_base
246	.long	.Lline_table_start0             # DW_AT_stmt_list
247	.byte	2                               # DW_AT_comp_dir
248	.byte	2                               # DW_AT_low_pc
249	.long	.Lfunc_end0-.Lfunc_begin0       # DW_AT_high_pc
250	.long	.Laddr_table_base0              # DW_AT_addr_base
251	.long	.Lloclists_table_base0          # DW_AT_loclists_base
252	.byte	2                               # Abbrev [2] 0x27:0xb DW_TAG_variable
253	.byte	3                               # DW_AT_name
254	.long	50                              # DW_AT_type
255                                        # DW_AT_external
256	.byte	0                               # DW_AT_decl_file
257	.byte	2                               # DW_AT_decl_line
258	.byte	2                               # DW_AT_location
259	.byte	161
260	.byte	0
261	.byte	3                               # Abbrev [3] 0x32:0x4 DW_TAG_base_type
262	.byte	4                               # DW_AT_name
263	.byte	5                               # DW_AT_encoding
264	.byte	4                               # DW_AT_byte_size
265	.byte	2                               # Abbrev [2] 0x36:0xb DW_TAG_variable
266	.byte	5                               # DW_AT_name
267	.long	50                              # DW_AT_type
268                                        # DW_AT_external
269	.byte	0                               # DW_AT_decl_file
270	.byte	3                               # DW_AT_decl_line
271	.byte	2                               # DW_AT_location
272	.byte	161
273	.byte	1
274	.byte	4                               # Abbrev [4] 0x41:0x28 DW_TAG_subprogram
275	.byte	2                               # DW_AT_low_pc
276	.long	.Lfunc_end0-.Lfunc_begin0       # DW_AT_high_pc
277	.byte	1                               # DW_AT_frame_base
278	.byte	87
279                                        # DW_AT_call_all_calls
280	.byte	8                               # DW_AT_name
281	.byte	0                               # DW_AT_decl_file
282	.byte	4                               # DW_AT_decl_line
283	.long	50                              # DW_AT_type
284                                        # DW_AT_external
285	.byte	5                               # Abbrev [5] 0x50:0x9 DW_TAG_formal_parameter
286	.byte	0                               # DW_AT_location
287	.byte	9                               # DW_AT_name
288	.byte	0                               # DW_AT_decl_file
289	.byte	4                               # DW_AT_decl_line
290	.long	50                              # DW_AT_type
291	.byte	5                               # Abbrev [5] 0x59:0x9 DW_TAG_formal_parameter
292	.byte	1                               # DW_AT_location
293	.byte	10                              # DW_AT_name
294	.byte	0                               # DW_AT_decl_file
295	.byte	4                               # DW_AT_decl_line
296	.long	125                             # DW_AT_type
297	.byte	6                               # Abbrev [6] 0x62:0x6 DW_TAG_call_site
298	.long	105                             # DW_AT_call_origin
299                                        # DW_AT_call_tail_call
300	.byte	3                               # DW_AT_call_pc
301	.byte	0                               # End Of Children Mark
302	.byte	7                               # Abbrev [7] 0x69:0x14 DW_TAG_subprogram
303	.byte	6                               # DW_AT_linkage_name
304	.byte	7                               # DW_AT_name
305	.byte	0                               # DW_AT_decl_file
306	.byte	1                               # DW_AT_decl_line
307	.long	50                              # DW_AT_type
308                                        # DW_AT_declaration
309                                        # DW_AT_external
310	.byte	8                               # Abbrev [8] 0x72:0x5 DW_TAG_formal_parameter
311	.long	50                              # DW_AT_type
312	.byte	8                               # Abbrev [8] 0x77:0x5 DW_TAG_formal_parameter
313	.long	50                              # DW_AT_type
314	.byte	0                               # End Of Children Mark
315	.byte	9                               # Abbrev [9] 0x7d:0x5 DW_TAG_pointer_type
316	.long	130                             # DW_AT_type
317	.byte	9                               # Abbrev [9] 0x82:0x5 DW_TAG_pointer_type
318	.long	135                             # DW_AT_type
319	.byte	3                               # Abbrev [3] 0x87:0x4 DW_TAG_base_type
320	.byte	11                              # DW_AT_name
321	.byte	6                               # DW_AT_encoding
322	.byte	1                               # DW_AT_byte_size
323	.byte	0                               # End Of Children Mark
324.Ldebug_info_end0:
325	.section	.debug_str_offsets,"",@progbits
326	.long	52                              # Length of String Offsets Set
327	.short	5
328	.short	0
329.Lstr_offsets_base0:
330	.section	.debug_str,"MS",@progbits,1
331.Linfo_string0:
332	.asciz	"clang version 16.0.0" # string offset=0
333.Linfo_string1:
334	.asciz	"main.cpp"                      # string offset=134
335.Linfo_string2:
336	.asciz	"." # string offset=143
337.Linfo_string3:
338	.asciz	"x"                             # string offset=196
339.Linfo_string4:
340	.asciz	"int"                           # string offset=198
341.Linfo_string5:
342	.asciz	"y"                             # string offset=202
343.Linfo_string6:
344	.asciz	"_Z6helperii"                   # string offset=204
345.Linfo_string7:
346	.asciz	"helper"                        # string offset=216
347.Linfo_string8:
348	.asciz	"main"                          # string offset=223
349.Linfo_string9:
350	.asciz	"argc"                          # string offset=228
351.Linfo_string10:
352	.asciz	"argv"                          # string offset=233
353.Linfo_string11:
354	.asciz	"char"                          # string offset=238
355	.section	.debug_str_offsets,"",@progbits
356	.long	.Linfo_string0
357	.long	.Linfo_string1
358	.long	.Linfo_string2
359	.long	.Linfo_string3
360	.long	.Linfo_string4
361	.long	.Linfo_string5
362	.long	.Linfo_string6
363	.long	.Linfo_string7
364	.long	.Linfo_string8
365	.long	.Linfo_string9
366	.long	.Linfo_string10
367	.long	.Linfo_string11
368	.section	.debug_addr,"",@progbits
369	.long	.Ldebug_addr_end0-.Ldebug_addr_start0 # Length of contribution
370.Ldebug_addr_start0:
371	.short	5                               # DWARF version number
372	.byte	8                               # Address size
373	.byte	0                               # Segment selector size
374.Laddr_table_base0:
375	.quad	x
376	.quad	y
377	.quad	.Lfunc_begin0
378	.quad	.Ltmp1 + 0x1000000				# Manually modified to add 0x1000000
379.Ldebug_addr_end0:
380	.ident	"clang version 16.0.0"
381	.section	".note.GNU-stack","",@progbits
382	.addrsig
383	.section	.debug_line,"",@progbits
384.Lline_table_start0:
385