xref: /llvm-project/bolt/test/X86/high_pc_udata.s (revision 11791ae7b0b05b8bd8d806331ff51da618912cf8)
1a44fe319SAlexander Yermolovich# REQUIRES: system-linux
2a44fe319SAlexander Yermolovich
3a44fe319SAlexander Yermolovich# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-linux %s -o %t1.o
4a44fe319SAlexander Yermolovich# RUN: %clang %cflags %t1.o -o %t.exe -Wl,-q
5d648aa1bSMaksim Panchenko# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections
6a44fe319SAlexander Yermolovich# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.exe | FileCheck --check-prefix=PRECHECK %s
7a44fe319SAlexander Yermolovich# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.bolt | FileCheck --check-prefix=POSTCHECK %s
8a44fe319SAlexander Yermolovich
9a44fe319SAlexander Yermolovich# PRECHECK: DW_AT_high_pc [DW_FORM_udata]	(15)
10a44fe319SAlexander Yermolovich# PRECHECK-NEXT: DW_AT_name [DW_FORM_strp]
11a44fe319SAlexander Yermolovich# PRECHECK-SAME: "main.cpp"
12a44fe319SAlexander Yermolovich
13a44fe319SAlexander Yermolovich# POSTCHECK: DW_AT_ranges [DW_FORM_sec_offset]
14a44fe319SAlexander Yermolovich# POSTCHECK-NEXT: [
15a44fe319SAlexander Yermolovich# POSTCHECK-NEXT: DW_AT_name [DW_FORM_strp]
16a44fe319SAlexander Yermolovich# POSTCHECK-SAME: "main.cpp"
17a44fe319SAlexander Yermolovich
18*11791ae7SSayhaan Siddiqui## Testing that BOLT transforms DW_AT_high_pc of form DW_FORM_udata correctly into DW_AT_ranges.
19*11791ae7SSayhaan Siddiqui## Manually changed so that DW_AT_high_pc is DW_FORM_udata, and that DW_AT_name is after it.
20a44fe319SAlexander Yermolovich# int main() {
21a44fe319SAlexander Yermolovich#    return 0;
22a44fe319SAlexander Yermolovich# }
23a44fe319SAlexander Yermolovich.text
24a44fe319SAlexander Yermolovich	.file	"main.cpp"
25a44fe319SAlexander Yermolovich	.globl	main                            # -- Begin function main
26a44fe319SAlexander Yermolovich	.p2align	4, 0x90
27a44fe319SAlexander Yermolovich	.type	main,@function
28a44fe319SAlexander Yermolovichmain:                                   # @main
29a44fe319SAlexander Yermolovich.Lfunc_begin0:
30a44fe319SAlexander Yermolovich	.file	1 "" "main.cpp"
31a44fe319SAlexander Yermolovich	.loc	1 1 0                           # main.cpp:1:0
32a44fe319SAlexander Yermolovich	.cfi_startproc
33a44fe319SAlexander Yermolovich# %bb.0:                                # %entry
34a44fe319SAlexander Yermolovich	pushq	%rbp
35a44fe319SAlexander Yermolovich	.cfi_def_cfa_offset 16
36a44fe319SAlexander Yermolovich	.cfi_offset %rbp, -16
37a44fe319SAlexander Yermolovich	movq	%rsp, %rbp
38a44fe319SAlexander Yermolovich	.cfi_def_cfa_register %rbp
39a44fe319SAlexander Yermolovich	movl	$0, -4(%rbp)
40a44fe319SAlexander Yermolovich.Ltmp0:
41a44fe319SAlexander Yermolovich	.loc	1 2 1 prologue_end              # main.cpp:2:1
42a44fe319SAlexander Yermolovich	xorl	%eax, %eax
43a44fe319SAlexander Yermolovich	popq	%rbp
44a44fe319SAlexander Yermolovich	.cfi_def_cfa %rsp, 8
45a44fe319SAlexander Yermolovich	retq
46a44fe319SAlexander Yermolovich.Ltmp1:
47a44fe319SAlexander Yermolovich.Lfunc_end0:
48a44fe319SAlexander Yermolovich	.size	main, .Lfunc_end0-main
49a44fe319SAlexander Yermolovich	.cfi_endproc
50a44fe319SAlexander Yermolovich                                        # -- End function
51a44fe319SAlexander Yermolovich	.section	.debug_abbrev,"",@progbits
52a44fe319SAlexander Yermolovich	.byte	1                               # Abbreviation Code
53a44fe319SAlexander Yermolovich	.byte	17                              # DW_TAG_compile_unit
54a44fe319SAlexander Yermolovich	.byte	1                               # DW_CHILDREN_yes
55a44fe319SAlexander Yermolovich	.byte	37                              # DW_AT_producer
56a44fe319SAlexander Yermolovich	.byte	14                              # DW_FORM_strp
57a44fe319SAlexander Yermolovich	.byte	19                              # DW_AT_language
58a44fe319SAlexander Yermolovich	.byte	5                               # DW_FORM_data2
59a44fe319SAlexander Yermolovich	.byte	16                              # DW_AT_stmt_list
60a44fe319SAlexander Yermolovich	.byte	23                              # DW_FORM_sec_offset
61a44fe319SAlexander Yermolovich	.byte	27                              # DW_AT_comp_dir
62a44fe319SAlexander Yermolovich	.byte	14                              # DW_FORM_strp
63a44fe319SAlexander Yermolovich	.byte	17                              # DW_AT_low_pc
64a44fe319SAlexander Yermolovich	.byte	1                               # DW_FORM_addr
65a44fe319SAlexander Yermolovich	.byte	18                              # DW_AT_high_pc
66a44fe319SAlexander Yermolovich	.byte	15                              # DW_FORM_udata
67a44fe319SAlexander Yermolovich	.byte	3                               # DW_AT_name
68a44fe319SAlexander Yermolovich	.byte	14                              # DW_FORM_strp
69a44fe319SAlexander Yermolovich	.byte	0                               # EOM(1)
70a44fe319SAlexander Yermolovich	.byte	0                               # EOM(2)
71a44fe319SAlexander Yermolovich	.byte	2                               # Abbreviation Code
72a44fe319SAlexander Yermolovich	.byte	46                              # DW_TAG_subprogram
73a44fe319SAlexander Yermolovich	.byte	0                               # DW_CHILDREN_no
74a44fe319SAlexander Yermolovich	.byte	17                              # DW_AT_low_pc
75a44fe319SAlexander Yermolovich	.byte	1                               # DW_FORM_addr
76a44fe319SAlexander Yermolovich	.byte	18                              # DW_AT_high_pc
77a44fe319SAlexander Yermolovich	.byte	6                               # DW_FORM_data4
78a44fe319SAlexander Yermolovich	.byte	64                              # DW_AT_frame_base
79a44fe319SAlexander Yermolovich	.byte	24                              # DW_FORM_exprloc
80a44fe319SAlexander Yermolovich	.byte	3                               # DW_AT_name
81a44fe319SAlexander Yermolovich	.byte	14                              # DW_FORM_strp
82a44fe319SAlexander Yermolovich	.byte	58                              # DW_AT_decl_file
83a44fe319SAlexander Yermolovich	.byte	11                              # DW_FORM_data1
84a44fe319SAlexander Yermolovich	.byte	59                              # DW_AT_decl_line
85a44fe319SAlexander Yermolovich	.byte	11                              # DW_FORM_data1
86a44fe319SAlexander Yermolovich	.byte	73                              # DW_AT_type
87a44fe319SAlexander Yermolovich	.byte	19                              # DW_FORM_ref4
88a44fe319SAlexander Yermolovich	.byte	63                              # DW_AT_external
89a44fe319SAlexander Yermolovich	.byte	25                              # DW_FORM_flag_present
90a44fe319SAlexander Yermolovich	.byte	0                               # EOM(1)
91a44fe319SAlexander Yermolovich	.byte	0                               # EOM(2)
92a44fe319SAlexander Yermolovich	.byte	3                               # Abbreviation Code
93a44fe319SAlexander Yermolovich	.byte	36                              # DW_TAG_base_type
94a44fe319SAlexander Yermolovich	.byte	0                               # DW_CHILDREN_no
95a44fe319SAlexander Yermolovich	.byte	3                               # DW_AT_name
96a44fe319SAlexander Yermolovich	.byte	14                              # DW_FORM_strp
97a44fe319SAlexander Yermolovich	.byte	62                              # DW_AT_encoding
98a44fe319SAlexander Yermolovich	.byte	11                              # DW_FORM_data1
99a44fe319SAlexander Yermolovich	.byte	11                              # DW_AT_byte_size
100a44fe319SAlexander Yermolovich	.byte	11                              # DW_FORM_data1
101a44fe319SAlexander Yermolovich	.byte	0                               # EOM(1)
102a44fe319SAlexander Yermolovich	.byte	0                               # EOM(2)
103a44fe319SAlexander Yermolovich	.byte	0                               # EOM(3)
104a44fe319SAlexander Yermolovich	.section	.debug_info,"",@progbits
105a44fe319SAlexander Yermolovich.Lcu_begin0:
106a44fe319SAlexander Yermolovich	.long	.Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
107a44fe319SAlexander Yermolovich.Ldebug_info_start0:
108a44fe319SAlexander Yermolovich	.short	4                               # DWARF version number
109a44fe319SAlexander Yermolovich	.long	.debug_abbrev                   # Offset Into Abbrev. Section
110a44fe319SAlexander Yermolovich	.byte	8                               # Address Size (in bytes)
111a44fe319SAlexander Yermolovich	.byte	1                               # Abbrev [1] 0xb:0x40 DW_TAG_compile_unit
112a44fe319SAlexander Yermolovich	.long	.Linfo_string0                  # DW_AT_producer
113a44fe319SAlexander Yermolovich	.short	33                              # DW_AT_language
114a44fe319SAlexander Yermolovich	.long	.Lline_table_start0             # DW_AT_stmt_list
115a44fe319SAlexander Yermolovich	.long	.Linfo_string2                  # DW_AT_comp_dir
116a44fe319SAlexander Yermolovich	.quad	.Lfunc_begin0                   # DW_AT_low_pc
117a44fe319SAlexander Yermolovich	.byte	.Lfunc_end0-.Lfunc_begin0       # DW_AT_high_pc
118a44fe319SAlexander Yermolovich	.long	.Linfo_string1                  # DW_AT_name
119a44fe319SAlexander Yermolovich	.byte	2                               # Abbrev [2] 0x2a:0x19 DW_TAG_subprogram
120a44fe319SAlexander Yermolovich	.quad	.Lfunc_begin0                   # DW_AT_low_pc
121a44fe319SAlexander Yermolovich	.long	.Lfunc_end0-.Lfunc_begin0       # DW_AT_high_pc
122a44fe319SAlexander Yermolovich	.byte	1                               # DW_AT_frame_base
123a44fe319SAlexander Yermolovich	.byte	86
124a44fe319SAlexander Yermolovich	.long	.Linfo_string3                  # DW_AT_name
125a44fe319SAlexander Yermolovich	.byte	1                               # DW_AT_decl_file
126a44fe319SAlexander Yermolovich	.byte	1                               # DW_AT_decl_line
1271a1324a3Szr33	.long	64                              # DW_AT_type
128a44fe319SAlexander Yermolovich                                        # DW_AT_external
129a44fe319SAlexander Yermolovich	.byte	3                               # Abbrev [3] 0x43:0x7 DW_TAG_base_type
130a44fe319SAlexander Yermolovich	.long	.Linfo_string4                  # DW_AT_name
131a44fe319SAlexander Yermolovich	.byte	5                               # DW_AT_encoding
132a44fe319SAlexander Yermolovich	.byte	4                               # DW_AT_byte_size
133a44fe319SAlexander Yermolovich	.byte	0                               # End Of Children Mark
134a44fe319SAlexander Yermolovich.Ldebug_info_end0:
135a44fe319SAlexander Yermolovich	.section	.debug_str,"MS",@progbits,1
136a44fe319SAlexander Yermolovich.Linfo_string0:
137a44fe319SAlexander Yermolovich	.asciz	"clang" # string offset=0
138a44fe319SAlexander Yermolovich.Linfo_string1:
139a44fe319SAlexander Yermolovich	.asciz	"main.cpp"                      # string offset=134
140a44fe319SAlexander Yermolovich.Linfo_string2:
141a44fe319SAlexander Yermolovich	.asciz	"test" # string offset=143
142a44fe319SAlexander Yermolovich.Linfo_string3:
143a44fe319SAlexander Yermolovich	.asciz	"main"                          # string offset=186
144a44fe319SAlexander Yermolovich.Linfo_string4:
145a44fe319SAlexander Yermolovich	.asciz	"int"                           # string offset=191
146a44fe319SAlexander Yermolovich	.ident	"clang"
147a44fe319SAlexander Yermolovich	.section	".note.GNU-stack","",@progbits
148a44fe319SAlexander Yermolovich	.addrsig
149a44fe319SAlexander Yermolovich	.section	.debug_line,"",@progbits
150a44fe319SAlexander Yermolovich.Lline_table_start0:
151