xref: /llvm-project/bolt/test/X86/dwarf5-df-dualcu.test (revision 11791ae7b0b05b8bd8d806331ff51da618912cf8)
1ba1ac98cSAlexander Yermolovich; RUN: rm -rf %t
2ba1ac98cSAlexander Yermolovich; RUN: mkdir %t
3ba1ac98cSAlexander Yermolovich; RUN: cd %t
4e51a6b73Szr33; RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-df-dualcu-main.s \
5e51a6b73Szr33; RUN: -split-dwarf-file=main.dwo -o main.o
6e51a6b73Szr33; RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-df-dualcu-helper.s \
7e51a6b73Szr33; RUN: -split-dwarf-file=helper.dwo -o helper.o
8a26aa79aSRafael Auler; RUN: %clang %cflags -gdwarf-5 -gsplit-dwarf=split main.o helper.o -o main.exe -fno-pic -no-pie
975f770a6SAlexander Yermolovich; RUN: llvm-bolt main.exe -o main.exe.bolt --update-debug-sections --always-convert-to-ranges
10ba1ac98cSAlexander Yermolovich; RUN: llvm-dwarfdump --show-form --verbose --debug-info main.exe | FileCheck -check-prefix=PRE-BOLT %s
11ba1ac98cSAlexander Yermolovich; RUN: llvm-dwarfdump --show-form --verbose --debug-addr main.exe.bolt &> %t/foo.txt
12ba1ac98cSAlexander Yermolovich; RUN: llvm-dwarfdump --show-form --verbose --debug-info main.exe.bolt >> %t/foo.txt
13ba1ac98cSAlexander Yermolovich; RUN: cat %t/foo.txt | FileCheck -check-prefix=BOLT %s
14ba1ac98cSAlexander Yermolovich; RUN: llvm-dwarfdump --show-form --verbose --debug-info main.dwo | FileCheck -check-prefix=PRE-BOLT-DWO-MAIN %s
15ba1ac98cSAlexander Yermolovich; RUN: llvm-dwarfdump --show-form --verbose --debug-info main.dwo.dwo | FileCheck -check-prefix=BOLT-DWO-MAIN %s
16ba1ac98cSAlexander Yermolovich; RUN: llvm-dwarfdump --show-form --verbose --debug-info helper.dwo | FileCheck -check-prefix=PRE-BOLT-DWO-HELPER %s
17ba1ac98cSAlexander Yermolovich; RUN: llvm-dwarfdump --show-form --verbose --debug-info helper.dwo.dwo | FileCheck -check-prefix=BOLT-DWO-HELPER %s
18ba1ac98cSAlexander Yermolovich
19*11791ae7SSayhaan Siddiqui;; Testing dwarf5 split dwarf for two CUs. Making sure DW_AT_low_pc/DW_AT_high_pc are converted correctly in the binary and in dwo.
20*11791ae7SSayhaan Siddiqui;; Checking that DW_AT_location [DW_FORM_exprloc]	(DW_OP_addrx ##) are updated correctly.
21ba1ac98cSAlexander Yermolovich
22ba1ac98cSAlexander Yermolovich; PRE-BOLT: version = 0x0005
23ba1ac98cSAlexander Yermolovich; PRE-BOLT: DW_TAG_skeleton_unit
24ba1ac98cSAlexander Yermolovich; PRE-BOLT: DW_AT_low_pc [DW_FORM_addrx]
25ba1ac98cSAlexander Yermolovich; PRE-BOLT-NEXT: DW_AT_high_pc [DW_FORM_data4]
26ba1ac98cSAlexander Yermolovich; PRE-BOLT: DW_AT_addr_base [DW_FORM_sec_offset]  (0x00000008)
27ba1ac98cSAlexander Yermolovich
28ba1ac98cSAlexander Yermolovich; BOLT: Addrs: [
29ba1ac98cSAlexander Yermolovich; BOLT-NEXT: 0x
30ba1ac98cSAlexander Yermolovich; BOLT-NEXT: 0x
31ba1ac98cSAlexander Yermolovich; BOLT-NEXT: 0x[[#%.16x,ADDR:]]
32ba1ac98cSAlexander Yermolovich; BOLT-NEXT: 0x[[#%.16x,ADDR2:]]
33ba1ac98cSAlexander Yermolovich; BOLT: Addrs: [
34ba1ac98cSAlexander Yermolovich; BOLT-NEXT: 0x
35ba1ac98cSAlexander Yermolovich; BOLT-NEXT: 0x
36ba1ac98cSAlexander Yermolovich; BOLT-NEXT: 0x[[#%.16x,ADDR3:]]
37ba1ac98cSAlexander Yermolovich; BOLT: DW_TAG_skeleton_unit
38ba1ac98cSAlexander Yermolovich; BOLT: DW_AT_dwo_name [DW_FORM_strx1]  (indexed (00000001) string = "main.dwo.dwo")
39efb8a1c9SAlexander Yermolovich; BOLT-NEXT: DW_AT_low_pc [DW_FORM_addrx]	(indexed (00000004) address = 0x0000000000000000)
40ba1ac98cSAlexander Yermolovich; BOLT-NEXT: DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x0) rangelist = 0x00000010
41ba1ac98cSAlexander Yermolovich; BOLT-NEXT: [0x[[#ADDR]]
42ba1ac98cSAlexander Yermolovich; BOLT-SAME: 0x[[#ADDR + 0x24]]
43ba1ac98cSAlexander Yermolovich; BOLT-NEXT: [0x[[#ADDR2]]
44ba1ac98cSAlexander Yermolovich; BOLT-SAME: 0x[[#ADDR2 + 0x59]]
45ba1ac98cSAlexander Yermolovich; BOLT-NEXT: DW_AT_addr_base [DW_FORM_sec_offset]  (0x00000008)
46ba1ac98cSAlexander Yermolovich; BOLT-NEXT: DW_AT_rnglists_base [DW_FORM_sec_offset]  (0x0000000c)
47ba1ac98cSAlexander Yermolovich; BOLT: DW_TAG_skeleton_unit
48ba1ac98cSAlexander Yermolovich; BOLT: DW_AT_dwo_name [DW_FORM_strx1]  (indexed (00000001) string = "helper.dwo.dwo")
49ba1ac98cSAlexander Yermolovich; BOLT-NEXT: DW_AT_low_pc [DW_FORM_addrx]	(indexed (00000003) address = 0x0000000000000000)
50e22ff52cSAlexander Yermolovich; BOLT-NEXT: DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x0) rangelist = 0x0000002a
51ba1ac98cSAlexander Yermolovich; BOLT-NEXT: [0x[[#ADDR3]]
52ba1ac98cSAlexander Yermolovich; BOLT-SAME: 0x[[#ADDR3 + 0x3D]]
53ba1ac98cSAlexander Yermolovich; BOLT-NEXT: DW_AT_addr_base [DW_FORM_sec_offset]  (0x00000038)
54e22ff52cSAlexander Yermolovich; BOLT-NEXT: DW_AT_rnglists_base [DW_FORM_sec_offset]  (0x00000026)
55ba1ac98cSAlexander Yermolovich
56ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-MAIN: version = 0x0005
57ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-MAIN: DW_TAG_compile_unit
58ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-MAIN: DW_TAG_variable [2]
59ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_name [DW_FORM_strx1]	(indexed (00000000) string = "x")
60ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_type
61ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_external
62ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_decl_file
63ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_decl_line
64ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_location [DW_FORM_exprloc]	(DW_OP_addrx 0x0)
65ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-MAIN: DW_TAG_variable [2]
66ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_name [DW_FORM_strx1]	(indexed (00000002) string = "y")
67ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_type
68ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_external
69ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_decl_file
70ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_decl_line
71ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_location [DW_FORM_exprloc]	(DW_OP_addrx 0x1)
72ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-MAIN: DW_TAG_subprogram
73ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_low_pc [DW_FORM_addrx]	(indexed (00000002)
74ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_high_pc [DW_FORM_data4]	(0x00000024)
75ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_frame_base
76ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_linkage_name [DW_FORM_strx1]	(indexed (00000003) string = "_Z3usePiS_")
77ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_name [DW_FORM_strx1]	(indexed (00000004) string = "use")
78ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-MAIN: DW_TAG_subprogram
79ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_low_pc [DW_FORM_addrx]	(indexed (00000003)
80ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_high_pc [DW_FORM_data4]	(0x0000005f)
81ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_frame_base
82ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-MAIN-NEXT: DW_AT_name [DW_FORM_strx1]	(indexed (00000005) string = "main")
83ba1ac98cSAlexander Yermolovich
84ba1ac98cSAlexander Yermolovich; BOLT-DWO-MAIN: DW_TAG_compile_unit
85ba1ac98cSAlexander Yermolovich; BOLT-DWO-MAIN: DW_TAG_variable [2]
86ba1ac98cSAlexander Yermolovich; BOLT-DWO-MAIN-NEXT: DW_AT_name [DW_FORM_strx1]	(indexed (00000000) string = "x")
87ba1ac98cSAlexander Yermolovich; BOLT-DWO-MAIN-NEXT: DW_AT_type
88ba1ac98cSAlexander Yermolovich; BOLT-DWO-MAIN-NEXT: DW_AT_external
89ba1ac98cSAlexander Yermolovich; BOLT-DWO-MAIN-NEXT: DW_AT_decl_file
90ba1ac98cSAlexander Yermolovich; BOLT-DWO-MAIN-NEXT: DW_AT_decl_line
91ba1ac98cSAlexander Yermolovich; BOLT-DWO-MAIN-NEXT: DW_AT_location [DW_FORM_exprloc]	(DW_OP_addrx 0x0)
92ba1ac98cSAlexander Yermolovich; BOLT-DWO-MAIN: DW_TAG_variable [2]
93ba1ac98cSAlexander Yermolovich; BOLT-DWO-MAIN-NEXT: DW_AT_name [DW_FORM_strx1]	(indexed (00000002) string = "y")
94ba1ac98cSAlexander Yermolovich; BOLT-DWO-MAIN-NEXT: DW_AT_type
95ba1ac98cSAlexander Yermolovich; BOLT-DWO-MAIN-NEXT: DW_AT_external
96ba1ac98cSAlexander Yermolovich; BOLT-DWO-MAIN-NEXT: DW_AT_decl_file
97ba1ac98cSAlexander Yermolovich; BOLT-DWO-MAIN-NEXT: DW_AT_decl_line
98ba1ac98cSAlexander Yermolovich; BOLT-DWO-MAIN-NEXT: DW_AT_location [DW_FORM_exprloc]	(DW_OP_addrx 0x1)
99ba1ac98cSAlexander Yermolovich; BOLT-DWO-MAIN: DW_TAG_subprogram [4]
100ba1ac98cSAlexander Yermolovich; BOLT-DWO-MAIN-NEXT: DW_AT_ranges [DW_FORM_rnglistx]	(indexed (0x0) rangelist = 0x00000014
101ba1ac98cSAlexander Yermolovich; BOLT-DWO-MAIN-NEXT: [0x0000000000000000, 0x0000000000000024))
102ba1ac98cSAlexander Yermolovich; BOLT-DWO-MAIN-NEXT: DW_AT_frame_base
103ba1ac98cSAlexander Yermolovich; BOLT-DWO-MAIN-NEXT: DW_AT_linkage_name [DW_FORM_strx1]	(indexed (00000003) string = "_Z3usePiS_")
104ba1ac98cSAlexander Yermolovich; BOLT-DWO-MAIN-NEXT: DW_AT_name [DW_FORM_strx1]	(indexed (00000004) string = "use")
105ba1ac98cSAlexander Yermolovich; BOLT-DWO-MAIN: DW_TAG_subprogram [6]
106ba1ac98cSAlexander Yermolovich; BOLT-DWO-MAIN-NEXT: DW_AT_ranges [DW_FORM_rnglistx]	(indexed (0x1) rangelist = 0x00000018
107ba1ac98cSAlexander Yermolovich; BOLT-DWO-MAIN-NEXT: [0x0000000000000000, 0x0000000000000059))
108ba1ac98cSAlexander Yermolovich; BOLT-DWO-MAIN-NEXT: DW_AT_frame_base [DW_FORM_exprloc]	(DW_OP_reg6 RBP)
109ba1ac98cSAlexander Yermolovich; BOLT-DWO-MAIN-NEXT: DW_AT_name [DW_FORM_strx1]	(indexed (00000005) string = "main")
110ba1ac98cSAlexander Yermolovich
111ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-HELPER: version = 0x0005
112ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-HELPER: DW_TAG_variable [2]
113ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-HELPER-NEXT: DW_AT_name [DW_FORM_strx1]	(indexed (00000000) string = "z")
114ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-HELPER-NEXT: DW_AT_type
115ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-HELPER-NEXT: DW_AT_external
116ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-HELPER-NEXT: DW_AT_decl_file
117ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-HELPER-NEXT: DW_AT_decl_line
118ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-HELPER-NEXT: DW_AT_location [DW_FORM_exprloc]	(DW_OP_addrx 0x0)
119ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-HELPER: DW_TAG_variable [2]
120ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-HELPER-NEXT: DW_AT_name [DW_FORM_strx1]	(indexed (00000002) string = "d")
121ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-HELPER-NEXT: DW_AT_type
122ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-HELPER-NEXT: DW_AT_external
123ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-HELPER-NEXT: DW_AT_decl_file
124ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-HELPER-NEXT: DW_AT_decl_line
125ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-HELPER-NEXT: DW_AT_location [DW_FORM_exprloc]	(DW_OP_addrx 0x1)
126ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-HELPER: DW_TAG_subprogram [4]
127ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-HELPER-NEXT: DW_AT_low_pc [DW_FORM_addrx]	(indexed (00000002)
128ba1ac98cSAlexander Yermolovich; PRE-BOLT-DWO-HELPER-NEXT: DW_AT_high_pc [DW_FORM_data4]	(0x0000003d)
129ba1ac98cSAlexander Yermolovich
130ba1ac98cSAlexander Yermolovich; BOLT-DWO-HELPER: version = 0x0005
131ba1ac98cSAlexander Yermolovich; BOLT-DWO-HELPER: DW_TAG_variable [2]
132ba1ac98cSAlexander Yermolovich; BOLT-DWO-HELPER-NEXT: DW_AT_name [DW_FORM_strx1]	(indexed (00000000) string = "z")
133ba1ac98cSAlexander Yermolovich; BOLT-DWO-HELPER-NEXT: DW_AT_type
134ba1ac98cSAlexander Yermolovich; BOLT-DWO-HELPER-NEXT: DW_AT_external
135ba1ac98cSAlexander Yermolovich; BOLT-DWO-HELPER-NEXT: DW_AT_decl_file
136ba1ac98cSAlexander Yermolovich; BOLT-DWO-HELPER-NEXT: DW_AT_decl_line
137ba1ac98cSAlexander Yermolovich; BOLT-DWO-HELPER-NEXT: DW_AT_location [DW_FORM_exprloc]	(DW_OP_addrx 0x0)
138ba1ac98cSAlexander Yermolovich; BOLT-DWO-HELPER: DW_TAG_variable [2]
139ba1ac98cSAlexander Yermolovich; BOLT-DWO-HELPER-NEXT: DW_AT_name [DW_FORM_strx1]	(indexed (00000002) string = "d")
140ba1ac98cSAlexander Yermolovich; BOLT-DWO-HELPER-NEXT: DW_AT_type
141ba1ac98cSAlexander Yermolovich; BOLT-DWO-HELPER-NEXT: DW_AT_external
142ba1ac98cSAlexander Yermolovich; BOLT-DWO-HELPER-NEXT: DW_AT_decl_file
143ba1ac98cSAlexander Yermolovich; BOLT-DWO-HELPER-NEXT: DW_AT_decl_line
144ba1ac98cSAlexander Yermolovich; BOLT-DWO-HELPER-NEXT: DW_AT_location [DW_FORM_exprloc]	(DW_OP_addrx 0x1)
145ba1ac98cSAlexander Yermolovich; BOLT-DWO-HELPER: DW_TAG_subprogram [4]
146ba1ac98cSAlexander Yermolovich; BOLT-DWO-HELPER-NEXT: DW_AT_ranges [DW_FORM_rnglistx]	(indexed (0x0) rangelist = 0x00000010
147ba1ac98cSAlexander Yermolovich; BOLT-DWO-HELPER-NEXT: [0x0000000000000000, 0x000000000000003d))
148