brintos

brintos / llvm-project-archived public Read only

0
0
Text · 13.0 KiB · f00efd5 Raw
305 lines · plain
1# REQUIRES: system-linux2 3# RUN: llvm-mc --filetype=obj --triple x86_64 %s -o %tmain.o --defsym MAIN=04# RUN: llvm-mc --filetype=obj --triple x86_64 %s -o %thelper.o5# RUN: %clang %cflags %tmain.o %thelper.o -o %tmain.exe6# RUN: llvm-bolt %tmain.exe -o %tmain.exe.bolt --update-debug-sections --debug-thread-count=4 --cu-processing-batch-size=47# RUN: llvm-dwarfdump --debug-info %tmain.exe.bolt > %tout.text8# RUN: llvm-dwarfdump --show-section-sizes %tmain.exe >> %tout.text9# RUN: llvm-dwarfdump --show-section-sizes %tmain.exe.bolt >> %tout.text10# RUN: cat %tout.text | FileCheck %s11 12## This test checks that with DWARF5 when two CUs share the same .debug_str_offsets13## entry BOLT does not create a duplicate.14 15# CHECK: DW_AT_str_offsets_base (0x[[#%.8x,ADDR:]]16# CHECK: DW_AT_str_offsets_base (0x[[#ADDR]]17 18# CHECK: .debug_str_offsets [[#ADDR2:]]19# CHECK: .debug_str_offsets [[#ADDR2]]20 21# main.cpp22# int main(){23# 	return 0;24# }25 26# helper.cpp27# void foo(){}28 29## Create two CUs, with dwo_ids 0 and 1 respectively.30.ifdef MAIN31.text32	.file	"main.cpp"33	.globl	main                            # -- Begin function main34	.p2align	4, 0x9035	.type	main,@function36main:                                   # @main37.Lfunc_begin0:38	.file	0 "." "main.cpp" md5 0x32c197b0a8b855eb3d7573c993ada86239	.loc	0 1 0                           # main.cpp:1:040	.cfi_startproc41# %bb.0:42	pushq	%rbp43	.cfi_def_cfa_offset 1644	.cfi_offset %rbp, -1645	movq	%rsp, %rbp46	.cfi_def_cfa_register %rbp47	movl	$0, -4(%rbp)48.Ltmp0:49	.loc	0 2 1 prologue_end              # main.cpp:2:150	xorl	%eax, %eax51	popq	%rbp52	.cfi_def_cfa %rsp, 853	retq54.Ltmp1:55.Lfunc_end0:56	.size	main, .Lfunc_end0-main57	.cfi_endproc58                                        # -- End function59	.section	.debug_abbrev,"",@progbits60	.byte	1                               # Abbreviation Code61	.byte	17                              # DW_TAG_compile_unit62	.byte	1                               # DW_CHILDREN_yes63	.byte	37                              # DW_AT_producer64	.byte	37                              # DW_FORM_strx165	.byte	19                              # DW_AT_language66	.byte	5                               # DW_FORM_data267	.byte	3                               # DW_AT_name68	.byte	37                              # DW_FORM_strx169	.byte	114                             # DW_AT_str_offsets_base70	.byte	23                              # DW_FORM_sec_offset71	.byte	16                              # DW_AT_stmt_list72	.byte	23                              # DW_FORM_sec_offset73	.byte	27                              # DW_AT_comp_dir74	.byte	37                              # DW_FORM_strx175	.byte	17                              # DW_AT_low_pc76	.byte	27                              # DW_FORM_addrx77	.byte	18                              # DW_AT_high_pc78	.byte	6                               # DW_FORM_data479	.byte	115                             # DW_AT_addr_base80	.byte	23                              # DW_FORM_sec_offset81	.byte	0                               # EOM(1)82	.byte	0                               # EOM(2)83	.byte	2                               # Abbreviation Code84	.byte	46                              # DW_TAG_subprogram85	.byte	0                               # DW_CHILDREN_no86	.byte	17                              # DW_AT_low_pc87	.byte	27                              # DW_FORM_addrx88	.byte	18                              # DW_AT_high_pc89	.byte	6                               # DW_FORM_data490	.byte	64                              # DW_AT_frame_base91	.byte	24                              # DW_FORM_exprloc92	.byte	3                               # DW_AT_name93	.byte	37                              # DW_FORM_strx194	.byte	58                              # DW_AT_decl_file95	.byte	11                              # DW_FORM_data196	.byte	59                              # DW_AT_decl_line97	.byte	11                              # DW_FORM_data198	.byte	73                              # DW_AT_type99	.byte	19                              # DW_FORM_ref4100	.byte	63                              # DW_AT_external101	.byte	25                              # DW_FORM_flag_present102	.byte	0                               # EOM(1)103	.byte	0                               # EOM(2)104	.byte	3                               # Abbreviation Code105	.byte	36                              # DW_TAG_base_type106	.byte	0                               # DW_CHILDREN_no107	.byte	3                               # DW_AT_name108	.byte	37                              # DW_FORM_strx1109	.byte	62                              # DW_AT_encoding110	.byte	11                              # DW_FORM_data1111	.byte	11                              # DW_AT_byte_size112	.byte	11                              # DW_FORM_data1113	.byte	0                               # EOM(1)114	.byte	0                               # EOM(2)115	.byte	0                               # EOM(3)116	.section	.debug_info,"",@progbits117.Lcu_begin0:118	.long	.Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit119.Ldebug_info_start0:120	.short	5                               # DWARF version number121	.byte	1                               # DWARF Unit Type122	.byte	8                               # Address Size (in bytes)123	.long	.debug_abbrev                   # Offset Into Abbrev. Section124	.byte	1                               # Abbrev [1] 0xc:0x2b DW_TAG_compile_unit125	.byte	0                               # DW_AT_producer126	.short	33                              # DW_AT_language127	.byte	1                               # DW_AT_name128	.long	.Lstr_offsets_base0             # DW_AT_str_offsets_base129	.long	.Lline_table_start0             # DW_AT_stmt_list130	.byte	2                               # DW_AT_comp_dir131	.byte	0                               # DW_AT_low_pc132	.long	.Lfunc_end0-.Lfunc_begin0       # DW_AT_high_pc133	.long	.Laddr_table_base0              # DW_AT_addr_base134	.byte	2                               # Abbrev [2] 0x23:0xf DW_TAG_subprogram135	.byte	0                               # DW_AT_low_pc136	.long	.Lfunc_end0-.Lfunc_begin0       # DW_AT_high_pc137	.byte	1                               # DW_AT_frame_base138	.byte	86139	.byte	3                               # DW_AT_name140	.byte	0                               # DW_AT_decl_file141	.byte	1                               # DW_AT_decl_line142	.long	50                              # DW_AT_type143                                        # DW_AT_external144	.byte	3                               # Abbrev [3] 0x32:0x4 DW_TAG_base_type145	.byte	4                               # DW_AT_name146	.byte	5                               # DW_AT_encoding147	.byte	4                               # DW_AT_byte_size148	.byte	0                               # End Of Children Mark149.Ldebug_info_end0:150	.section	.debug_str_offsets,"",@progbits151	.long	24                              # Length of String Offsets Set152	.short	5153	.short	0154.Lstr_offsets_base0:155	.section	.debug_str,"MS",@progbits,1156.Linfo_string0:157	.asciz	"clang version 15.0.0" # string offset=0158.Linfo_string1:159	.asciz	"main.cpp"                      # string offset=146160.Linfo_string2:161	.asciz	"." # string offset=155162.Linfo_string3:163	.asciz	"main"                          # string offset=198164.Linfo_string4:165	.asciz	"int"                           # string offset=203166	.section	.debug_str_offsets,"",@progbits167	.long	.Linfo_string0168	.long	.Linfo_string1169	.long	.Linfo_string2170	.long	.Linfo_string3171	.long	.Linfo_string4172	.section	.debug_addr,"",@progbits173	.long	.Ldebug_addr_end0-.Ldebug_addr_start0 # Length of contribution174.Ldebug_addr_start0:175	.short	5                               # DWARF version number176	.byte	8                               # Address size177	.byte	0                               # Segment selector size178.Laddr_table_base0:179	.quad	.Lfunc_begin0180.Ldebug_addr_end0:181	.ident	"clang version 15.0.0"182	.section	".note.GNU-stack","",@progbits183	.addrsig184	.section	.debug_line,"",@progbits185.Lline_table_start0:186.else187.text188	.file	"helper.cpp"189	.globl	_Z3foov                         # -- Begin function _Z3foov190	.p2align	4, 0x90191	.type	_Z3foov,@function192_Z3foov:                                # @_Z3foov193.Lfunc_begin0:194	.file	0 "." "helper.cpp" md5 0x5f98e4807e4f8781c26a82faf819f8a7195	.loc	0 1 0                           # helper.cpp:1:0196	.cfi_startproc197# %bb.0:198	pushq	%rbp199	.cfi_def_cfa_offset 16200	.cfi_offset %rbp, -16201	movq	%rsp, %rbp202	.cfi_def_cfa_register %rbp203.Ltmp0:204	.loc	0 1 12 prologue_end             # helper.cpp:1:12205	popq	%rbp206	.cfi_def_cfa %rsp, 8207	retq208.Ltmp1:209.Lfunc_end0:210	.size	_Z3foov, .Lfunc_end0-_Z3foov211	.cfi_endproc212                                        # -- End function213	.section	.debug_abbrev,"",@progbits214	.byte	1                               # Abbreviation Code215	.byte	17                              # DW_TAG_compile_unit216	.byte	1                               # DW_CHILDREN_yes217	.byte	37                              # DW_AT_producer218	.byte	37                              # DW_FORM_strx1219	.byte	19                              # DW_AT_language220	.byte	5                               # DW_FORM_data2221	.byte	3                               # DW_AT_name222	.byte	37                              # DW_FORM_strx1223	.byte	114                             # DW_AT_str_offsets_base224	.byte	23                              # DW_FORM_sec_offset225	.byte	16                              # DW_AT_stmt_list226	.byte	23                              # DW_FORM_sec_offset227	.byte	27                              # DW_AT_comp_dir228	.byte	37                              # DW_FORM_strx1229	.byte	17                              # DW_AT_low_pc230	.byte	27                              # DW_FORM_addrx231	.byte	18                              # DW_AT_high_pc232	.byte	6                               # DW_FORM_data4233	.byte	115                             # DW_AT_addr_base234	.byte	23                              # DW_FORM_sec_offset235	.byte	0                               # EOM(1)236	.byte	0                               # EOM(2)237	.byte	2                               # Abbreviation Code238	.byte	46                              # DW_TAG_subprogram239	.byte	0                               # DW_CHILDREN_no240	.byte	17                              # DW_AT_low_pc241	.byte	27                              # DW_FORM_addrx242	.byte	18                              # DW_AT_high_pc243	.byte	6                               # DW_FORM_data4244	.byte	64                              # DW_AT_frame_base245	.byte	24                              # DW_FORM_exprloc246	.byte	110                             # DW_AT_linkage_name247	.byte	37                              # DW_FORM_strx1248	.byte	3                               # DW_AT_name249	.byte	37                              # DW_FORM_strx1250	.byte	58                              # DW_AT_decl_file251	.byte	11                              # DW_FORM_data1252	.byte	59                              # DW_AT_decl_line253	.byte	11                              # DW_FORM_data1254	.byte	63                              # DW_AT_external255	.byte	25                              # DW_FORM_flag_present256	.byte	0                               # EOM(1)257	.byte	0                               # EOM(2)258	.byte	0                               # EOM(3)259	.section	.debug_info,"",@progbits260.Lcu_begin0:261	.long	.Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit262.Ldebug_info_start0:263	.short	5                               # DWARF version number264	.byte	1                               # DWARF Unit Type265	.byte	8                               # Address Size (in bytes)266	.long	.debug_abbrev                   # Offset Into Abbrev. Section267	.byte	1                               # Abbrev [1] 0xc:0x24 DW_TAG_compile_unit268	.byte	0                               # DW_AT_producer269	.short	33                              # DW_AT_language270	.byte	1                               # DW_AT_name271	.long	0x8				                # DW_AT_str_offsets_base Manually modified to be the same as first CU272	.long	.Lline_table_start0             # DW_AT_stmt_list273	.byte	2                               # DW_AT_comp_dir274	.byte	0                               # DW_AT_low_pc275	.long	.Lfunc_end0-.Lfunc_begin0       # DW_AT_high_pc276	.long	.Laddr_table_base0              # DW_AT_addr_base277	.byte	2                               # Abbrev [2] 0x23:0xc DW_TAG_subprogram278	.byte	0                               # DW_AT_low_pc279	.long	.Lfunc_end0-.Lfunc_begin0       # DW_AT_high_pc280	.byte	1                               # DW_AT_frame_base281	.byte	86282	.byte	3                               # DW_AT_linkage_name283	.byte	4                               # DW_AT_name284	.byte	0                               # DW_AT_decl_file285	.byte	1                               # DW_AT_decl_line286                                        # DW_AT_external287	.byte	0                               # End Of Children Mark288.Ldebug_info_end0:289# Manually removed .debug_str_offsets and .debug_str290	.section	.debug_addr,"",@progbits291	.long	.Ldebug_addr_end0-.Ldebug_addr_start0 # Length of contribution292.Ldebug_addr_start0:293	.short	5                               # DWARF version number294	.byte	8                               # Address size295	.byte	0                               # Segment selector size296.Laddr_table_base0:297	.quad	.Lfunc_begin0298.Ldebug_addr_end0:299	.ident	"clang version 15.0.0"300	.section	".note.GNU-stack","",@progbits301	.addrsig302	.section	.debug_line,"",@progbits303.Lline_table_start0:304.endif305