blob: a9821b020241251389f33a6dc7e682a17b9faecd [file] [log] [blame]
Eric Christopher2feed5f2014-05-20 21:25:34 +00001; RUN: llc -split-dwarf=Enable -O0 %s -function-sections -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
David Blaikiec42f9ac2014-09-07 17:31:42 +00002; RUN: llvm-dwarfdump -debug-dump=abbrev %t | FileCheck --check-prefix=FUNCTION-SECTIONS %s
Eric Christopher1ad84572014-01-15 00:04:29 +00003; RUN: llvm-readobj --relocations %t | FileCheck --check-prefix=FUNCTION-SECTIONS-RELOCS %s
Eric Christopherfb4a99c2014-01-14 22:57:52 +00004
5; RUN: llc -split-dwarf=Enable -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
David Blaikiec42f9ac2014-09-07 17:31:42 +00006; RUN: llvm-dwarfdump -debug-dump=abbrev %t | FileCheck --check-prefix=NO-FUNCTION-SECTIONS %s
Eric Christopherfb4a99c2014-01-14 22:57:52 +00007
8; From:
9; int foo (int a) {
10; return a+1;
11; }
Eric Christopher384f3fe2014-03-20 19:16:16 +000012; int bar (int b) {
13; return b+2;
14; }
Eric Christopherfb4a99c2014-01-14 22:57:52 +000015
16; With function sections enabled make sure that we have a DW_AT_ranges attribute.
17; FUNCTION-SECTIONS: DW_AT_ranges
18
Eric Christopher1ad84572014-01-15 00:04:29 +000019; Check that we have a relocation against the .debug_ranges section.
20; FUNCTION-SECTIONS-RELOCS: R_X86_64_32 .debug_ranges 0x0
21
Eric Christopherfb4a99c2014-01-14 22:57:52 +000022; Without function sections enabled make sure that we have no DW_AT_ranges attribute.
23; NO-FUNCTION-SECTIONS-NOT: DW_AT_ranges
David Blaikiec42f9ac2014-09-07 17:31:42 +000024; NO-FUNCTION-SECTIONS: DW_AT_low_pc DW_FORM_addr
25; NO-FUNCTION-SECTIONS-NOT: DW_AT_ranges
Eric Christopherfb4a99c2014-01-14 22:57:52 +000026
27; Function Attrs: nounwind uwtable
28define i32 @foo(i32 %a) #0 {
29entry:
30 %a.addr = alloca i32, align 4
31 store i32 %a, i32* %a.addr, align 4
Duncan P. N. Exon Smith176b6912014-10-03 20:01:09 +000032 call void @llvm.dbg.declare(metadata !{i32* %a.addr}, metadata !13, metadata !{metadata !"0x102"}), !dbg !14
Eric Christopherfb4a99c2014-01-14 22:57:52 +000033 %0 = load i32* %a.addr, align 4, !dbg !14
34 %add = add nsw i32 %0, 1, !dbg !14
35 ret i32 %add, !dbg !14
36}
37
38; Function Attrs: nounwind readnone
Adrian Prantl87b7eb92014-10-01 18:55:02 +000039declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
Eric Christopherfb4a99c2014-01-14 22:57:52 +000040
Eric Christopher384f3fe2014-03-20 19:16:16 +000041; Function Attrs: nounwind uwtable
42define i32 @bar(i32 %b) #0 {
43entry:
44 %b.addr = alloca i32, align 4
45 store i32 %b, i32* %b.addr, align 4
Duncan P. N. Exon Smith176b6912014-10-03 20:01:09 +000046 call void @llvm.dbg.declare(metadata !{i32* %b.addr}, metadata !15, metadata !{metadata !"0x102"}), !dbg !16
Eric Christopher384f3fe2014-03-20 19:16:16 +000047 %0 = load i32* %b.addr, align 4, !dbg !16
48 %add = add nsw i32 %0, 2, !dbg !16
49 ret i32 %add, !dbg !16
50}
51
Eric Christopherfb4a99c2014-01-14 22:57:52 +000052attributes #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" }
53attributes #1 = { nounwind readnone }
54
55!llvm.dbg.cu = !{!0}
Eric Christopher384f3fe2014-03-20 19:16:16 +000056!llvm.module.flags = !{!10, !11}
57!llvm.ident = !{!12}
Eric Christopherfb4a99c2014-01-14 22:57:52 +000058
Duncan P. N. Exon Smith176b6912014-10-03 20:01:09 +000059!0 = metadata !{metadata !"0x11\0012\00clang version 3.5.0 (trunk 204164) (llvm/trunk 204183)\000\00\000\00\001", metadata !1, metadata !2, metadata !2, metadata !3, metadata !2, metadata !2} ; [ DW_TAG_compile_unit ] [/usr/local/google/home/echristo/z.c] [DW_LANG_C99]
Eric Christopher384f3fe2014-03-20 19:16:16 +000060!1 = metadata !{metadata !"z.c", metadata !"/usr/local/google/home/echristo"}
David Blaikie5e390e42014-02-04 01:23:52 +000061!2 = metadata !{}
Eric Christopher384f3fe2014-03-20 19:16:16 +000062!3 = metadata !{metadata !4, metadata !9}
Duncan P. N. Exon Smith176b6912014-10-03 20:01:09 +000063!4 = metadata !{metadata !"0x2e\00foo\00foo\00\001\000\001\000\006\00256\000\001", metadata !1, metadata !5, metadata !6, null, i32 (i32)* @foo, null, null, metadata !2} ; [ DW_TAG_subprogram ] [line 1] [def] [foo]
64!5 = metadata !{metadata !"0x29", metadata !1} ; [ DW_TAG_file_type ] [/usr/local/google/home/echristo/z.c]
65!6 = metadata !{metadata !"0x15\00\000\000\000\000\000\000", i32 0, null, null, metadata !7, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
Eric Christopherfb4a99c2014-01-14 22:57:52 +000066!7 = metadata !{metadata !8, metadata !8}
Duncan P. N. Exon Smith176b6912014-10-03 20:01:09 +000067!8 = metadata !{metadata !"0x24\00int\000\0032\0032\000\000\005", null, null} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
68!9 = metadata !{metadata !"0x2e\00bar\00bar\00\002\000\001\000\006\00256\000\002", metadata !1, metadata !5, metadata !6, null, i32 (i32)* @bar, null, null, metadata !2} ; [ DW_TAG_subprogram ] [line 2] [def] [bar]
Eric Christopher384f3fe2014-03-20 19:16:16 +000069!10 = metadata !{i32 2, metadata !"Dwarf Version", i32 4}
Duncan P. N. Exon Smith176b6912014-10-03 20:01:09 +000070!11 = metadata !{i32 1, metadata !"Debug Info Version", i32 2}
Eric Christopher384f3fe2014-03-20 19:16:16 +000071!12 = metadata !{metadata !"clang version 3.5.0 (trunk 204164) (llvm/trunk 204183)"}
Duncan P. N. Exon Smith176b6912014-10-03 20:01:09 +000072!13 = metadata !{metadata !"0x101\00a\0016777217\000", metadata !4, metadata !5, metadata !8} ; [ DW_TAG_arg_variable ] [a] [line 1]
Eric Christopher384f3fe2014-03-20 19:16:16 +000073!14 = metadata !{i32 1, i32 0, metadata !4, null}
Duncan P. N. Exon Smith176b6912014-10-03 20:01:09 +000074!15 = metadata !{metadata !"0x101\00b\0016777218\000", metadata !9, metadata !5, metadata !8} ; [ DW_TAG_arg_variable ] [b] [line 2]
Eric Christopher384f3fe2014-03-20 19:16:16 +000075!16 = metadata !{i32 2, i32 0, metadata !9, null}