292 lines · plain
1# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %s -o %tmain.o2# RUN: %clang %cflags -gdwarf-5 %tmain.o -o %tmain.exe3# RUN: llvm-bolt %tmain.exe -o %tmain.exe.bolt --update-debug-sections4# RUN: llvm-dwarfdump --debug-names --debug-info %tmain.exe.bolt > %tlog.txt5# RUN: cat %tlog.txt | FileCheck -check-prefix=BOLT %s6 7## This test checks that BOLT correctly generates .debug_names section when there is DW_TAG_variable8## with DW_OP_GNU_push_tls_address in DW_AT_location.9 10# BOLT: [[DIEOFFSET:0x[0-9a-f]*]]: DW_TAG_variable11# BOLT-NEXT: DW_AT_name ("x")12# BOLT-NEXT: DW_AT_type ({{.+}} "int")13# BOLT-NEXT: DW_AT_external (true)14# BOLT-NEXT: DW_AT_decl_file ("gnu_tls_push/main.cpp")15# BOLT-NEXT: DW_AT_decl_line (1)16# BOLT-NEXT: DW_AT_location (DW_OP_const8u 0x0, DW_OP_GNU_push_tls_address)17# BOLT: Hash: 0x2B61D18# BOLT-NEXT: String: {{.+}} "x"19# BOLT-NEXT: Entry @ {{.+}} {20# BOLT-NEXT: Abbrev: {{.+}}21# BOLT-NEXT: Tag: DW_TAG_variable22# BOLT-NEXT: DW_IDX_die_offset: [[DIEOFFSET]]23# BOLT-NEXT: DW_IDX_parent: <parent not indexed>24 25## thread_local int x = 0;26## int main() {27## x = 10;28## return x;29## }30 .file "main.cpp"31 .file 0 "gnu_tls_push" "main.cpp" md5 0x551db97d5e23dc6a81abdc5ade4d9d7132 .globl main33 .type main,@function34main:35.Lfunc_begin0:36 .loc 0 2 037 .loc 0 3 3 prologue_end38 .loc 0 3 5 is_stmt 039 .loc 0 4 10 is_stmt 140 .loc 0 4 3 epilogue_begin is_stmt 041 retq42.Lfunc_end0:43 .size main, .Lfunc_end0-main44 45 .hidden _ZTW1x46 .weak _ZTW1x47 .type _ZTW1x,@function48_ZTW1x:49.Lfunc_begin1:50 retq51.Lfunc_end1:52 .size _ZTW1x, .Lfunc_end1-_ZTW1x53 54 .type x,@object55 .section .tbss,"awT",@nobits56 .globl x57x:58 .long 059 .size x, 460 61 .section .debug_abbrev,"",@progbits62 .byte 1 # Abbreviation Code63 .byte 17 # DW_TAG_compile_unit64 .byte 1 # DW_CHILDREN_yes65 .byte 37 # DW_AT_producer66 .byte 37 # DW_FORM_strx167 .byte 19 # DW_AT_language68 .byte 5 # DW_FORM_data269 .byte 3 # DW_AT_name70 .byte 37 # DW_FORM_strx171 .byte 114 # DW_AT_str_offsets_base72 .byte 23 # DW_FORM_sec_offset73 .byte 16 # DW_AT_stmt_list74 .byte 23 # DW_FORM_sec_offset75 .byte 27 # DW_AT_comp_dir76 .byte 37 # DW_FORM_strx177 .byte 17 # DW_AT_low_pc78 .byte 27 # DW_FORM_addrx79 .byte 18 # DW_AT_high_pc80 .byte 6 # DW_FORM_data481 .byte 115 # DW_AT_addr_base82 .byte 23 # DW_FORM_sec_offset83 .byte 0 # EOM(1)84 .byte 0 # EOM(2)85 .byte 2 # Abbreviation Code86 .byte 52 # DW_TAG_variable87 .byte 0 # DW_CHILDREN_no88 .byte 3 # DW_AT_name89 .byte 37 # DW_FORM_strx190 .byte 73 # DW_AT_type91 .byte 19 # DW_FORM_ref492 .byte 63 # DW_AT_external93 .byte 25 # DW_FORM_flag_present94 .byte 58 # DW_AT_decl_file95 .byte 11 # DW_FORM_data196 .byte 59 # DW_AT_decl_line97 .byte 11 # DW_FORM_data198 .byte 2 # DW_AT_location99 .byte 24 # DW_FORM_exprloc100 .byte 0 # EOM(1)101 .byte 0 # EOM(2)102 .byte 3 # Abbreviation Code103 .byte 36 # DW_TAG_base_type104 .byte 0 # DW_CHILDREN_no105 .byte 3 # DW_AT_name106 .byte 37 # DW_FORM_strx1107 .byte 62 # DW_AT_encoding108 .byte 11 # DW_FORM_data1109 .byte 11 # DW_AT_byte_size110 .byte 11 # DW_FORM_data1111 .byte 0 # EOM(1)112 .byte 0 # EOM(2)113 .byte 4 # Abbreviation Code114 .byte 46 # DW_TAG_subprogram115 .byte 0 # DW_CHILDREN_no116 .byte 17 # DW_AT_low_pc117 .byte 27 # DW_FORM_addrx118 .byte 18 # DW_AT_high_pc119 .byte 6 # DW_FORM_data4120 .byte 64 # DW_AT_frame_base121 .byte 24 # DW_FORM_exprloc122 .byte 3 # DW_AT_name123 .byte 37 # DW_FORM_strx1124 .byte 58 # DW_AT_decl_file125 .byte 11 # DW_FORM_data1126 .byte 59 # DW_AT_decl_line127 .byte 11 # DW_FORM_data1128 .byte 73 # DW_AT_type129 .byte 19 # DW_FORM_ref4130 .byte 63 # DW_AT_external131 .byte 25 # DW_FORM_flag_present132 .byte 0 # EOM(1)133 .byte 0 # EOM(2)134 .byte 0 # EOM(3)135 .section .debug_info,"",@progbits136.Lcu_begin0:137 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit138.Ldebug_info_start0:139 .short 5 # DWARF version number140 .byte 1 # DWARF Unit Type141 .byte 8 # Address Size (in bytes)142 .long .debug_abbrev # Offset Into Abbrev. Section143 .byte 1 # Abbrev [1] 0xc:0x3e DW_TAG_compile_unit144 .byte 0 # DW_AT_producer145 .short 33 # DW_AT_language146 .byte 1 # DW_AT_name147 .long .Lstr_offsets_base0 # DW_AT_str_offsets_base148 .long .Lline_table_start0 # DW_AT_stmt_list149 .byte 2 # DW_AT_comp_dir150 .byte 0 # DW_AT_low_pc151 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc152 .long .Laddr_table_base0 # DW_AT_addr_base153 .byte 2 # Abbrev [2] 0x23:0x13 DW_TAG_variable154 .byte 3 # DW_AT_name155 .long 54 # DW_AT_type156 # DW_AT_external157 .byte 0 # DW_AT_decl_file158 .byte 1 # DW_AT_decl_line159 .byte 10 # DW_AT_location160 .byte 14161 .quad x@DTPOFF162 .byte 224163 .byte 3 # Abbrev [3] 0x36:0x4 DW_TAG_base_type164 .byte 4 # DW_AT_name165 .byte 5 # DW_AT_encoding166 .byte 4 # DW_AT_byte_size167 .byte 4 # Abbrev [4] 0x3a:0xf DW_TAG_subprogram168 .byte 0 # DW_AT_low_pc169 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc170 .byte 1 # DW_AT_frame_base171 .byte 86172 .byte 5 # DW_AT_name173 .byte 0 # DW_AT_decl_file174 .byte 2 # DW_AT_decl_line175 .long 54 # DW_AT_type176 # DW_AT_external177 .byte 0 # End Of Children Mark178.Ldebug_info_end0:179 .section .debug_str_offsets,"",@progbits180 .long 28 # Length of String Offsets Set181 .short 5182 .short 0183.Lstr_offsets_base0:184 .section .debug_str,"MS",@progbits,1185.Linfo_string0:186 .asciz "clang version 17.0.4" # string offset=0187.Linfo_string1:188 .asciz "main.cpp" # string offset=137189.Linfo_string2:190 .asciz "gnu_tls_push" # string offset=146191.Linfo_string3:192 .asciz "x" # string offset=184193.Linfo_string4:194 .asciz "int" # string offset=186195.Linfo_string5:196 .asciz "main" # string offset=190197 .section .debug_str_offsets,"",@progbits198 .long .Linfo_string0199 .long .Linfo_string1200 .long .Linfo_string2201 .long .Linfo_string3202 .long .Linfo_string4203 .long .Linfo_string5204 .section .debug_addr,"",@progbits205 .long .Ldebug_addr_end0-.Ldebug_addr_start0 # Length of contribution206.Ldebug_addr_start0:207 .short 5 # DWARF version number208 .byte 8 # Address size209 .byte 0 # Segment selector size210.Laddr_table_base0:211 .quad .Lfunc_begin0212.Ldebug_addr_end0:213 .section .debug_names,"",@progbits214 .long .Lnames_end0-.Lnames_start0 # Header: unit length215.Lnames_start0:216 .short 5 # Header: version217 .short 0 # Header: padding218 .long 1 # Header: compilation unit count219 .long 0 # Header: local type unit count220 .long 0 # Header: foreign type unit count221 .long 3 # Header: bucket count222 .long 3 # Header: name count223 .long .Lnames_abbrev_end0-.Lnames_abbrev_start0 # Header: abbreviation table size224 .long 8 # Header: augmentation string size225 .ascii "LLVM0700" # Header: augmentation string226 .long .Lcu_begin0 # Compilation unit 0227 .long 1 # Bucket 0228 .long 2 # Bucket 1229 .long 3 # Bucket 2230 .long 177693 # Hash in Bucket 0231 .long 2090499946 # Hash in Bucket 1232 .long 193495088 # Hash in Bucket 2233 .long .Linfo_string3 # String in Bucket 0: x234 .long .Linfo_string5 # String in Bucket 1: main235 .long .Linfo_string4 # String in Bucket 2: int236 .long .Lnames1-.Lnames_entries0 # Offset in Bucket 0237 .long .Lnames2-.Lnames_entries0 # Offset in Bucket 1238 .long .Lnames0-.Lnames_entries0 # Offset in Bucket 2239.Lnames_abbrev_start0:240 .byte 1 # Abbrev code241 .byte 52 # DW_TAG_variable242 .byte 3 # DW_IDX_die_offset243 .byte 19 # DW_FORM_ref4244 .byte 4 # DW_IDX_parent245 .byte 25 # DW_FORM_flag_present246 .byte 0 # End of abbrev247 .byte 0 # End of abbrev248 .byte 2 # Abbrev code249 .byte 46 # DW_TAG_subprogram250 .byte 3 # DW_IDX_die_offset251 .byte 19 # DW_FORM_ref4252 .byte 4 # DW_IDX_parent253 .byte 25 # DW_FORM_flag_present254 .byte 0 # End of abbrev255 .byte 0 # End of abbrev256 .byte 3 # Abbrev code257 .byte 36 # DW_TAG_base_type258 .byte 3 # DW_IDX_die_offset259 .byte 19 # DW_FORM_ref4260 .byte 4 # DW_IDX_parent261 .byte 25 # DW_FORM_flag_present262 .byte 0 # End of abbrev263 .byte 0 # End of abbrev264 .byte 0 # End of abbrev list265.Lnames_abbrev_end0:266.Lnames_entries0:267.Lnames1:268.L2:269 .byte 1 # Abbreviation code270 .long 35 # DW_IDX_die_offset271 .byte 0 # DW_IDX_parent272 # End of list: x273.Lnames2:274.L0:275 .byte 2 # Abbreviation code276 .long 58 # DW_IDX_die_offset277 .byte 0 # DW_IDX_parent278 # End of list: main279.Lnames0:280.L1:281 .byte 3 # Abbreviation code282 .long 54 # DW_IDX_die_offset283 .byte 0 # DW_IDX_parent284 # End of list: int285 .p2align 2, 0x0286.Lnames_end0:287 .ident "clang version 17.0.4 (https://git.internal.tfbnw.net/repos/git/rw/osmeta/external/llvm-project 8d1fd9f463cb31caf429b83cf7a5baea5f67e54a)"288 .section ".note.GNU-stack","",@progbits289 .addrsig290 .section .debug_line,"",@progbits291.Lline_table_start0:292