brintos

brintos / llvm-project-archived public Read only

0
0
Text · 20.2 KiB · 7938bc0 Raw
433 lines · plain
1# REQUIRES: system-linux2 3# RUN: llvm-mc -dwarf-version=4 -filetype=obj -triple x86_64-unknown-linux %s -o %tmain.o4# RUN: %clang %cflags -no-pie %s -o %t.exe -Wl,-q5# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections6# RUN: llvm-dwarfdump --show-children --name=main --debug-info %t.bolt \7# RUN:   | FileCheck %s8 9# CHECK: 		DW_TAG_inlined_subroutine10# CHECK:      DW_AT_low_pc11# CHECK-SAME: 0x000000000000000012 13# CHECK:    DW_TAG_GNU_call_site14# CHECK:      DW_AT_low_pc15# CHECK-SAME: 0x000000000000000016 17## Test that llvm-bolt correctly updates DIEs corresponding to deleted code.18 19# Test case built from the following source using:20#21#   clang -O2 -g ...22#23# Assembly modified with "je" -> "jmp" to introduce unreachable block.24#25# extern void puts(const char *);26#27# static void foo() {28#   puts("hi");29# }30#31# int main(int argc, char **argv) {32#   if (argc)33#     foo();34#   return 0;35# }36 37	.text38	.file	"unreachable.c"39	.file	1 "." "unreachable.c"40	.globl	main                            # -- Begin function main41	.p2align	4, 0x9042	.type	main,@function43main:                                   # @main44.Lfunc_begin0:45	.loc	1 7 0                           # unreachable.c:7:046	.cfi_startproc47# %bb.0:48	#DEBUG_VALUE: main:argc <- $edi49	#DEBUG_VALUE: main:argv <- $rsi50	.loc	1 8 7 prologue_end              # unreachable.c:8:751	testl	%edi, %edi52.Ltmp0:53	.loc	1 8 7 is_stmt 0                 # unreachable.c:8:754	jmp	.LBB0_255.Ltmp1:56# %bb.1:57	#DEBUG_VALUE: main:argc <- $edi58	#DEBUG_VALUE: main:argv <- $rsi59	pushq	%rax60	.cfi_def_cfa_offset 1661.Ltmp2:62	.loc	1 4 3 is_stmt 1                 # unreachable.c:4:363	movl	$.L.str, %edi64.Ltmp3:65	#DEBUG_VALUE: main:argc <- [DW_OP_LLVM_entry_value 1] $edi66	callq	puts67.Ltmp4:68	#DEBUG_VALUE: main:argv <- [DW_OP_LLVM_entry_value 1] $rsi69	.loc	1 0 3 is_stmt 0                 # unreachable.c:0:370	addq	$8, %rsp71.Ltmp5:72	.cfi_def_cfa_offset 873.LBB0_2:74	#DEBUG_VALUE: main:argc <- [DW_OP_LLVM_entry_value 1] $edi75	#DEBUG_VALUE: main:argv <- [DW_OP_LLVM_entry_value 1] $rsi76	.loc	1 10 3 is_stmt 1                # unreachable.c:10:377	xorl	%eax, %eax78	retq79.Ltmp6:80.Lfunc_end0:81	.size	main, .Lfunc_end0-main82	.cfi_endproc83                                        # -- End function84	.type	.L.str,@object                  # @.str85	.section	.rodata.str1.1,"aMS",@progbits,186.L.str:87	.asciz	"hi"88	.size	.L.str, 389 90	.section	.debug_loc,"",@progbits91.Ldebug_loc0:92	.quad	.Lfunc_begin0-.Lfunc_begin093	.quad	.Ltmp3-.Lfunc_begin094	.short	1                               # Loc expr size95	.byte	85                              # super-register DW_OP_reg596	.quad	.Ltmp3-.Lfunc_begin097	.quad	.Lfunc_end0-.Lfunc_begin098	.short	4                               # Loc expr size99	.byte	243                             # DW_OP_GNU_entry_value100	.byte	1                               # 1101	.byte	85                              # super-register DW_OP_reg5102	.byte	159                             # DW_OP_stack_value103	.quad	0104	.quad	0105.Ldebug_loc1:106	.quad	.Lfunc_begin0-.Lfunc_begin0107	.quad	.Ltmp4-.Lfunc_begin0108	.short	1                               # Loc expr size109	.byte	84                              # DW_OP_reg4110	.quad	.Ltmp4-.Lfunc_begin0111	.quad	.Lfunc_end0-.Lfunc_begin0112	.short	4                               # Loc expr size113	.byte	243                             # DW_OP_GNU_entry_value114	.byte	1                               # 1115	.byte	84                              # DW_OP_reg4116	.byte	159                             # DW_OP_stack_value117	.quad	0118	.quad	0119	.section	.debug_abbrev,"",@progbits120	.byte	1                               # Abbreviation Code121	.byte	17                              # DW_TAG_compile_unit122	.byte	1                               # DW_CHILDREN_yes123	.byte	37                              # DW_AT_producer124	.byte	14                              # DW_FORM_strp125	.byte	19                              # DW_AT_language126	.byte	5                               # DW_FORM_data2127	.byte	3                               # DW_AT_name128	.byte	14                              # DW_FORM_strp129	.byte	16                              # DW_AT_stmt_list130	.byte	23                              # DW_FORM_sec_offset131	.byte	27                              # DW_AT_comp_dir132	.byte	14                              # DW_FORM_strp133	.byte	17                              # DW_AT_low_pc134	.byte	1                               # DW_FORM_addr135	.byte	18                              # DW_AT_high_pc136	.byte	6                               # DW_FORM_data4137	.byte	0                               # EOM(1)138	.byte	0                               # EOM(2)139	.byte	2                               # Abbreviation Code140	.byte	52                              # DW_TAG_variable141	.byte	0                               # DW_CHILDREN_no142	.byte	73                              # DW_AT_type143	.byte	19                              # DW_FORM_ref4144	.byte	58                              # DW_AT_decl_file145	.byte	11                              # DW_FORM_data1146	.byte	59                              # DW_AT_decl_line147	.byte	11                              # DW_FORM_data1148	.byte	2                               # DW_AT_location149	.byte	24                              # DW_FORM_exprloc150	.byte	0                               # EOM(1)151	.byte	0                               # EOM(2)152	.byte	3                               # Abbreviation Code153	.byte	1                               # DW_TAG_array_type154	.byte	1                               # DW_CHILDREN_yes155	.byte	73                              # DW_AT_type156	.byte	19                              # DW_FORM_ref4157	.byte	0                               # EOM(1)158	.byte	0                               # EOM(2)159	.byte	4                               # Abbreviation Code160	.byte	33                              # DW_TAG_subrange_type161	.byte	0                               # DW_CHILDREN_no162	.byte	73                              # DW_AT_type163	.byte	19                              # DW_FORM_ref4164	.byte	55                              # DW_AT_count165	.byte	11                              # DW_FORM_data1166	.byte	0                               # EOM(1)167	.byte	0                               # EOM(2)168	.byte	5                               # Abbreviation Code169	.byte	36                              # DW_TAG_base_type170	.byte	0                               # DW_CHILDREN_no171	.byte	3                               # DW_AT_name172	.byte	14                              # DW_FORM_strp173	.byte	62                              # DW_AT_encoding174	.byte	11                              # DW_FORM_data1175	.byte	11                              # DW_AT_byte_size176	.byte	11                              # DW_FORM_data1177	.byte	0                               # EOM(1)178	.byte	0                               # EOM(2)179	.byte	6                               # Abbreviation Code180	.byte	36                              # DW_TAG_base_type181	.byte	0                               # DW_CHILDREN_no182	.byte	3                               # DW_AT_name183	.byte	14                              # DW_FORM_strp184	.byte	11                              # DW_AT_byte_size185	.byte	11                              # DW_FORM_data1186	.byte	62                              # DW_AT_encoding187	.byte	11                              # DW_FORM_data1188	.byte	0                               # EOM(1)189	.byte	0                               # EOM(2)190	.byte	7                               # Abbreviation Code191	.byte	46                              # DW_TAG_subprogram192	.byte	0                               # DW_CHILDREN_no193	.byte	3                               # DW_AT_name194	.byte	14                              # DW_FORM_strp195	.byte	58                              # DW_AT_decl_file196	.byte	11                              # DW_FORM_data1197	.byte	59                              # DW_AT_decl_line198	.byte	11                              # DW_FORM_data1199	.byte	32                              # DW_AT_inline200	.byte	11                              # DW_FORM_data1201	.byte	0                               # EOM(1)202	.byte	0                               # EOM(2)203	.byte	8                               # Abbreviation Code204	.byte	46                              # DW_TAG_subprogram205	.byte	1                               # DW_CHILDREN_yes206	.byte	17                              # DW_AT_low_pc207	.byte	1                               # DW_FORM_addr208	.byte	18                              # DW_AT_high_pc209	.byte	6                               # DW_FORM_data4210	.byte	64                              # DW_AT_frame_base211	.byte	24                              # DW_FORM_exprloc212	.ascii	"\227B"                         # DW_AT_GNU_all_call_sites213	.byte	25                              # DW_FORM_flag_present214	.byte	3                               # DW_AT_name215	.byte	14                              # DW_FORM_strp216	.byte	58                              # DW_AT_decl_file217	.byte	11                              # DW_FORM_data1218	.byte	59                              # DW_AT_decl_line219	.byte	11                              # DW_FORM_data1220	.byte	39                              # DW_AT_prototyped221	.byte	25                              # DW_FORM_flag_present222	.byte	73                              # DW_AT_type223	.byte	19                              # DW_FORM_ref4224	.byte	63                              # DW_AT_external225	.byte	25                              # DW_FORM_flag_present226	.byte	0                               # EOM(1)227	.byte	0                               # EOM(2)228	.byte	9                               # Abbreviation Code229	.byte	5                               # DW_TAG_formal_parameter230	.byte	0                               # DW_CHILDREN_no231	.byte	2                               # DW_AT_location232	.byte	23                              # DW_FORM_sec_offset233	.byte	3                               # DW_AT_name234	.byte	14                              # DW_FORM_strp235	.byte	58                              # DW_AT_decl_file236	.byte	11                              # DW_FORM_data1237	.byte	59                              # DW_AT_decl_line238	.byte	11                              # DW_FORM_data1239	.byte	73                              # DW_AT_type240	.byte	19                              # DW_FORM_ref4241	.byte	0                               # EOM(1)242	.byte	0                               # EOM(2)243	.byte	10                              # Abbreviation Code244	.byte	29                              # DW_TAG_inlined_subroutine245	.byte	0                               # DW_CHILDREN_no246	.byte	49                              # DW_AT_abstract_origin247	.byte	19                              # DW_FORM_ref4248	.byte	17                              # DW_AT_low_pc249	.byte	1                               # DW_FORM_addr250	.byte	18                              # DW_AT_high_pc251	.byte	6                               # DW_FORM_data4252	.byte	88                              # DW_AT_call_file253	.byte	11                              # DW_FORM_data1254	.byte	89                              # DW_AT_call_line255	.byte	11                              # DW_FORM_data1256	.byte	87                              # DW_AT_call_column257	.byte	11                              # DW_FORM_data1258	.byte	0                               # EOM(1)259	.byte	0                               # EOM(2)260	.byte	11                              # Abbreviation Code261	.ascii	"\211\202\001"                  # DW_TAG_GNU_call_site262	.byte	0                               # DW_CHILDREN_no263	.byte	49                              # DW_AT_abstract_origin264	.byte	19                              # DW_FORM_ref4265	.byte	17                              # DW_AT_low_pc266	.byte	1                               # DW_FORM_addr267	.byte	0                               # EOM(1)268	.byte	0                               # EOM(2)269	.byte	12                              # Abbreviation Code270	.byte	46                              # DW_TAG_subprogram271	.byte	1                               # DW_CHILDREN_yes272	.byte	3                               # DW_AT_name273	.byte	14                              # DW_FORM_strp274	.byte	58                              # DW_AT_decl_file275	.byte	11                              # DW_FORM_data1276	.byte	59                              # DW_AT_decl_line277	.byte	11                              # DW_FORM_data1278	.byte	39                              # DW_AT_prototyped279	.byte	25                              # DW_FORM_flag_present280	.byte	60                              # DW_AT_declaration281	.byte	25                              # DW_FORM_flag_present282	.byte	63                              # DW_AT_external283	.byte	25                              # DW_FORM_flag_present284	.byte	0                               # EOM(1)285	.byte	0                               # EOM(2)286	.byte	13                              # Abbreviation Code287	.byte	5                               # DW_TAG_formal_parameter288	.byte	0                               # DW_CHILDREN_no289	.byte	73                              # DW_AT_type290	.byte	19                              # DW_FORM_ref4291	.byte	0                               # EOM(1)292	.byte	0                               # EOM(2)293	.byte	14                              # Abbreviation Code294	.byte	15                              # DW_TAG_pointer_type295	.byte	0                               # DW_CHILDREN_no296	.byte	73                              # DW_AT_type297	.byte	19                              # DW_FORM_ref4298	.byte	0                               # EOM(1)299	.byte	0                               # EOM(2)300	.byte	15                              # Abbreviation Code301	.byte	38                              # DW_TAG_const_type302	.byte	0                               # DW_CHILDREN_no303	.byte	73                              # DW_AT_type304	.byte	19                              # DW_FORM_ref4305	.byte	0                               # EOM(1)306	.byte	0                               # EOM(2)307	.byte	0                               # EOM(3)308	.section	.debug_info,"",@progbits309.Lcu_begin0:310	.long	.Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit311.Ldebug_info_start0:312	.short	4                               # DWARF version number313	.long	.debug_abbrev                   # Offset Into Abbrev. Section314	.byte	8                               # Address Size (in bytes)315	.byte	1                               # Abbrev [1] 0xb:0xd4 DW_TAG_compile_unit316	.long	.Linfo_string0                  # DW_AT_producer317	.short	12                              # DW_AT_language318	.long	.Linfo_string1                  # DW_AT_name319	.long	.Lline_table_start0             # DW_AT_stmt_list320	.long	.Linfo_string2                  # DW_AT_comp_dir321	.quad	.Lfunc_begin0                   # DW_AT_low_pc322	.long	.Lfunc_end0-.Lfunc_begin0       # DW_AT_high_pc323	.byte	2                               # Abbrev [2] 0x2a:0x11 DW_TAG_variable324	.long	59                              # DW_AT_type325	.byte	1                               # DW_AT_decl_file326	.byte	4                               # DW_AT_decl_line327	.byte	9                               # DW_AT_location328	.byte	3329	.quad	.L.str330	.byte	3                               # Abbrev [3] 0x3b:0xc DW_TAG_array_type331	.long	71                              # DW_AT_type332	.byte	4                               # Abbrev [4] 0x40:0x6 DW_TAG_subrange_type333	.long	78                              # DW_AT_type334	.byte	3                               # DW_AT_count335	.byte	0                               # End Of Children Mark336	.byte	5                               # Abbrev [5] 0x47:0x7 DW_TAG_base_type337	.long	.Linfo_string3                  # DW_AT_name338	.byte	6                               # DW_AT_encoding339	.byte	1                               # DW_AT_byte_size340	.byte	6                               # Abbrev [6] 0x4e:0x7 DW_TAG_base_type341	.long	.Linfo_string4                  # DW_AT_name342	.byte	8                               # DW_AT_byte_size343	.byte	7                               # DW_AT_encoding344	.byte	7                               # Abbrev [7] 0x55:0x8 DW_TAG_subprogram345	.long	.Linfo_string5                  # DW_AT_name346	.byte	1                               # DW_AT_decl_file347	.byte	3                               # DW_AT_decl_line348	.byte	1                               # DW_AT_inline349	.byte	8                               # Abbrev [8] 0x5d:0x59 DW_TAG_subprogram350	.quad	.Lfunc_begin0                   # DW_AT_low_pc351	.long	.Lfunc_end0-.Lfunc_begin0       # DW_AT_high_pc352	.byte	1                               # DW_AT_frame_base353	.byte	87354                                        # DW_AT_GNU_all_call_sites355	.long	.Linfo_string7                  # DW_AT_name356	.byte	1                               # DW_AT_decl_file357	.byte	7                               # DW_AT_decl_line358                                        # DW_AT_prototyped359	.long	205                             # DW_AT_type360                                        # DW_AT_external361	.byte	9                               # Abbrev [9] 0x76:0xf DW_TAG_formal_parameter362	.long	.Ldebug_loc0                    # DW_AT_location363	.long	.Linfo_string9                  # DW_AT_name364	.byte	1                               # DW_AT_decl_file365	.byte	7                               # DW_AT_decl_line366	.long	205                             # DW_AT_type367	.byte	9                               # Abbrev [9] 0x85:0xf DW_TAG_formal_parameter368	.long	.Ldebug_loc1                    # DW_AT_location369	.long	.Linfo_string10                 # DW_AT_name370	.byte	1                               # DW_AT_decl_file371	.byte	7                               # DW_AT_decl_line372	.long	212                             # DW_AT_type373	.byte	10                              # Abbrev [10] 0x94:0x14 DW_TAG_inlined_subroutine374	.long	85                              # DW_AT_abstract_origin375	.quad	.Ltmp2                          # DW_AT_low_pc376	.long	.Ltmp5-.Ltmp2                   # DW_AT_high_pc377	.byte	1                               # DW_AT_call_file378	.byte	9                               # DW_AT_call_line379	.byte	5                               # DW_AT_call_column380	.byte	11                              # Abbrev [11] 0xa8:0xd DW_TAG_GNU_call_site381	.long	182                             # DW_AT_abstract_origin382	.quad	.Ltmp4                          # DW_AT_low_pc383	.byte	0                               # End Of Children Mark384	.byte	12                              # Abbrev [12] 0xb6:0xd DW_TAG_subprogram385	.long	.Linfo_string6                  # DW_AT_name386	.byte	1                               # DW_AT_decl_file387	.byte	1                               # DW_AT_decl_line388                                        # DW_AT_prototyped389                                        # DW_AT_declaration390                                        # DW_AT_external391	.byte	13                              # Abbrev [13] 0xbd:0x5 DW_TAG_formal_parameter392	.long	195                             # DW_AT_type393	.byte	0                               # End Of Children Mark394	.byte	14                              # Abbrev [14] 0xc3:0x5 DW_TAG_pointer_type395	.long	200                             # DW_AT_type396	.byte	15                              # Abbrev [15] 0xc8:0x5 DW_TAG_const_type397	.long	71                              # DW_AT_type398	.byte	5                               # Abbrev [5] 0xcd:0x7 DW_TAG_base_type399	.long	.Linfo_string8                  # DW_AT_name400	.byte	5                               # DW_AT_encoding401	.byte	4                               # DW_AT_byte_size402	.byte	14                              # Abbrev [14] 0xd4:0x5 DW_TAG_pointer_type403	.long	217                             # DW_AT_type404	.byte	14                              # Abbrev [14] 0xd9:0x5 DW_TAG_pointer_type405	.long	71                              # DW_AT_type406	.byte	0                               # End Of Children Mark407.Ldebug_info_end0:408	.section	.debug_str,"MS",@progbits,1409.Linfo_string0:410	.asciz	"clang version 15.0.7                                                " # string offset=0411.Linfo_string1:412	.asciz	"unreachable.c"                 # string offset=69413.Linfo_string2:414	.asciz	"."                             # string offset=83415.Linfo_string3:416	.asciz	"char"                          # string offset=85417.Linfo_string4:418	.asciz	"__ARRAY_SIZE_TYPE__"           # string offset=90419.Linfo_string5:420	.asciz	"foo"                           # string offset=110421.Linfo_string6:422	.asciz	"puts"                          # string offset=114423.Linfo_string7:424	.asciz	"main"                          # string offset=119425.Linfo_string8:426	.asciz	"int"                           # string offset=124427.Linfo_string9:428	.asciz	"argc"                          # string offset=128429.Linfo_string10:430	.asciz	"argv"                          # string offset=133431	.section	.debug_line,"",@progbits432.Lline_table_start0:433