xref: /llvm-project/bolt/test/X86/insert-addr-rnglists_base.s (revision 11791ae7b0b05b8bd8d806331ff51da618912cf8)
1# REQUIRES: system-linux
2
3# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %s -o %t1.o
4# RUN: %clang %cflags -dwarf-5 %t1.o -o %t.exe -Wl,-q
5# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections
6# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.exe | FileCheck --check-prefix=PRECHECK %s
7# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.bolt | FileCheck --check-prefix=POSTCHECK %s
8
9## This test checks we correctly insert DW_AT_addr_base, when converting DW_AT_low_pc into DW_AT_ranges.
10## PRECHECK-NOT: DW_AT_addr_base
11
12# POSTCHECK: DW_AT_ranges [DW_FORM_rnglistx]
13# POSTCHECK: DW_AT_rnglists_base [DW_FORM_sec_offset]	(0x0000000c)
14# POSTCHECK-NEXT: DW_AT_addr_base [DW_FORM_sec_offset]	(0x00000008)
15
16# int main() {
17#    return 0;
18# }
19
20
21	.file	"main.cpp"
22	.text
23.Ltext0:
24	.globl	main
25	.type	main, @function
26main:
27.LFB0:
28	.file 1 "main.cpp"
29	.loc 1 1 12
30	.cfi_startproc
31	pushq	%rbp
32	.cfi_def_cfa_offset 16
33	.cfi_offset 6, -16
34	movq	%rsp, %rbp
35	.cfi_def_cfa_register 6
36	.loc 1 2 10
37	movl	$0, %eax
38	.loc 1 3 1
39	popq	%rbp
40	.cfi_def_cfa 7, 8
41	ret
42	.cfi_endproc
43.LFE0:
44	.size	main, .-main
45.Letext0:
46	.section	.debug_info,"",@progbits
47.Ldebug_info0:
48	.long	0x50
49	.value	0x5
50	.byte	0x1
51	.byte	0x8
52	.long	.Ldebug_abbrev0
53	.uleb128 0x1
54	.long	.LASF0
55	.byte	0x21
56	.long	.LASF1
57	.long	.LASF2
58	.quad	.Ltext0
59	.quad	.Letext0-.Ltext0
60	.long	.Ldebug_line0
61	.uleb128 0x2
62	.long	.LASF3
63	.byte	0x1
64	.byte	0x1
65	.byte	0x5
66	.long	0x4c
67	.quad	.LFB0
68	.quad	.LFE0-.LFB0
69	.uleb128 0x1
70	.byte	0x9c
71	.uleb128 0x3
72	.byte	0x4
73	.byte	0x5
74	.string	"int"
75	.byte	0
76	.section	.debug_abbrev,"",@progbits
77.Ldebug_abbrev0:
78	.uleb128 0x1
79	.uleb128 0x11
80	.byte	0x1
81	.uleb128 0x25
82	.uleb128 0xe
83	.uleb128 0x13
84	.uleb128 0xb
85	.uleb128 0x3
86	.uleb128 0xe
87	.uleb128 0x1b
88	.uleb128 0xe
89	.uleb128 0x11
90	.uleb128 0x1
91	.uleb128 0x12
92	.uleb128 0x7
93	.uleb128 0x10
94	.uleb128 0x17
95	.byte	0
96	.byte	0
97	.uleb128 0x2
98	.uleb128 0x2e
99	.byte	0
100	.uleb128 0x3f
101	.uleb128 0x19
102	.uleb128 0x3
103	.uleb128 0xe
104	.uleb128 0x3a
105	.uleb128 0xb
106	.uleb128 0x3b
107	.uleb128 0xb
108	.uleb128 0x39
109	.uleb128 0xb
110	.uleb128 0x49
111	.uleb128 0x13
112	.uleb128 0x11
113	.uleb128 0x1
114	.uleb128 0x12
115	.uleb128 0x7
116	.uleb128 0x40
117	.uleb128 0x18
118	.uleb128 0x7a
119	.uleb128 0x19
120	.byte	0
121	.byte	0
122	.uleb128 0x3
123	.uleb128 0x24
124	.byte	0
125	.uleb128 0xb
126	.uleb128 0xb
127	.uleb128 0x3e
128	.uleb128 0xb
129	.uleb128 0x3
130	.uleb128 0x8
131	.byte	0
132	.byte	0
133	.byte	0
134	.section	.debug_aranges,"",@progbits
135	.long	0x2c
136	.value	0x2
137	.long	.Ldebug_info0
138	.byte	0x8
139	.byte	0
140	.value	0
141	.value	0
142	.quad	.Ltext0
143	.quad	.Letext0-.Ltext0
144	.quad	0
145	.quad	0
146	.section	.debug_line,"",@progbits
147.Ldebug_line0:
148	.section	.debug_str,"MS",@progbits,1
149.LASF0:
150	.string	"GNU C++14 8.5.0 20210514 (Red Hat 8.5.0-3) -mtune=generic -march=x86-64 -g2 -gdwarf-5"
151.LASF1:
152	.string	"main.cpp"
153.LASF3:
154	.string	"main"
155.LASF2:
156	.string	"."
157	.ident	"GCC: (GNU) 8.5.0 20210514 (Red Hat 8.5.0-3)"
158	.section	.note.GNU-stack,"",@progbits
159