xref: /llvm-project/bolt/test/X86/dwarf5-locaddrx.test (revision 11791ae7b0b05b8bd8d806331ff51da618912cf8)
1; RUN: rm -rf %t
2; RUN: mkdir %t
3; RUN: cd %t
4; RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-locaddrx.s \
5; RUN: -split-dwarf-file=mainlocadddrx.dwo -o mainlocadddrx.o
6; RUN: %clang %cflags -gdwarf-5 -gsplit-dwarf=split mainlocadddrx.o -o mainlocadddrx.exe -fno-pic -no-pie
7; RUN: llvm-bolt mainlocadddrx.exe -o mainlocadddrx.exe.bolt --update-debug-sections --always-convert-to-ranges
8; RUN: llvm-dwarfdump --show-form --verbose --debug-info mainlocadddrx.exe | FileCheck -check-prefix=PRE-BOLT %s
9; RUN: llvm-dwarfdump --show-form --verbose --debug-addr mainlocadddrx.exe.bolt &> %t/foo.txt
10; RUN: llvm-dwarfdump --show-form --verbose --debug-info mainlocadddrx.exe.bolt >> %t/foo.txt
11; RUN: cat %t/foo.txt | FileCheck -check-prefix=BOLT %s
12; RUN: llvm-dwarfdump --show-form --verbose --debug-info mainlocadddrx.dwo | FileCheck -check-prefix=PRE-BOLT-DWO %s
13; RUN: llvm-dwarfdump --show-form --verbose --debug-info mainlocadddrx.dwo.dwo | FileCheck -check-prefix=BOLT-DWO %s
14
15;; Testing dwarf5 split dwarf. Making sure DW_AT_low_pc/DW_AT_high_pc are converted correctly in the binary and in dwo.
16;; Checking that DW_AT_location [DW_FORM_exprloc]	(DW_OP_addrx 0x0) is updated correctly.
17
18; PRE-BOLT: version = 0x0005
19; PRE-BOLT: DW_TAG_skeleton_unit
20; PRE-BOLT: DW_AT_low_pc [DW_FORM_addrx]
21; PRE-BOLT-NEXT: DW_AT_high_pc [DW_FORM_data4]
22; PRE-BOLT: DW_AT_addr_base [DW_FORM_sec_offset]  (0x00000008)
23
24; BOLT: Addrs: [
25; BOLT-NEXT: 0x
26; BOLT-NEXT: 0x
27; BOLT-NEXT: 0x[[#%.16x,ADDR:]]
28; BOLT-NEXT: 0x[[#%.16x,ADDR2:]]
29; BOLT: DW_TAG_skeleton_unit
30; BOLT: DW_AT_low_pc [DW_FORM_addrx]	(indexed (00000004) address = 0x0000000000000000)
31; BOLT-NEXT: DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x0) rangelist = 0x00000010
32; BOLT-NEXT: [0x[[#ADDR]]
33; BOLT-SAME: 0x[[#ADDR + 0x24]]
34; BOLT-NEXT: [0x[[#ADDR2]]
35; BOLT-SAME: 0x[[#ADDR2 + 0x54]]
36; BOLT-NEXT: DW_AT_addr_base [DW_FORM_sec_offset]  (0x00000008)
37; BOLT-NEXT: DW_AT_rnglists_base [DW_FORM_sec_offset]  (0x0000000c)
38
39; PRE-BOLT-DWO: version = 0x0005
40; PRE-BOLT-DWO: DW_TAG_compile_unit
41; PRE-BOLT-DWO: DW_TAG_variable [2]
42; PRE-BOLT-DWO-NEXT: DW_AT_name [DW_FORM_strx1]	(indexed (00000000) string = "x")
43; PRE-BOLT-DWO-NEXT: DW_AT_type
44; PRE-BOLT-DWO-NEXT: DW_AT_external
45; PRE-BOLT-DWO-NEXT: DW_AT_decl_file
46; PRE-BOLT-DWO-NEXT: DW_AT_decl_line
47; PRE-BOLT-DWO-NEXT: DW_AT_location [DW_FORM_exprloc]	(DW_OP_addrx 0x0)
48; PRE-BOLT-DWO: DW_TAG_variable [2]
49; PRE-BOLT-DWO-NEXT: DW_AT_name [DW_FORM_strx1]	(indexed (00000002) string = "y")
50; PRE-BOLT-DWO-NEXT: DW_AT_type
51; PRE-BOLT-DWO-NEXT: DW_AT_external
52; PRE-BOLT-DWO-NEXT: DW_AT_decl_file
53; PRE-BOLT-DWO-NEXT: DW_AT_decl_line
54; PRE-BOLT-DWO-NEXT: DW_AT_location [DW_FORM_exprloc]	(DW_OP_addrx 0x1)
55; PRE-BOLT-DWO: DW_TAG_subprogram
56; PRE-BOLT-DWO-NEXT: DW_AT_low_pc [DW_FORM_addrx]	(indexed (00000002)
57; PRE-BOLT-DWO-NEXT: DW_AT_high_pc [DW_FORM_data4]	(0x00000024)
58; PRE-BOLT-DWO: DW_TAG_subprogram
59; PRE-BOLT-DWO-NEXT: DW_AT_low_pc [DW_FORM_addrx]	(indexed (00000003)
60; PRE-BOLT-DWO-NEXT: DW_AT_high_pc [DW_FORM_data4]	(0x0000005a)
61
62; BOLT-DWO: DW_TAG_compile_unit
63; BOLT-DWO: DW_TAG_variable [2]
64; BOLT-DWO-NEXT: DW_AT_name [DW_FORM_strx1]	(indexed (00000000) string = "x")
65; BOLT-DWO-NEXT: DW_AT_type
66; BOLT-DWO-NEXT: DW_AT_external
67; BOLT-DWO-NEXT: DW_AT_decl_file
68; BOLT-DWO-NEXT: DW_AT_decl_line
69; BOLT-DWO-NEXT: DW_AT_location [DW_FORM_exprloc]	(DW_OP_addrx 0x0)
70; BOLT-DWO: DW_TAG_variable [2]
71; BOLT-DWO-NEXT: DW_AT_name [DW_FORM_strx1]	(indexed (00000002) string = "y")
72; BOLT-DWO-NEXT: DW_AT_type
73; BOLT-DWO-NEXT: DW_AT_external
74; BOLT-DWO-NEXT: DW_AT_decl_file
75; BOLT-DWO-NEXT: DW_AT_decl_line
76; BOLT-DWO-NEXT: DW_AT_location [DW_FORM_exprloc]	(DW_OP_addrx 0x1)
77; BOLT-DWO: DW_TAG_subprogram [4]
78; BOLT-DWO-NEXT: DW_AT_ranges [DW_FORM_rnglistx]	(indexed (0x0) rangelist = 0x00000014
79; BOLT-DWO-NEXT: [0x0000000000000000, 0x0000000000000024))
80; BOLT-DWO: DW_TAG_subprogram [6]
81; BOLT-DWO-NEXT: DW_AT_ranges [DW_FORM_rnglistx]	(indexed (0x1) rangelist = 0x00000018
82; BOLT-DWO-NEXT: [0x0000000000000000, 0x0000000000000054))
83