1*bd1ebe9dSAlexander Yermolovich; RUN: rm -rf %t
2*bd1ebe9dSAlexander Yermolovich; RUN: mkdir %t
3*bd1ebe9dSAlexander Yermolovich; RUN: cd %t
4*bd1ebe9dSAlexander Yermolovich; 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*bd1ebe9dSAlexander Yermolovich; RUN: %clang %cflags foo.o -o foo.exe
6*bd1ebe9dSAlexander Yermolovich; RUN: llvm-bolt foo.exe -o foo.exe.bolt --update-debug-sections
7*bd1ebe9dSAlexander Yermolovich; RUN: llvm-dwarfdump --debug-info foo.exe | FileCheck -check-prefix=PRE-BOLT %s
8*bd1ebe9dSAlexander Yermolovich; RUN: llvm-dwarfdump --debug-info foo.exe.bolt | FileCheck %s
9*bd1ebe9dSAlexander Yermolovich
10*bd1ebe9dSAlexander Yermolovich; This tests checks that DW_AT_GNU_ranges_base is added at the end of the CU.
11*bd1ebe9dSAlexander Yermolovich
12*bd1ebe9dSAlexander Yermolovich; PRE-BOLT: DW_AT_GNU_addr_base
13*bd1ebe9dSAlexander Yermolovich; PRE-BOLT-NOT: DW_AT_GNU_ranges_base
14*bd1ebe9dSAlexander Yermolovich
15*bd1ebe9dSAlexander Yermolovich; CHECK: DW_AT_GNU_addr_base
16*bd1ebe9dSAlexander Yermolovich; CHECK-NEXT: DW_AT_GNU_ranges_base
17*bd1ebe9dSAlexander Yermolovich
18*bd1ebe9dSAlexander Yermolovich; int foo() {
19*bd1ebe9dSAlexander Yermolovich;   return 3;
20*bd1ebe9dSAlexander Yermolovich; }
21*bd1ebe9dSAlexander Yermolovich;
22*bd1ebe9dSAlexander Yermolovich; int main() {
23*bd1ebe9dSAlexander Yermolovich;   return foo();
24*bd1ebe9dSAlexander Yermolovich; }
25*bd1ebe9dSAlexander Yermolovich
26*bd1ebe9dSAlexander Yermolovich; ModuleID = 'main.cpp'
27*bd1ebe9dSAlexander Yermolovichsource_filename = "main.cpp"
28*bd1ebe9dSAlexander Yermolovichtarget datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
29*bd1ebe9dSAlexander Yermolovichtarget triple = "x86_64-unknown-linux-gnu"
30*bd1ebe9dSAlexander Yermolovich
31*bd1ebe9dSAlexander Yermolovich; Function Attrs: mustprogress noinline nounwind optnone uwtable
32*bd1ebe9dSAlexander Yermolovichdefine dso_local noundef i32 @_Z3foov() #0 !dbg !8 {
33*bd1ebe9dSAlexander Yermolovichentry:
34*bd1ebe9dSAlexander Yermolovich  ret i32 3, !dbg !13
35*bd1ebe9dSAlexander Yermolovich}
36*bd1ebe9dSAlexander Yermolovich
37*bd1ebe9dSAlexander Yermolovich; Function Attrs: mustprogress noinline norecurse nounwind optnone uwtable
38*bd1ebe9dSAlexander Yermolovichdefine dso_local noundef i32 @main() #1 !dbg !14 {
39*bd1ebe9dSAlexander Yermolovichentry:
40*bd1ebe9dSAlexander Yermolovich  %retval = alloca i32, align 4
41*bd1ebe9dSAlexander Yermolovich  store i32 0, i32* %retval, align 4
42*bd1ebe9dSAlexander Yermolovich  %call = call noundef i32 @_Z3foov(), !dbg !15
43*bd1ebe9dSAlexander Yermolovich  ret i32 %call, !dbg !16
44*bd1ebe9dSAlexander Yermolovich}
45*bd1ebe9dSAlexander Yermolovich
46*bd1ebe9dSAlexander Yermolovichattributes #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" }
47*bd1ebe9dSAlexander Yermolovichattributes #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*bd1ebe9dSAlexander Yermolovich
49*bd1ebe9dSAlexander Yermolovich!llvm.dbg.cu = !{!0}
50*bd1ebe9dSAlexander Yermolovich!llvm.module.flags = !{!2, !3, !4, !5, !6}
51*bd1ebe9dSAlexander Yermolovich!llvm.ident = !{!7}
52*bd1ebe9dSAlexander Yermolovich
53*bd1ebe9dSAlexander Yermolovich!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*bd1ebe9dSAlexander Yermolovich!1 = !DIFile(filename: "main.cpp", directory: ".")
55*bd1ebe9dSAlexander Yermolovich!2 = !{i32 7, !"Dwarf Version", i32 4}
56*bd1ebe9dSAlexander Yermolovich!3 = !{i32 2, !"Debug Info Version", i32 3}
57*bd1ebe9dSAlexander Yermolovich!4 = !{i32 1, !"wchar_size", i32 4}
58*bd1ebe9dSAlexander Yermolovich!5 = !{i32 7, !"uwtable", i32 1}
59*bd1ebe9dSAlexander Yermolovich!6 = !{i32 7, !"frame-pointer", i32 2}
60*bd1ebe9dSAlexander Yermolovich!7 = !{!"clang"}
61*bd1ebe9dSAlexander Yermolovich!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*bd1ebe9dSAlexander Yermolovich!9 = !DISubroutineType(types: !10)
63*bd1ebe9dSAlexander Yermolovich!10 = !{!11}
64*bd1ebe9dSAlexander Yermolovich!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
65*bd1ebe9dSAlexander Yermolovich!12 = !{}
66*bd1ebe9dSAlexander Yermolovich!13 = !DILocation(line: 2, column: 3, scope: !8)
67*bd1ebe9dSAlexander Yermolovich!14 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 5, type: !9, scopeLine: 5, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !12)
68*bd1ebe9dSAlexander Yermolovich!15 = !DILocation(line: 6, column: 10, scope: !14)
69*bd1ebe9dSAlexander Yermolovich!16 = !DILocation(line: 6, column: 3, scope: !14)
70