1# RUN: llvm-mc -triple x86_64-apple-darwin %s -filetype=obj -o %t.o 2# RUN: not llvm-dwarfdump -verify %t.o 2>&1 | FileCheck %s 3 4# CHECK: error: Subprogram with call site entry has no DW_AT_call attribute: 5# CHECK: DW_TAG_subprogram 6# CHECK: DW_AT_name ("main") 7# CHECK: DW_TAG_call_site 8# CHECK: DW_AT_call_origin 9# CHECK: Errors detected. 10 11# Source: 12## define void @foo() !dbg !25 { 13## ret void, !dbg !28 14## } 15## 16## define i32 @main() !dbg !29 { 17## call void @foo(), !dbg !32 18## ret i32 0, !dbg !33 19## } 20## 21## !llvm.dbg.cu = !{!2} 22## !llvm.module.flags = !{!8, !9, !10, !11} 23## !llvm.ident = !{!12} 24## 25## !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) 26## !1 = distinct !DIGlobalVariable(name: "sink", scope: !2, file: !3, line: 1, type: !6, isLocal: false, isDefinition: true) 27## !2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 7.0.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5) 28## !3 = !DIFile(filename: "/Users/vsk/src/llvm.org-tailcall/tail2.cc", directory: "/Users/vsk/src/builds/llvm-project-tailcall-RA", checksumkind: CSK_MD5, checksum: "3b61952c21b7f657ddb7c0ad44cf5529") 29## !4 = !{} 30## !5 = !{!0} 31## !6 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !7) 32## !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 33## !8 = !{i32 2, !"Dwarf Version", i32 5} 34## !9 = !{i32 2, !"Debug Info Version", i32 3} 35## !10 = !{i32 1, !"wchar_size", i32 4} 36## !11 = !{i32 7, !"PIC Level", i32 2} 37## !12 = !{!"clang version 7.0.0 "} 38## !13 = distinct !DISubprogram(name: "bat", linkageName: "_Z3batv", scope: !3, file: !3, line: 2, type: !14, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, isOptimized: true, unit: !2, retainedNodes: !4) 39## !14 = !DISubroutineType(types: !15) 40## !15 = !{null} 41## !16 = !DILocation(line: 2, column: 44, scope: !13) 42## !17 = !{!18, !18, i64 0} 43## !18 = !{!"int", !19, i64 0} 44## !19 = !{!"omnipotent char", !20, i64 0} 45## !20 = !{!"Simple C++ TBAA"} 46## !21 = !DILocation(line: 2, column: 48, scope: !13) 47## !22 = distinct !DISubprogram(name: "bar", linkageName: "_Z3barv", scope: !3, file: !3, line: 3, type: !14, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, isOptimized: true, unit: !2, retainedNodes: !4) 48## !23 = !DILocation(line: 3, column: 44, scope: !22) 49## !24 = !DILocation(line: 3, column: 48, scope: !22) 50## !25 = distinct !DISubprogram(name: "foo", linkageName: "_Z3foov", scope: !3, file: !3, line: 4, type: !14, isLocal: false, isDefinition: true, scopeLine: 4, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, isOptimized: true, unit: !2, retainedNodes: !4) 51## !26 = !DILocation(line: 5, column: 3, scope: !25) 52## !27 = !DILocation(line: 6, column: 3, scope: !25) 53## !28 = !DILocation(line: 7, column: 1, scope: !25) 54## !29 = distinct !DISubprogram(name: "main", scope: !3, file: !3, line: 8, type: !30, isLocal: false, isDefinition: true, scopeLine: 8, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, isOptimized: true, unit: !2, retainedNodes: !4) 55## !30 = !DISubroutineType(types: !31) 56## !31 = !{!7} 57## !32 = !DILocation(line: 8, column: 50, scope: !29) 58## !33 = !DILocation(line: 8, column: 57, scope: !29) 59 60 .section __TEXT,__text,regular,pure_instructions 61 .globl _foo ## -- Begin function foo 62_foo: ## @foo 63Lfunc_begin0: 64 .cfi_startproc 65## %bb.0: 66 retq 67Ltmp0: 68Lfunc_end0: 69 .cfi_endproc 70 ## -- End function 71 .globl _main ## -- Begin function main 72_main: ## @main 73Lfunc_begin1: 74 .cfi_startproc 75## %bb.0: 76 pushq %rax 77 .cfi_def_cfa_offset 16 78Ltmp1: 79 callq _foo 80 xorl %eax, %eax 81 popq %rcx 82 retq 83Ltmp2: 84Lfunc_end1: 85 .cfi_endproc 86 ## -- End function 87 .section __DWARF,__debug_str_offs,regular,debug 88Lsection_str_off: 89 .long 36 90 .short 5 91 .short 0 92Lstr_offsets_base0: 93 .section __DWARF,__debug_str,regular,debug 94Linfo_string: 95 .asciz "clang version 7.0.0 " ## string offset=0 96 .asciz "/Users/vsk/src/llvm.org-tailcall/tail2.cc" ## string offset=21 97 .asciz "/Users/vsk/src/builds/llvm-project-tailcall-RA" ## string offset=63 98 .asciz "sink" ## string offset=110 99 .asciz "int" ## string offset=115 100 .asciz "foo" ## string offset=119 101 .asciz "_Z3foov" ## string offset=123 102 .asciz "main" ## string offset=131 103 .section __DWARF,__debug_str_offs,regular,debug 104 .long 0 105 .long 21 106 .long 63 107 .long 110 108 .long 115 109 .long 119 110 .long 123 111 .long 131 112 .section __DWARF,__debug_abbrev,regular,debug 113Lsection_abbrev: 114 .byte 1 ## Abbreviation Code 115 .byte 17 ## DW_TAG_compile_unit 116 .byte 1 ## DW_CHILDREN_yes 117 .byte 37 ## DW_AT_producer 118 .byte 37 ## DW_FORM_strx1 119 .byte 19 ## DW_AT_language 120 .byte 5 ## DW_FORM_data2 121 .byte 3 ## DW_AT_name 122 .byte 37 ## DW_FORM_strx1 123 .byte 114 ## DW_AT_str_offsets_base 124 .byte 23 ## DW_FORM_sec_offset 125 .byte 16 ## DW_AT_stmt_list 126 .byte 23 ## DW_FORM_sec_offset 127 .byte 27 ## DW_AT_comp_dir 128 .byte 37 ## DW_FORM_strx1 129 .ascii "\341\177" ## DW_AT_APPLE_optimized 130 .byte 25 ## DW_FORM_flag_present 131 .byte 17 ## DW_AT_low_pc 132 .byte 1 ## DW_FORM_addr 133 .byte 18 ## DW_AT_high_pc 134 .byte 6 ## DW_FORM_data4 135 .byte 0 ## EOM(1) 136 .byte 0 ## EOM(2) 137 .byte 2 ## Abbreviation Code 138 .byte 52 ## DW_TAG_variable 139 .byte 0 ## DW_CHILDREN_no 140 .byte 3 ## DW_AT_name 141 .byte 37 ## DW_FORM_strx1 142 .byte 73 ## DW_AT_type 143 .byte 19 ## DW_FORM_ref4 144 .byte 63 ## DW_AT_external 145 .byte 25 ## DW_FORM_flag_present 146 .byte 58 ## DW_AT_decl_file 147 .byte 11 ## DW_FORM_data1 148 .byte 59 ## DW_AT_decl_line 149 .byte 11 ## DW_FORM_data1 150 .byte 0 ## EOM(1) 151 .byte 0 ## EOM(2) 152 .byte 3 ## Abbreviation Code 153 .byte 53 ## DW_TAG_volatile_type 154 .byte 0 ## DW_CHILDREN_no 155 .byte 73 ## DW_AT_type 156 .byte 19 ## DW_FORM_ref4 157 .byte 0 ## EOM(1) 158 .byte 0 ## EOM(2) 159 .byte 4 ## Abbreviation Code 160 .byte 36 ## DW_TAG_base_type 161 .byte 0 ## DW_CHILDREN_no 162 .byte 3 ## DW_AT_name 163 .byte 37 ## DW_FORM_strx1 164 .byte 62 ## DW_AT_encoding 165 .byte 11 ## DW_FORM_data1 166 .byte 11 ## DW_AT_byte_size 167 .byte 11 ## DW_FORM_data1 168 .byte 0 ## EOM(1) 169 .byte 0 ## EOM(2) 170 .byte 5 ## Abbreviation Code 171 .byte 46 ## DW_TAG_subprogram 172 .byte 0 ## DW_CHILDREN_no 173 .byte 17 ## DW_AT_low_pc 174 .byte 1 ## DW_FORM_addr 175 .byte 18 ## DW_AT_high_pc 176 .byte 6 ## DW_FORM_data4 177 .ascii "\347\177" ## DW_AT_APPLE_omit_frame_ptr 178 .byte 25 ## DW_FORM_flag_present 179 .byte 64 ## DW_AT_frame_base 180 .byte 24 ## DW_FORM_exprloc 181## .byte 122 ## DW_AT_call_all_calls 182## .byte 25 ## DW_FORM_flag_present 183 .byte 110 ## DW_AT_linkage_name 184 .byte 37 ## DW_FORM_strx1 185 .byte 3 ## DW_AT_name 186 .byte 37 ## DW_FORM_strx1 187 .byte 58 ## DW_AT_decl_file 188 .byte 11 ## DW_FORM_data1 189 .byte 59 ## DW_AT_decl_line 190 .byte 11 ## DW_FORM_data1 191 .byte 63 ## DW_AT_external 192 .byte 25 ## DW_FORM_flag_present 193 .ascii "\341\177" ## DW_AT_APPLE_optimized 194 .byte 25 ## DW_FORM_flag_present 195 .byte 0 ## EOM(1) 196 .byte 0 ## EOM(2) 197 .byte 6 ## Abbreviation Code 198 .byte 46 ## DW_TAG_subprogram 199 .byte 1 ## DW_CHILDREN_yes 200 .byte 17 ## DW_AT_low_pc 201 .byte 1 ## DW_FORM_addr 202 .byte 18 ## DW_AT_high_pc 203 .byte 6 ## DW_FORM_data4 204 .ascii "\347\177" ## DW_AT_APPLE_omit_frame_ptr 205 .byte 25 ## DW_FORM_flag_present 206 .byte 64 ## DW_AT_frame_base 207 .byte 24 ## DW_FORM_exprloc 208## .byte 122 ## DW_AT_call_all_calls 209## .byte 25 ## DW_FORM_flag_present 210 .byte 3 ## DW_AT_name 211 .byte 37 ## DW_FORM_strx1 212 .byte 58 ## DW_AT_decl_file 213 .byte 11 ## DW_FORM_data1 214 .byte 59 ## DW_AT_decl_line 215 .byte 11 ## DW_FORM_data1 216 .byte 73 ## DW_AT_type 217 .byte 19 ## DW_FORM_ref4 218 .byte 63 ## DW_AT_external 219 .byte 25 ## DW_FORM_flag_present 220 .ascii "\341\177" ## DW_AT_APPLE_optimized 221 .byte 25 ## DW_FORM_flag_present 222 .byte 0 ## EOM(1) 223 .byte 0 ## EOM(2) 224 .byte 7 ## Abbreviation Code 225 .byte 72 ## DW_TAG_call_site 226 .byte 0 ## DW_CHILDREN_no 227 .byte 127 ## DW_AT_call_origin 228 .byte 19 ## DW_FORM_ref4 229 .byte 0 ## EOM(1) 230 .byte 0 ## EOM(2) 231 .byte 0 ## EOM(3) 232 .section __DWARF,__debug_info,regular,debug 233Lsection_info: 234Lcu_begin0: 235 .long 99 ## Length of Unit 236 .short 5 ## DWARF version number 237 .byte 1 ## DWARF Unit Type 238 .byte 8 ## Address Size (in bytes) 239.set Lset0, Lsection_abbrev-Lsection_abbrev ## Offset Into Abbrev. Section 240 .long Lset0 241 .byte 1 ## Abbrev [1] 0xc:0x5b DW_TAG_compile_unit 242 .byte 0 ## DW_AT_producer 243 .short 4 ## DW_AT_language 244 .byte 1 ## DW_AT_name 245.set Lset1, Lstr_offsets_base0-Lsection_str_off ## DW_AT_str_offsets_base 246 .long Lset1 247.set Lset2, Lline_table_start0-Lsection_line ## DW_AT_stmt_list 248 .long Lset2 249 .byte 2 ## DW_AT_comp_dir 250 ## DW_AT_APPLE_optimized 251 .quad Lfunc_begin0 ## DW_AT_low_pc 252.set Lset3, Lfunc_end1-Lfunc_begin0 ## DW_AT_high_pc 253 .long Lset3 254 .byte 2 ## Abbrev [2] 0x26:0x8 DW_TAG_variable 255 .byte 3 ## DW_AT_name 256 .long 46 ## DW_AT_type 257 ## DW_AT_external 258 .byte 1 ## DW_AT_decl_file 259 .byte 1 ## DW_AT_decl_line 260 .byte 3 ## Abbrev [3] 0x2e:0x5 DW_TAG_volatile_type 261 .long 51 ## DW_AT_type 262 .byte 4 ## Abbrev [4] 0x33:0x4 DW_TAG_base_type 263 .byte 4 ## DW_AT_name 264 .byte 5 ## DW_AT_encoding 265 .byte 4 ## DW_AT_byte_size 266 .byte 5 ## Abbrev [5] 0x37:0x13 DW_TAG_subprogram 267 .quad Lfunc_begin0 ## DW_AT_low_pc 268.set Lset4, Lfunc_end0-Lfunc_begin0 ## DW_AT_high_pc 269 .long Lset4 270 ## DW_AT_APPLE_omit_frame_ptr 271 .byte 1 ## DW_AT_frame_base 272 .byte 87 273 ## DW_AT_call_all_calls 274 .byte 6 ## DW_AT_linkage_name 275 .byte 5 ## DW_AT_name 276 .byte 1 ## DW_AT_decl_file 277 .byte 4 ## DW_AT_decl_line 278 ## DW_AT_external 279 ## DW_AT_APPLE_optimized 280 .byte 6 ## Abbrev [6] 0x4a:0x1c DW_TAG_subprogram 281 .quad Lfunc_begin1 ## DW_AT_low_pc 282.set Lset5, Lfunc_end1-Lfunc_begin1 ## DW_AT_high_pc 283 .long Lset5 284 ## DW_AT_APPLE_omit_frame_ptr 285 .byte 1 ## DW_AT_frame_base 286 .byte 87 287 ## DW_AT_call_all_calls 288 .byte 7 ## DW_AT_name 289 .byte 1 ## DW_AT_decl_file 290 .byte 8 ## DW_AT_decl_line 291 .long 51 ## DW_AT_type 292 ## DW_AT_external 293 ## DW_AT_APPLE_optimized 294 .byte 7 ## Abbrev [7] 0x60:0x5 DW_TAG_call_site 295 .long 55 ## DW_AT_call_origin 296 .byte 0 ## End Of Children Mark 297 .byte 0 ## End Of Children Mark 298 .section __DWARF,__debug_macinfo,regular,debug 299Ldebug_macinfo: 300 .byte 0 ## End Of Macro List Mark 301 .section __DWARF,__debug_names,regular,debug 302Ldebug_names_begin: 303.set Lset6, Lnames_end0-Lnames_start0 ## Header: unit length 304 .long Lset6 305Lnames_start0: 306 .short 5 ## Header: version 307 .short 0 ## Header: padding 308 .long 1 ## Header: compilation unit count 309 .long 0 ## Header: local type unit count 310 .long 0 ## Header: foreign type unit count 311 .long 4 ## Header: bucket count 312 .long 4 ## Header: name count 313.set Lset7, Lnames_abbrev_end0-Lnames_abbrev_start0 ## Header: abbreviation table size 314 .long Lset7 315 .long 8 ## Header: augmentation string size 316 .ascii "LLVM0700" ## Header: augmentation string 317.set Lset8, Lcu_begin0-Lsection_info ## Compilation unit 0 318 .long Lset8 319 .long 1 ## Bucket 0 320 .long 2 ## Bucket 1 321 .long 3 ## Bucket 2 322 .long 4 ## Bucket 3 323 .long 193495088 ## Hash in Bucket 0 324 .long 193491849 ## Hash in Bucket 1 325 .long 2090499946 ## Hash in Bucket 2 326 .long -1257882357 ## Hash in Bucket 3 327 .long 115 ## String in Bucket 0: int 328 .long 119 ## String in Bucket 1: foo 329 .long 131 ## String in Bucket 2: main 330 .long 123 ## String in Bucket 3: _Z3foov 331.set Lset9, Lnames3-Lnames_entries0 ## Offset in Bucket 0 332 .long Lset9 333.set Lset10, Lnames0-Lnames_entries0 ## Offset in Bucket 1 334 .long Lset10 335.set Lset11, Lnames1-Lnames_entries0 ## Offset in Bucket 2 336 .long Lset11 337.set Lset12, Lnames2-Lnames_entries0 ## Offset in Bucket 3 338 .long Lset12 339Lnames_abbrev_start0: 340 .byte 46 ## Abbrev code 341 .byte 46 ## DW_TAG_subprogram 342 .byte 3 ## DW_IDX_die_offset 343 .byte 19 ## DW_FORM_ref4 344 .byte 0 ## End of abbrev 345 .byte 0 ## End of abbrev 346 .byte 36 ## Abbrev code 347 .byte 36 ## DW_TAG_base_type 348 .byte 3 ## DW_IDX_die_offset 349 .byte 19 ## DW_FORM_ref4 350 .byte 0 ## End of abbrev 351 .byte 0 ## End of abbrev 352 .byte 0 ## End of abbrev list 353Lnames_abbrev_end0: 354Lnames_entries0: 355Lnames3: 356 .byte 36 ## Abbreviation code 357 .long 51 ## DW_IDX_die_offset 358 .long 0 ## End of list: int 359Lnames0: 360 .byte 46 ## Abbreviation code 361 .long 55 ## DW_IDX_die_offset 362 .long 0 ## End of list: foo 363Lnames1: 364 .byte 46 ## Abbreviation code 365 .long 74 ## DW_IDX_die_offset 366 .long 0 ## End of list: main 367Lnames2: 368 .byte 46 ## Abbreviation code 369 .long 55 ## DW_IDX_die_offset 370 .long 0 ## End of list: _Z3foov 371Lnames_end0: 372 373.subsections_via_symbols 374 .section __DWARF,__debug_line,regular,debug 375Lsection_line: 376Lline_table_start0: 377