xref: /llvm-project/bolt/test/X86/insert-debug-info-entry.test (revision 11791ae7b0b05b8bd8d806331ff51da618912cf8)
1; RUN: rm -rf %t
2; RUN: mkdir %t
3; RUN: cd %t
4; RUN: llc -split-dwarf-file=foo.dwo -split-dwarf-output=foo.dwo -O0 -mtriple=x86_64-unknown-linux-gnu -filetype=obj %s -o=foo.o
5; RUN: %clang %cflags foo.o -o foo.exe
6; RUN: llvm-bolt foo.exe -o foo.exe.bolt --update-debug-sections
7; RUN: llvm-dwarfdump --debug-info foo.exe | FileCheck -check-prefix=PRE-BOLT %s
8; RUN: llvm-dwarfdump --debug-info foo.exe.bolt | FileCheck %s
9
10;; This tests checks that DW_AT_GNU_ranges_base is added at the end of the CU.
11
12; PRE-BOLT: DW_AT_GNU_addr_base
13; PRE-BOLT-NOT: DW_AT_GNU_ranges_base
14
15; CHECK: DW_AT_GNU_addr_base
16; CHECK-NEXT: DW_AT_GNU_ranges_base
17
18; int foo() {
19;   return 3;
20; }
21;
22; int main() {
23;   return foo();
24; }
25
26; ModuleID = 'main.cpp'
27source_filename = "main.cpp"
28target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
29target triple = "x86_64-unknown-linux-gnu"
30
31; Function Attrs: mustprogress noinline nounwind optnone uwtable
32define dso_local noundef i32 @_Z3foov() #0 !dbg !8 {
33entry:
34  ret i32 3, !dbg !13
35}
36
37; Function Attrs: mustprogress noinline norecurse nounwind optnone uwtable
38define dso_local noundef i32 @main() #1 !dbg !14 {
39entry:
40  %retval = alloca i32, align 4
41  store i32 0, i32* %retval, align 4
42  %call = call noundef i32 @_Z3foov(), !dbg !15
43  ret i32 %call, !dbg !16
44}
45
46attributes #0 = { mustprogress noinline nounwind optnone uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
47attributes #1 = { mustprogress noinline norecurse nounwind optnone uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
48
49!llvm.dbg.cu = !{!0}
50!llvm.module.flags = !{!2, !3, !4, !5, !6}
51!llvm.ident = !{!7}
52
53!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang", isOptimized: false, runtimeVersion: 0, splitDebugFilename: "main.dwo", emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: GNU)
54!1 = !DIFile(filename: "main.cpp", directory: ".")
55!2 = !{i32 7, !"Dwarf Version", i32 4}
56!3 = !{i32 2, !"Debug Info Version", i32 3}
57!4 = !{i32 1, !"wchar_size", i32 4}
58!5 = !{i32 7, !"uwtable", i32 1}
59!6 = !{i32 7, !"frame-pointer", i32 2}
60!7 = !{!"clang"}
61!8 = distinct !DISubprogram(name: "foo", linkageName: "_Z3foov", scope: !1, file: !1, line: 1, type: !9, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !12)
62!9 = !DISubroutineType(types: !10)
63!10 = !{!11}
64!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
65!12 = !{}
66!13 = !DILocation(line: 2, column: 3, scope: !8)
67!14 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 5, type: !9, scopeLine: 5, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !12)
68!15 = !DILocation(line: 6, column: 10, scope: !14)
69!16 = !DILocation(line: 6, column: 3, scope: !14)
70