[llvm-shlib] Fix the version naming style of libLLVM for Windows (#85710)
[llvm-project.git] / bolt / test / X86 / dwarf5-label-low-pc.s
blobb713097163348e4ce728fa2c117371d397592d11
2 # REQUIRES: system-linux
4 # RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %s -o %tmain.o
5 # RUN: %clang %cflags -dwarf-5 %tmain.o -o %t.exe -Wl,-q
6 # RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections
7 # RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.exe | FileCheck --check-prefix=PRECHECK %s
9 # RUN: llvm-dwarfdump --show-form --verbose --debug-addr %t.bolt > %t.txt
10 # RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.bolt >> %t.txt
12 # This test checks that we correctly handle DW_AT_low_pc [DW_FORM_addrx] that is part of DW_TAG_label.
14 # PRECHECK: version = 0x0005
15 # PRECHECK: DW_TAG_label
16 # PRECHECK-NEXT: DW_AT_name
17 # PRECHECK-NEXT: DW_AT_decl_file
18 # PRECHECK-NEXT: DW_AT_decl_line
19 # PRECHECK-NEXT:DW_AT_low_pc [DW_FORM_addrx] (indexed (00000001)
20 # PRECHECK: DW_TAG_label
21 # PRECHECK-NEXT: DW_AT_name
22 # PRECHECK-NEXT: DW_AT_decl_file
23 # PRECHECK-NEXT: DW_AT_decl_line
24 # PRECHECK-NEXT:DW_AT_low_pc [DW_FORM_addrx] (indexed (00000002)
27 # POSTCHECK: Addrs: [
28 # POSTCHECK-NEXT: 0x
29 # POSTCHECK-NEXT: 0x
30 # POSTCHECK-NEXT: 0x[[#%.16x,ADDR:]]
31 # POSTCHECK-NEXT: 0x[[#%.16x,ADDR2:]]
33 # POSTCHECK: version = 0x0005
34 # POSTCHECK: DW_TAG_label
35 # POSTCHECK-NEXT: DW_AT_name
36 # POSTCHECK-NEXT: DW_AT_decl_file
37 # POSTCHECK-NEXT: DW_AT_decl_line
38 # POSTCHECK-NEXT:
39 # POSTCHECK-NEXT:DW_AT_low_pc [DW_FORM_addrx] (indexed (00000002)
40 # POSTCHECK-SAME: [0x[[#ADDR]]
41 # POSTCHECK: DW_TAG_label
42 # POSTCHECK-NEXT: DW_AT_name
43 # POSTCHECK-NEXT: DW_AT_decl_file
44 # POSTCHECK-NEXT: DW_AT_decl_line
45 # POSTCHECK-NEXT:
46 # POSTCHECK-NEXT:DW_AT_low_pc [DW_FORM_addrx] (indexed (00000003)
47 # POSTCHECK-SAME: [0x[[#ADDR2]]
49 # clang++ main.cpp -g -S
50 # int main() {
51 # int a = 4;
52 # if (a == 5)
53 # goto LABEL1;
54 # else
55 # goto LABEL2;
56 # LABEL1:a++;
57 # LABEL2:a--;
58 # return 0;
59 # }
61 .text
62 .file "main.cpp"
63 .globl main # -- Begin function main
64 .p2align 4, 0x90
65 .type main,@function
66 main: # @main
67 .Lfunc_begin0:
68 .file 0 "/testLabel" "main.cpp" md5 0xa0bd66020d06f1303de7008e3c542050
69 .loc 0 1 0 # main.cpp:1:0
70 .cfi_startproc
71 # %bb.0: # %entry
72 pushq %rbp
73 .cfi_def_cfa_offset 16
74 .cfi_offset %rbp, -16
75 movq %rsp, %rbp
76 .cfi_def_cfa_register %rbp
77 movl $0, -4(%rbp)
78 .Ltmp0:
79 .loc 0 2 7 prologue_end # main.cpp:2:7
80 movl $4, -8(%rbp)
81 .Ltmp1:
82 .loc 0 3 9 # main.cpp:3:9
83 cmpl $5, -8(%rbp)
84 .Ltmp2:
85 .loc 0 3 7 is_stmt 0 # main.cpp:3:7
86 jne .LBB0_2
87 # %bb.1: # %if.then
88 .Ltmp3:
89 .loc 0 4 5 is_stmt 1 # main.cpp:4:5
90 jmp .LBB0_3
91 .LBB0_2: # %if.else
92 .loc 0 6 5 # main.cpp:6:5
93 jmp .LBB0_4
94 .Ltmp4:
95 .LBB0_3: # %LABEL1
96 #DEBUG_LABEL: main:LABEL1
97 .loc 0 7 11 # main.cpp:7:11
98 movl -8(%rbp), %eax
99 addl $1, %eax
100 movl %eax, -8(%rbp)
101 .LBB0_4: # %LABEL2
102 .Ltmp5:
103 #DEBUG_LABEL: main:LABEL2
104 .loc 0 8 11 # main.cpp:8:11
105 movl -8(%rbp), %eax
106 addl $-1, %eax
107 movl %eax, -8(%rbp)
108 .loc 0 9 3 # main.cpp:9:3
109 xorl %eax, %eax
110 popq %rbp
111 .cfi_def_cfa %rsp, 8
112 retq
113 .Ltmp6:
114 .Lfunc_end0:
115 .size main, .Lfunc_end0-main
116 .cfi_endproc
117 # -- End function
118 .section .debug_abbrev,"",@progbits
119 .byte 1 # Abbreviation Code
120 .byte 17 # DW_TAG_compile_unit
121 .byte 1 # DW_CHILDREN_yes
122 .byte 37 # DW_AT_producer
123 .byte 37 # DW_FORM_strx1
124 .byte 19 # DW_AT_language
125 .byte 5 # DW_FORM_data2
126 .byte 3 # DW_AT_name
127 .byte 37 # DW_FORM_strx1
128 .byte 114 # DW_AT_str_offsets_base
129 .byte 23 # DW_FORM_sec_offset
130 .byte 16 # DW_AT_stmt_list
131 .byte 23 # DW_FORM_sec_offset
132 .byte 27 # DW_AT_comp_dir
133 .byte 37 # DW_FORM_strx1
134 .byte 17 # DW_AT_low_pc
135 .byte 27 # DW_FORM_addrx
136 .byte 18 # DW_AT_high_pc
137 .byte 6 # DW_FORM_data4
138 .byte 115 # DW_AT_addr_base
139 .byte 23 # DW_FORM_sec_offset
140 .byte 0 # EOM(1)
141 .byte 0 # EOM(2)
142 .byte 2 # Abbreviation Code
143 .byte 46 # DW_TAG_subprogram
144 .byte 1 # DW_CHILDREN_yes
145 .byte 17 # DW_AT_low_pc
146 .byte 27 # DW_FORM_addrx
147 .byte 18 # DW_AT_high_pc
148 .byte 6 # DW_FORM_data4
149 .byte 64 # DW_AT_frame_base
150 .byte 24 # DW_FORM_exprloc
151 .byte 3 # DW_AT_name
152 .byte 37 # DW_FORM_strx1
153 .byte 58 # DW_AT_decl_file
154 .byte 11 # DW_FORM_data1
155 .byte 59 # DW_AT_decl_line
156 .byte 11 # DW_FORM_data1
157 .byte 73 # DW_AT_type
158 .byte 19 # DW_FORM_ref4
159 .byte 63 # DW_AT_external
160 .byte 25 # DW_FORM_flag_present
161 .byte 0 # EOM(1)
162 .byte 0 # EOM(2)
163 .byte 3 # Abbreviation Code
164 .byte 52 # DW_TAG_variable
165 .byte 0 # DW_CHILDREN_no
166 .byte 2 # DW_AT_location
167 .byte 24 # DW_FORM_exprloc
168 .byte 3 # DW_AT_name
169 .byte 37 # DW_FORM_strx1
170 .byte 58 # DW_AT_decl_file
171 .byte 11 # DW_FORM_data1
172 .byte 59 # DW_AT_decl_line
173 .byte 11 # DW_FORM_data1
174 .byte 73 # DW_AT_type
175 .byte 19 # DW_FORM_ref4
176 .byte 0 # EOM(1)
177 .byte 0 # EOM(2)
178 .byte 4 # Abbreviation Code
179 .byte 10 # DW_TAG_label
180 .byte 0 # DW_CHILDREN_no
181 .byte 3 # DW_AT_name
182 .byte 37 # DW_FORM_strx1
183 .byte 58 # DW_AT_decl_file
184 .byte 11 # DW_FORM_data1
185 .byte 59 # DW_AT_decl_line
186 .byte 11 # DW_FORM_data1
187 .byte 17 # DW_AT_low_pc
188 .byte 27 # DW_FORM_addrx
189 .byte 0 # EOM(1)
190 .byte 0 # EOM(2)
191 .byte 5 # Abbreviation Code
192 .byte 36 # DW_TAG_base_type
193 .byte 0 # DW_CHILDREN_no
194 .byte 3 # DW_AT_name
195 .byte 37 # DW_FORM_strx1
196 .byte 62 # DW_AT_encoding
197 .byte 11 # DW_FORM_data1
198 .byte 11 # DW_AT_byte_size
199 .byte 11 # DW_FORM_data1
200 .byte 0 # EOM(1)
201 .byte 0 # EOM(2)
202 .byte 0 # EOM(3)
203 .section .debug_info,"",@progbits
204 .Lcu_begin0:
205 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
206 .Ldebug_info_start0:
207 .short 5 # DWARF version number
208 .byte 1 # DWARF Unit Type
209 .byte 8 # Address Size (in bytes)
210 .long .debug_abbrev # Offset Into Abbrev. Section
211 .byte 1 # Abbrev [1] 0xc:0x41 DW_TAG_compile_unit
212 .byte 0 # DW_AT_producer
213 .short 33 # DW_AT_language
214 .byte 1 # DW_AT_name
215 .long .Lstr_offsets_base0 # DW_AT_str_offsets_base
216 .long .Lline_table_start0 # DW_AT_stmt_list
217 .byte 2 # DW_AT_comp_dir
218 .byte 0 # DW_AT_low_pc
219 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
220 .long .Laddr_table_base0 # DW_AT_addr_base
221 .byte 2 # Abbrev [2] 0x23:0x25 DW_TAG_subprogram
222 .byte 0 # DW_AT_low_pc
223 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
224 .byte 1 # DW_AT_frame_base
225 .byte 86
226 .byte 3 # DW_AT_name
227 .byte 0 # DW_AT_decl_file
228 .byte 1 # DW_AT_decl_line
229 .long 72 # DW_AT_type
230 # DW_AT_external
231 .byte 3 # Abbrev [3] 0x32:0xb DW_TAG_variable
232 .byte 2 # DW_AT_location
233 .byte 145
234 .byte 120
235 .byte 5 # DW_AT_name
236 .byte 0 # DW_AT_decl_file
237 .byte 2 # DW_AT_decl_line
238 .long 72 # DW_AT_type
239 .byte 4 # Abbrev [4] 0x3d:0x5 DW_TAG_label
240 .byte 6 # DW_AT_name
241 .byte 0 # DW_AT_decl_file
242 .byte 7 # DW_AT_decl_line
243 .byte 1 # DW_AT_low_pc
244 .byte 4 # Abbrev [4] 0x42:0x5 DW_TAG_label
245 .byte 7 # DW_AT_name
246 .byte 0 # DW_AT_decl_file
247 .byte 8 # DW_AT_decl_line
248 .byte 2 # DW_AT_low_pc
249 .byte 0 # End Of Children Mark
250 .byte 5 # Abbrev [5] 0x48:0x4 DW_TAG_base_type
251 .byte 4 # DW_AT_name
252 .byte 5 # DW_AT_encoding
253 .byte 4 # DW_AT_byte_size
254 .byte 0 # End Of Children Mark
255 .Ldebug_info_end0:
256 .section .debug_str_offsets,"",@progbits
257 .long 36 # Length of String Offsets Set
258 .short 5
259 .short 0
260 .Lstr_offsets_base0:
261 .section .debug_str,"MS",@progbits,1
262 .Linfo_string0:
263 .asciz "clang version 15.0.0" # string offset=0
264 .Linfo_string1:
265 .asciz "main.cpp" # string offset=134
266 .Linfo_string2:
267 .asciz "/testLabel" # string offset=143
268 .Linfo_string3:
269 .asciz "main" # string offset=190
270 .Linfo_string4:
271 .asciz "int" # string offset=195
272 .Linfo_string5:
273 .asciz "a" # string offset=199
274 .Linfo_string6:
275 .asciz "LABEL1" # string offset=201
276 .Linfo_string7:
277 .asciz "LABEL2" # string offset=208
278 .section .debug_str_offsets,"",@progbits
279 .long .Linfo_string0
280 .long .Linfo_string1
281 .long .Linfo_string2
282 .long .Linfo_string3
283 .long .Linfo_string4
284 .long .Linfo_string5
285 .long .Linfo_string6
286 .long .Linfo_string7
287 .section .debug_addr,"",@progbits
288 .long .Ldebug_addr_end0-.Ldebug_addr_start0 # Length of contribution
289 .Ldebug_addr_start0:
290 .short 5 # DWARF version number
291 .byte 8 # Address size
292 .byte 0 # Segment selector size
293 .Laddr_table_base0:
294 .quad .Lfunc_begin0
295 .quad .Ltmp4
296 .quad .Ltmp5
297 .Ldebug_addr_end0:
298 .ident "clang version 15.0.0"
299 .section ".note.GNU-stack","",@progbits
300 .addrsig
301 .section .debug_line,"",@progbits
302 .Lline_table_start0: