1 ; RUN: llc -mtriple=x86_64-pc-linux -split-dwarf-file=input.dwo -O3 \ 2 ; RUN: -function-sections -data-sections \ 3 ; RUN: -relocation-model=pic -filetype=asm \ 4 ; RUN: -generate-type-units -o - %s | \ 5 ; RUN: FileCheck %s --check-prefix=CHECK-ASM 6 ; RUN: llc -mtriple=x86_64-pc-linux -split-dwarf-file=input.dwo -O3 \ 7 ; RUN: -function-sections -data-sections \ 8 ; RUN: -relocation-model=pic -filetype=obj \ 9 ; RUN: -generate-type-units -o - %s | \ 10 ; RUN: llvm-readelf -sections | \ 11 ; RUN: FileCheck %s --check-prefix=CHECK-ELF 12 ; Created from `clang++ -fxray-instrument -gsplit-dwarf -fdebug-types-section 13 ; -ffunction-sections -fdata-sections -emit-llvm -S input.cc`: 14 ; input.cc: 15 ; 16 ; class a { 17 ; int b(); 18 ; }; 19 ; int a::b() { 20 ; for (;;) 21 ; ; 22 ; } 23 ; 24 ; In this test we want to make sure that the xray_instr_map section for 25 ; `a::b()` is actually associated with the function's symbol instead of the 26 ; .debug_types.dwo section. 27 ; 28 ; CHECK-ASM: xray_fn_idx,"awo",@progbits,_ZN1a1bEv,unique,1 29 ; 30 ; CHECK-ELF-DAG: [[FSECT:[0-9]+]]] .text._ZN1a1bEv PROGBITS 31 ; CHECK-ELF-DAG: [{{.*}}] .debug_types.dwo PROGBITS 32 ; CHECK-ELF-DAG: [{{.*}}] xray_instr_map PROGBITS {{.*}} {{.*}} {{.*}} {{.*}} WAL [[FSECT]] 33 target triple = "x86_64-pc-linux" 34 35 %class.a = type { i8 } 36 37 ; Function Attrs: nounwind readnone uwtable 38 define i32 @_ZN1a1bEv(%class.a* nocapture readnone) local_unnamed_addr #0 align 2 !dbg !8 { 39 tail call void @llvm.dbg.value(metadata %class.a* %0, metadata !17, metadata !DIExpression()), !dbg !19 40 br label %2, !dbg !20 41 42 ; <label>:2: ; preds = %2, %1 43 br label %2, !dbg !21, !llvm.loop !25 44 } 45 46 47 ; Function Attrs: nounwind readnone speculatable 48 declare void @llvm.dbg.value(metadata, metadata, metadata) #1 49 50 attributes #0 = { nounwind readnone uwtable "xray-instruction-threshold"="200" } 51 attributes #1 = { nounwind readnone speculatable } 52 53 !llvm.dbg.cu = !{!0} 54 !llvm.module.flags = !{!3, !4, !5, !6} 55 !llvm.ident = !{!7} 56 57 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version trunk (trunk r312634)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, debugInfoForProfiling: true) 58 !1 = !DIFile(filename: "input.cc", directory: "/usr/local/google/home/dberris/tmp") 59 !2 = !{} 60 !3 = !{i32 2, !"Debug Info Version", i32 3} 61 !4 = !{i32 1, !"wchar_size", i32 4} 62 !5 = !{i32 7, !"PIC Level", i32 2} 63 !6 = !{i32 7, !"PIE Level", i32 2} 64 !7 = !{!"clang version trunk (trunk r312634)"} 65 !8 = distinct !DISubprogram(name: "b", linkageName: "_ZN1a1bEv", scope: !9, file: !1, line: 4, type: !12, isLocal: false, isDefinition: true, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: true, unit: !0, declaration: !11, retainedNodes: !16) 66 !9 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "a", file: !1, line: 1, size: 8, elements: !10, identifier: "_ZTS1a") 67 !10 = !{!11} 68 !11 = !DISubprogram(name: "b", linkageName: "_ZN1a1bEv", scope: !9, file: !1, line: 2, type: !12, isLocal: false, isDefinition: false, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true) 69 !12 = !DISubroutineType(types: !13) 70 !13 = !{!14, !15} 71 !14 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 72 !15 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !9, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer) 73 !16 = !{!17} 74 !17 = !DILocalVariable(name: "this", arg: 1, scope: !8, type: !18, flags: DIFlagArtificial | DIFlagObjectPointer) 75 !18 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !9, size: 64) 76 !19 = !DILocation(line: 0, scope: !8) 77 !20 = !DILocation(line: 5, column: 3, scope: !8) 78 !21 = !DILocation(line: 5, column: 3, scope: !22) 79 !22 = !DILexicalBlockFile(scope: !23, file: !1, discriminator: 2) 80 !23 = distinct !DILexicalBlock(scope: !24, file: !1, line: 5, column: 3) 81 !24 = distinct !DILexicalBlock(scope: !8, file: !1, line: 5, column: 3) 82 !25 = distinct !{!25, !26, !27} 83 !26 = !DILocation(line: 5, column: 3, scope: !24) 84 !27 = !DILocation(line: 6, column: 5, scope: !24) 85