86 lines · plain
1; RUN: llc -split-dwarf-file=foo.dwo -O0 %s -function-sections -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t2; RUN: llvm-dwarfdump -debug-abbrev %t | FileCheck --check-prefix=FUNCTION-SECTIONS %s3; RUN: llvm-readobj --relocations %t | FileCheck --check-prefix=FUNCTION-SECTIONS-RELOCS %s4 5; RUN: llc -split-dwarf-file=foo.dwo -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t6; RUN: llvm-dwarfdump -debug-abbrev %t | FileCheck --check-prefix=NO-FUNCTION-SECTIONS %s7 8; RUN: llc -dwarf-version=5 -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t9; RUN: llvm-dwarfdump -v %t | FileCheck --check-prefix=DWARF5 %s10 11; From:12; int foo (int a) {13; return a+1;14; }15; int bar (int b) {16; return b+2;17; }18 19; With function sections enabled make sure that we have a DW_AT_ranges attribute.20; FUNCTION-SECTIONS: DW_AT_ranges21 22; Check that we have a relocation against the .debug_ranges section.23; FUNCTION-SECTIONS-RELOCS: R_X86_64_32 .debug_ranges 0x024 25; Without function sections enabled make sure that we have no DW_AT_ranges attribute.26; NO-FUNCTION-SECTIONS-NOT: DW_AT_ranges27; NO-FUNCTION-SECTIONS: DW_AT_low_pc DW_FORM_addr28; NO-FUNCTION-SECTIONS-NOT: DW_AT_ranges29 30; For Dwarf 5 check that we neither generate DW_AT_rnglists_base for the CU DIE nor 31; a .debug_rnglists section. There is only 1 CU range with no scope ranges.32;33; DWARF5: .debug_info contents:34; DWARF5: DW_TAG_compile_unit35; DWARF5-NOT: DW_AT_rnglists_base [DW_FORM_sec_offset] 36; DWARF5-NOT: .debug_rnglists contents:37 38; Function Attrs: nounwind uwtable39define i32 @foo(i32 %a) #0 !dbg !4 {40entry:41 %a.addr = alloca i32, align 442 store i32 %a, ptr %a.addr, align 443 call void @llvm.dbg.declare(metadata ptr %a.addr, metadata !13, metadata !DIExpression()), !dbg !1444 %0 = load i32, ptr %a.addr, align 4, !dbg !1445 %add = add nsw i32 %0, 1, !dbg !1446 ret i32 %add, !dbg !1447}48 49; Function Attrs: nounwind readnone50declare void @llvm.dbg.declare(metadata, metadata, metadata) #151 52; Function Attrs: nounwind uwtable53define i32 @bar(i32 %b) #0 !dbg !9 {54entry:55 %b.addr = alloca i32, align 456 store i32 %b, ptr %b.addr, align 457 call void @llvm.dbg.declare(metadata ptr %b.addr, metadata !15, metadata !DIExpression()), !dbg !1658 %0 = load i32, ptr %b.addr, align 4, !dbg !1659 %add = add nsw i32 %0, 2, !dbg !1660 ret i32 %add, !dbg !1661}62 63attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="false" }64attributes #1 = { nounwind readnone }65 66!llvm.dbg.cu = !{!0}67!llvm.module.flags = !{!10, !11}68!llvm.ident = !{!12}69 70!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.5.0 (trunk 204164) (llvm/trunk 204183)", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)71!1 = !DIFile(filename: "z.c", directory: "/usr/local/google/home/echristo")72!2 = !{}73!4 = distinct !DISubprogram(name: "foo", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 1, file: !1, scope: !5, type: !6, retainedNodes: !2)74!5 = !DIFile(filename: "z.c", directory: "/usr/local/google/home/echristo")75!6 = !DISubroutineType(types: !7)76!7 = !{!8, !8}77!8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)78!9 = distinct !DISubprogram(name: "bar", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 2, file: !1, scope: !5, type: !6, retainedNodes: !2)79!10 = !{i32 2, !"Dwarf Version", i32 4}80!11 = !{i32 1, !"Debug Info Version", i32 3}81!12 = !{!"clang version 3.5.0 (trunk 204164) (llvm/trunk 204183)"}82!13 = !DILocalVariable(name: "a", line: 1, arg: 1, scope: !4, file: !5, type: !8)83!14 = !DILocation(line: 1, scope: !4)84!15 = !DILocalVariable(name: "b", line: 2, arg: 1, scope: !9, file: !5, type: !8)85!16 = !DILocation(line: 2, scope: !9)86