1*9880d681SAndroid Build Coastguard Worker; RUN: llc -split-dwarf=Enable -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t 2*9880d681SAndroid Build Coastguard Worker; RUN: llvm-dwarfdump -debug-dump=all %t | FileCheck %s 3*9880d681SAndroid Build Coastguard Worker; RUN: llvm-readobj --relocations %t | FileCheck --check-prefix=CHECK-RELOCS %s 4*9880d681SAndroid Build Coastguard Worker 5*9880d681SAndroid Build Coastguard Worker; From: 6*9880d681SAndroid Build Coastguard Worker; class A { 7*9880d681SAndroid Build Coastguard Worker; public: 8*9880d681SAndroid Build Coastguard Worker; A(int i = 0) : a(i) {} 9*9880d681SAndroid Build Coastguard Worker; private: 10*9880d681SAndroid Build Coastguard Worker; int a; 11*9880d681SAndroid Build Coastguard Worker; }; 12*9880d681SAndroid Build Coastguard Worker; 13*9880d681SAndroid Build Coastguard Worker; A a; 14*9880d681SAndroid Build Coastguard Worker 15*9880d681SAndroid Build Coastguard Worker; With function sections enabled make sure that we have a DW_AT_ranges attribute. 16*9880d681SAndroid Build Coastguard Worker; CHECK: DW_AT_ranges 17*9880d681SAndroid Build Coastguard Worker 18*9880d681SAndroid Build Coastguard Worker; Check that we have a relocation against the .debug_ranges section. 19*9880d681SAndroid Build Coastguard Worker; CHECK-RELOCS: R_X86_64_32 .debug_ranges 0x0 20*9880d681SAndroid Build Coastguard Worker 21*9880d681SAndroid Build Coastguard Worker%class.A = type { i32 } 22*9880d681SAndroid Build Coastguard Worker 23*9880d681SAndroid Build Coastguard Worker@a = global %class.A zeroinitializer, align 4 24*9880d681SAndroid Build Coastguard Worker@llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @_GLOBAL__I_a }] 25*9880d681SAndroid Build Coastguard Worker 26*9880d681SAndroid Build Coastguard Workerdefine internal void @__cxx_global_var_init() section ".text.startup" !dbg !14 { 27*9880d681SAndroid Build Coastguard Workerentry: 28*9880d681SAndroid Build Coastguard Worker call void @_ZN1AC2Ei(%class.A* @a, i32 0), !dbg !26 29*9880d681SAndroid Build Coastguard Worker ret void, !dbg !26 30*9880d681SAndroid Build Coastguard Worker} 31*9880d681SAndroid Build Coastguard Worker 32*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind uwtable 33*9880d681SAndroid Build Coastguard Workerdefine linkonce_odr void @_ZN1AC2Ei(%class.A* %this, i32 %i) unnamed_addr #0 align 2 !dbg !18 { 34*9880d681SAndroid Build Coastguard Workerentry: 35*9880d681SAndroid Build Coastguard Worker %this.addr = alloca %class.A*, align 8 36*9880d681SAndroid Build Coastguard Worker %i.addr = alloca i32, align 4 37*9880d681SAndroid Build Coastguard Worker store %class.A* %this, %class.A** %this.addr, align 8 38*9880d681SAndroid Build Coastguard Worker call void @llvm.dbg.declare(metadata %class.A** %this.addr, metadata !27, metadata !DIExpression()), !dbg !29 39*9880d681SAndroid Build Coastguard Worker store i32 %i, i32* %i.addr, align 4 40*9880d681SAndroid Build Coastguard Worker call void @llvm.dbg.declare(metadata i32* %i.addr, metadata !30, metadata !DIExpression()), !dbg !31 41*9880d681SAndroid Build Coastguard Worker %this1 = load %class.A*, %class.A** %this.addr 42*9880d681SAndroid Build Coastguard Worker %a = getelementptr inbounds %class.A, %class.A* %this1, i32 0, i32 0, !dbg !31 43*9880d681SAndroid Build Coastguard Worker %0 = load i32, i32* %i.addr, align 4, !dbg !31 44*9880d681SAndroid Build Coastguard Worker store i32 %0, i32* %a, align 4, !dbg !31 45*9880d681SAndroid Build Coastguard Worker ret void, !dbg !31 46*9880d681SAndroid Build Coastguard Worker} 47*9880d681SAndroid Build Coastguard Worker 48*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone 49*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.dbg.declare(metadata, metadata, metadata) #1 50*9880d681SAndroid Build Coastguard Worker 51*9880d681SAndroid Build Coastguard Workerdefine internal void @_GLOBAL__I_a() section ".text.startup" !dbg !19 { 52*9880d681SAndroid Build Coastguard Workerentry: 53*9880d681SAndroid Build Coastguard Worker call void @__cxx_global_var_init(), !dbg !32 54*9880d681SAndroid Build Coastguard Worker ret void, !dbg !32 55*9880d681SAndroid Build Coastguard Worker} 56*9880d681SAndroid Build Coastguard Worker 57*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } 58*9880d681SAndroid Build Coastguard Workerattributes #1 = { nounwind readnone } 59*9880d681SAndroid Build Coastguard Worker 60*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!0} 61*9880d681SAndroid Build Coastguard Worker!llvm.module.flags = !{!23, !24} 62*9880d681SAndroid Build Coastguard Worker!llvm.ident = !{!25} 63*9880d681SAndroid Build Coastguard Worker 64*9880d681SAndroid Build Coastguard Worker!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5 (trunk 199923) (llvm/trunk 199940)", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !3, globals: !21, imports: !2) 65*9880d681SAndroid Build Coastguard Worker!1 = !DIFile(filename: "baz.cpp", directory: "/usr/local/google/home/echristo/tmp") 66*9880d681SAndroid Build Coastguard Worker!2 = !{} 67*9880d681SAndroid Build Coastguard Worker!3 = !{!4} 68*9880d681SAndroid Build Coastguard Worker!4 = !DICompositeType(tag: DW_TAG_class_type, name: "A", line: 1, size: 32, align: 32, file: !1, elements: !5, identifier: "_ZTS1A") 69*9880d681SAndroid Build Coastguard Worker!5 = !{!6, !8} 70*9880d681SAndroid Build Coastguard Worker!6 = !DIDerivedType(tag: DW_TAG_member, name: "a", line: 5, size: 32, align: 32, flags: DIFlagPrivate, file: !1, scope: !4, baseType: !7) 71*9880d681SAndroid Build Coastguard Worker!7 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 72*9880d681SAndroid Build Coastguard Worker!8 = !DISubprogram(name: "A", line: 3, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 3, file: !1, scope: !4, type: !9) 73*9880d681SAndroid Build Coastguard Worker!9 = !DISubroutineType(types: !10) 74*9880d681SAndroid Build Coastguard Worker!10 = !{null, !11, !7} 75*9880d681SAndroid Build Coastguard Worker!11 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !4) 76*9880d681SAndroid Build Coastguard Worker!14 = distinct !DISubprogram(name: "__cxx_global_var_init", line: 8, isLocal: true, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 8, file: !1, scope: !15, type: !16, variables: !2) 77*9880d681SAndroid Build Coastguard Worker!15 = !DIFile(filename: "baz.cpp", directory: "/usr/local/google/home/echristo/tmp") 78*9880d681SAndroid Build Coastguard Worker!16 = !DISubroutineType(types: !17) 79*9880d681SAndroid Build Coastguard Worker!17 = !{null} 80*9880d681SAndroid Build Coastguard Worker!18 = distinct !DISubprogram(name: "A", linkageName: "_ZN1AC2Ei", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 3, file: !1, scope: !4, type: !9, declaration: !8, variables: !2) 81*9880d681SAndroid Build Coastguard Worker!19 = distinct !DISubprogram(name: "", linkageName: "_GLOBAL__I_a", line: 3, isLocal: true, isDefinition: true, virtualIndex: 6, flags: DIFlagArtificial, isOptimized: false, unit: !0, scopeLine: 3, file: !1, scope: !15, type: !20, variables: !2) 82*9880d681SAndroid Build Coastguard Worker!20 = !DISubroutineType(types: !2) 83*9880d681SAndroid Build Coastguard Worker!21 = !{!22} 84*9880d681SAndroid Build Coastguard Worker!22 = !DIGlobalVariable(name: "a", line: 8, isLocal: false, isDefinition: true, scope: null, file: !15, type: !4, variable: %class.A* @a) 85*9880d681SAndroid Build Coastguard Worker!23 = !{i32 2, !"Dwarf Version", i32 4} 86*9880d681SAndroid Build Coastguard Worker!24 = !{i32 1, !"Debug Info Version", i32 3} 87*9880d681SAndroid Build Coastguard Worker!25 = !{!"clang version 3.5 (trunk 199923) (llvm/trunk 199940)"} 88*9880d681SAndroid Build Coastguard Worker!26 = !DILocation(line: 8, scope: !14) 89*9880d681SAndroid Build Coastguard Worker!27 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !18, type: !28) 90*9880d681SAndroid Build Coastguard Worker!28 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !4) 91*9880d681SAndroid Build Coastguard Worker!29 = !DILocation(line: 0, scope: !18) 92*9880d681SAndroid Build Coastguard Worker!30 = !DILocalVariable(name: "i", line: 3, arg: 2, scope: !18, file: !15, type: !7) 93*9880d681SAndroid Build Coastguard Worker!31 = !DILocation(line: 3, scope: !18) 94*9880d681SAndroid Build Coastguard Worker!32 = !DILocation(line: 3, scope: !19) 95