1 ; RUN: llc -generate-arange-section < %s | FileCheck %s 2 3 ; -- header -- 4 ; CHECK: .short 2 # DWARF Arange version number 5 ; CHECK-NEXT: .long .Lcu_begin0 6 ; CHECK-NEXT: .byte 8 # Address Size (in bytes) 7 ; CHECK-NEXT: .byte 0 # Segment Size (in bytes) 8 ; -- alignment -- 9 ; CHECK-NEXT: .zero 4,255 10 11 ; <data section> - it should have made one span covering all vars in this CU. 12 ; CHECK-NEXT: .quad some_data 13 ; CHECK-NEXT: .quad .Lsec_end0-some_data 14 15 ; <other sections> - it should have made one span covering all vars in this CU. 16 ; CHECK-NEXT: .quad some_other 17 ; CHECK-NEXT: .quad .Lsec_end1-some_other 18 19 ; <common symbols> - it should have made one span for each symbol. 20 ; CHECK-NEXT: .quad some_bss 21 ; CHECK-NEXT: .quad 4 22 23 ; <text section> - it should have made one span covering all functions in this CU. 24 ; CHECK-NEXT: .quad .Lfunc_begin0 25 ; CHECK-NEXT: .quad .Lsec_end2-.Lfunc_begin0 26 27 ; -- finish -- 28 ; CHECK-NEXT: # ARange terminator 29 30 ; -- source code -- 31 ; Generated from: "clang -c -g -emit-llvm" 32 ; 33 ; int some_data = 4; 34 ; int some_bss; 35 ; int some_other __attribute__ ((section ("strange+section"))) = 5; 36 ; 37 ; void some_code() 38 ; { 39 ; some_bss += some_data + some_other; 40 ; } 41 42 source_filename = "test/DebugInfo/X86/dwarf-aranges.ll" 43 target triple = "x86_64-unknown-linux-gnu" 44 45 @some_data = global i32 4, align 4, !dbg !0 46 @some_other = global i32 5, section "strange+section", align 4, !dbg !4 47 @some_bss = common global i32 0, align 4, !dbg !6 48 49 define void @some_code() !dbg !13 { 50 entry: 51 %0 = load i32, i32* @some_data, align 4, !dbg !16 52 %1 = load i32, i32* @some_other, align 4, !dbg !16 53 %add = add nsw i32 %0, %1, !dbg !16 54 %2 = load i32, i32* @some_bss, align 4, !dbg !16 55 %add1 = add nsw i32 %2, %add, !dbg !16 56 store i32 %add1, i32* @some_bss, align 4, !dbg !16 57 ret void, !dbg !17 58 } 59 60 !llvm.dbg.cu = !{!8} 61 !llvm.module.flags = !{!11, !12} 62 63 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) 64 !1 = !DIGlobalVariable(name: "some_data", scope: null, file: !2, line: 1, type: !3, isLocal: false, isDefinition: true) 65 !2 = !DIFile(filename: "test.c", directory: "/home/kayamon") 66 !3 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 67 !4 = !DIGlobalVariableExpression(var: !5, expr: !DIExpression()) 68 !5 = !DIGlobalVariable(name: "some_other", scope: null, file: !2, line: 3, type: !3, isLocal: false, isDefinition: true) 69 !6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression()) 70 !7 = !DIGlobalVariable(name: "some_bss", scope: null, file: !2, line: 2, type: !3, isLocal: false, isDefinition: true) 71 !8 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, producer: "clang version 3.4 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !9, retainedTypes: !9, globals: !10, imports: !9) 72 !9 = !{} 73 !10 = !{!0, !4, !6} 74 !11 = !{i32 2, !"Dwarf Version", i32 4} 75 !12 = !{i32 1, !"Debug Info Version", i32 3} 76 !13 = distinct !DISubprogram(name: "some_code", scope: !2, file: !2, line: 5, type: !14, isLocal: false, isDefinition: true, scopeLine: 6, virtualIndex: 6, isOptimized: false, unit: !8, retainedNodes: !9) 77 !14 = !DISubroutineType(types: !15) 78 !15 = !{null} 79 !16 = !DILocation(line: 7, scope: !13) 80 !17 = !DILocation(line: 8, scope: !13) 81 82