[llvm-shlib] Fix the version naming style of libLLVM for Windows (#85710)
[llvm-project.git] / bolt / test / X86 / dwarf4-invalid-reference-die-offset-no-internal-dwarf-error.s
blob4cf0d3d0e2558c443002f9f3ba19f335e3481aed
1 # REQUIRES: system-linux
3 # RUN: llvm-mc -dwarf-version=4 -filetype=obj -triple x86_64-unknown-linux %s -o %t1.o
4 # RUN: %clang %cflags -dwarf-4 %t1.o -o %t.exe -Wl,-q
5 # RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections -v 1 &> %tlog.txt
6 # RUN: cat %tlog.txt | FileCheck --check-prefix=CHECKBOLT %s
7 # RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.exe | FileCheck --check-prefix=CHECK %s
9 # Tests BOLT does not assert when DIE reference is invalid.
11 # CHECKBOLT: Referenced DIE offsets not in .debug_info
12 # CHECKBOLT-NEXT: 91
13 # CHECK: DW_TAG_variable
14 # CHECK-NEXT: DW_AT_name
15 # CHECK-NEXT: DW_AT_type [DW_FORM_ref4] (cu + 0x0091 => {0x00000091})
17 # Assembly manually modified
18 # struct pair {int i; int j; };
19 # static pair p;
20 # int load() {
21 # return p.i + p.j;
22 # }
23 # void store(int i, int j) {
24 # p.i = i;
25 # p.j = j;
26 # }
27 # int main() {
28 # return 0;
29 # }
31 .text
32 .file "main.cpp"
33 .file 1 "/invalidWithin" "main.cpp"
34 .section .text._Z4loadv,"ax",@progbits
35 .globl _Z4loadv # -- Begin function _Z4loadv
36 .p2align 4, 0x90
37 .type _Z4loadv,@function
38 _Z4loadv: # @_Z4loadv
39 .Lfunc_begin0:
40 .cfi_startproc
41 # %bb.0: # %entry
42 .loc 1 4 20 prologue_end # main.cpp:4:20
43 movl _ZL1p.1(%rip), %eax
44 .loc 1 4 16 is_stmt 0 # main.cpp:4:16
45 addl _ZL1p.0(%rip), %eax
46 .loc 1 4 5 # main.cpp:4:5
47 retq
48 .Ltmp0:
49 .Lfunc_end0:
50 .size _Z4loadv, .Lfunc_end0-_Z4loadv
51 .cfi_endproc
52 # -- End function
53 .section .text._Z5storeii,"ax",@progbits
54 .globl _Z5storeii # -- Begin function _Z5storeii
55 .p2align 4, 0x90
56 .type _Z5storeii,@function
57 _Z5storeii: # @_Z5storeii
58 .Lfunc_begin1:
59 .cfi_startproc
60 # %bb.0: # %entry
61 #DEBUG_VALUE: store:i <- $edi
62 #DEBUG_VALUE: store:j <- $esi
63 .loc 1 7 9 prologue_end is_stmt 1 # main.cpp:7:9
64 movl %edi, _ZL1p.0(%rip)
65 .loc 1 8 9 # main.cpp:8:9
66 movl %esi, _ZL1p.1(%rip)
67 .loc 1 9 1 # main.cpp:9:1
68 retq
69 .Ltmp1:
70 .Lfunc_end1:
71 .size _Z5storeii, .Lfunc_end1-_Z5storeii
72 .cfi_endproc
73 # -- End function
74 .section .text.main,"ax",@progbits
75 .globl main # -- Begin function main
76 .p2align 4, 0x90
77 .type main,@function
78 main: # @main
79 .Lfunc_begin2:
80 .cfi_startproc
81 # %bb.0: # %entry
82 .loc 1 11 1 prologue_end # main.cpp:11:1
83 xorl %eax, %eax
84 retq
85 .Ltmp2:
86 .Lfunc_end2:
87 .size main, .Lfunc_end2-main
88 .cfi_endproc
89 # -- End function
90 .type _ZL1p.0,@object # @_ZL1p.0
91 .local _ZL1p.0
92 .comm _ZL1p.0,4,4
93 .type _ZL1p.1,@object # @_ZL1p.1
94 .local _ZL1p.1
95 .comm _ZL1p.1,4,4
96 .section .debug_abbrev,"",@progbits
97 .byte 1 # Abbreviation Code
98 .byte 17 # DW_TAG_compile_unit
99 .byte 1 # DW_CHILDREN_yes
100 .byte 37 # DW_AT_producer
101 .byte 14 # DW_FORM_strp
102 .byte 19 # DW_AT_language
103 .byte 5 # DW_FORM_data2
104 .byte 3 # DW_AT_name
105 .byte 14 # DW_FORM_strp
106 .byte 16 # DW_AT_stmt_list
107 .byte 23 # DW_FORM_sec_offset
108 .byte 27 # DW_AT_comp_dir
109 .byte 14 # DW_FORM_strp
110 .byte 17 # DW_AT_low_pc
111 .byte 1 # DW_FORM_addr
112 .byte 85 # DW_AT_ranges
113 .byte 23 # DW_FORM_sec_offset
114 .byte 0 # EOM(1)
115 .byte 0 # EOM(2)
116 .byte 2 # Abbreviation Code
117 .byte 52 # DW_TAG_variable
118 .byte 0 # DW_CHILDREN_no
119 .byte 3 # DW_AT_name
120 .byte 14 # DW_FORM_strp
121 .byte 73 # DW_AT_type
122 .byte 19 # DW_FORM_ref4
123 .byte 58 # DW_AT_decl_file
124 .byte 11 # DW_FORM_data1
125 .byte 59 # DW_AT_decl_line
126 .byte 11 # DW_FORM_data1
127 .byte 2 # DW_AT_location
128 .byte 24 # DW_FORM_exprloc
129 .byte 110 # DW_AT_linkage_name
130 .byte 14 # DW_FORM_strp
131 .byte 0 # EOM(1)
132 .byte 0 # EOM(2)
133 .byte 3 # Abbreviation Code
134 .byte 19 # DW_TAG_structure_type
135 .byte 1 # DW_CHILDREN_yes
136 .byte 54 # DW_AT_calling_convention
137 .byte 11 # DW_FORM_data1
138 .byte 3 # DW_AT_name
139 .byte 14 # DW_FORM_strp
140 .byte 11 # DW_AT_byte_size
141 .byte 11 # DW_FORM_data1
142 .byte 58 # DW_AT_decl_file
143 .byte 11 # DW_FORM_data1
144 .byte 59 # DW_AT_decl_line
145 .byte 11 # DW_FORM_data1
146 .byte 0 # EOM(1)
147 .byte 0 # EOM(2)
148 .byte 4 # Abbreviation Code
149 .byte 13 # DW_TAG_member
150 .byte 0 # DW_CHILDREN_no
151 .byte 3 # DW_AT_name
152 .byte 14 # DW_FORM_strp
153 .byte 73 # DW_AT_type
154 .byte 19 # DW_FORM_ref4
155 .byte 58 # DW_AT_decl_file
156 .byte 11 # DW_FORM_data1
157 .byte 59 # DW_AT_decl_line
158 .byte 11 # DW_FORM_data1
159 .byte 56 # DW_AT_data_member_location
160 .byte 11 # DW_FORM_data1
161 .byte 0 # EOM(1)
162 .byte 0 # EOM(2)
163 .byte 5 # Abbreviation Code
164 .byte 36 # DW_TAG_base_type
165 .byte 0 # DW_CHILDREN_no
166 .byte 3 # DW_AT_name
167 .byte 14 # DW_FORM_strp
168 .byte 62 # DW_AT_encoding
169 .byte 11 # DW_FORM_data1
170 .byte 11 # DW_AT_byte_size
171 .byte 11 # DW_FORM_data1
172 .byte 0 # EOM(1)
173 .byte 0 # EOM(2)
174 .byte 6 # Abbreviation Code
175 .byte 46 # DW_TAG_subprogram
176 .byte 0 # DW_CHILDREN_no
177 .byte 17 # DW_AT_low_pc
178 .byte 1 # DW_FORM_addr
179 .byte 18 # DW_AT_high_pc
180 .byte 6 # DW_FORM_data4
181 .byte 64 # DW_AT_frame_base
182 .byte 24 # DW_FORM_exprloc
183 .ascii "\227B" # DW_AT_GNU_all_call_sites
184 .byte 25 # DW_FORM_flag_present
185 .byte 110 # DW_AT_linkage_name
186 .byte 14 # DW_FORM_strp
187 .byte 3 # DW_AT_name
188 .byte 14 # DW_FORM_strp
189 .byte 58 # DW_AT_decl_file
190 .byte 11 # DW_FORM_data1
191 .byte 59 # DW_AT_decl_line
192 .byte 11 # DW_FORM_data1
193 .byte 73 # DW_AT_type
194 .byte 19 # DW_FORM_ref4
195 .byte 63 # DW_AT_external
196 .byte 25 # DW_FORM_flag_present
197 .byte 0 # EOM(1)
198 .byte 0 # EOM(2)
199 .byte 7 # Abbreviation Code
200 .byte 46 # DW_TAG_subprogram
201 .byte 1 # DW_CHILDREN_yes
202 .byte 17 # DW_AT_low_pc
203 .byte 1 # DW_FORM_addr
204 .byte 18 # DW_AT_high_pc
205 .byte 6 # DW_FORM_data4
206 .byte 64 # DW_AT_frame_base
207 .byte 24 # DW_FORM_exprloc
208 .ascii "\227B" # DW_AT_GNU_all_call_sites
209 .byte 25 # DW_FORM_flag_present
210 .byte 110 # DW_AT_linkage_name
211 .byte 14 # DW_FORM_strp
212 .byte 3 # DW_AT_name
213 .byte 14 # DW_FORM_strp
214 .byte 58 # DW_AT_decl_file
215 .byte 11 # DW_FORM_data1
216 .byte 59 # DW_AT_decl_line
217 .byte 11 # DW_FORM_data1
218 .byte 63 # DW_AT_external
219 .byte 25 # DW_FORM_flag_present
220 .byte 0 # EOM(1)
221 .byte 0 # EOM(2)
222 .byte 8 # Abbreviation Code
223 .byte 5 # DW_TAG_formal_parameter
224 .byte 0 # DW_CHILDREN_no
225 .byte 2 # DW_AT_location
226 .byte 24 # DW_FORM_exprloc
227 .byte 3 # DW_AT_name
228 .byte 14 # DW_FORM_strp
229 .byte 58 # DW_AT_decl_file
230 .byte 11 # DW_FORM_data1
231 .byte 59 # DW_AT_decl_line
232 .byte 11 # DW_FORM_data1
233 .byte 73 # DW_AT_type
234 .byte 19 # DW_FORM_ref4
235 .byte 0 # EOM(1)
236 .byte 0 # EOM(2)
237 .byte 9 # Abbreviation Code
238 .byte 46 # DW_TAG_subprogram
239 .byte 0 # DW_CHILDREN_no
240 .byte 17 # DW_AT_low_pc
241 .byte 1 # DW_FORM_addr
242 .byte 18 # DW_AT_high_pc
243 .byte 6 # DW_FORM_data4
244 .byte 64 # DW_AT_frame_base
245 .byte 24 # DW_FORM_exprloc
246 .ascii "\227B" # DW_AT_GNU_all_call_sites
247 .byte 25 # DW_FORM_flag_present
248 .byte 3 # DW_AT_name
249 .byte 14 # DW_FORM_strp
250 .byte 58 # DW_AT_decl_file
251 .byte 11 # DW_FORM_data1
252 .byte 59 # DW_AT_decl_line
253 .byte 11 # DW_FORM_data1
254 .byte 73 # DW_AT_type
255 .byte 19 # DW_FORM_ref4
256 .byte 63 # DW_AT_external
257 .byte 25 # DW_FORM_flag_present
258 .byte 0 # EOM(1)
259 .byte 0 # EOM(2)
260 .byte 0 # EOM(3)
261 .section .debug_info,"",@progbits
262 .Lcu_begin0:
263 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
264 .Ldebug_info_start0:
265 .short 4 # DWARF version number
266 .long .debug_abbrev # Offset Into Abbrev. Section
267 .byte 8 # Address Size (in bytes)
268 .byte 1 # Abbrev [1] 0xb:0xd9 DW_TAG_compile_unit
269 .long .Linfo_string0 # DW_AT_producer
270 .short 33 # DW_AT_language
271 .long .Linfo_string1 # DW_AT_name
272 .long .Lline_table_start0 # DW_AT_stmt_list
273 .long .Linfo_string2 # DW_AT_comp_dir
274 .quad 0 # DW_AT_low_pc
275 .long .Ldebug_ranges0 # DW_AT_ranges
276 .byte 2 # Abbrev [2] 0x2a:0x26 DW_TAG_variable
277 .long .Linfo_string3 # DW_AT_name
278 .long 145 # DW_AT_type --> Modified manually s/80/145
279 .byte 1 # DW_AT_decl_file
280 .byte 2 # DW_AT_decl_line
281 .byte 22 # DW_AT_location
282 .byte 3
283 .quad _ZL1p.0
284 .byte 147
285 .byte 4
286 .byte 3
287 .quad _ZL1p.1
288 .byte 147
289 .byte 4
290 .long .Linfo_string8 # DW_AT_linkage_name
291 .byte 3 # Abbrev [3] 0x50:0x22 DW_TAG_structure_type
292 .byte 5 # DW_AT_calling_convention
293 .long .Linfo_string7 # DW_AT_name
294 .byte 8 # DW_AT_byte_size
295 .byte 1 # DW_AT_decl_file
296 .byte 1 # DW_AT_decl_line
297 .byte 4 # Abbrev [4] 0x59:0xc DW_TAG_member
298 .long .Linfo_string4 # DW_AT_name
299 .long 114 # DW_AT_type
300 .byte 1 # DW_AT_decl_file
301 .byte 1 # DW_AT_decl_line
302 .byte 0 # DW_AT_data_member_location
303 .byte 4 # Abbrev [4] 0x65:0xc DW_TAG_member
304 .long .Linfo_string6 # DW_AT_name
305 .long 114 # DW_AT_type
306 .byte 1 # DW_AT_decl_file
307 .byte 1 # DW_AT_decl_line
308 .byte 4 # DW_AT_data_member_location
309 .byte 0 # End Of Children Mark
310 .byte 5 # Abbrev [5] 0x72:0x7 DW_TAG_base_type
311 .long .Linfo_string5 # DW_AT_name
312 .byte 5 # DW_AT_encoding
313 .byte 4 # DW_AT_byte_size
314 .byte 6 # Abbrev [6] 0x79:0x1d DW_TAG_subprogram
315 .quad .Lfunc_begin0 # DW_AT_low_pc
316 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
317 .byte 1 # DW_AT_frame_base
318 .byte 87
319 # DW_AT_GNU_all_call_sites
320 .long .Linfo_string9 # DW_AT_linkage_name
321 .long .Linfo_string10 # DW_AT_name
322 .byte 1 # DW_AT_decl_file
323 .byte 3 # DW_AT_decl_line
324 .long 114 # DW_AT_type
325 # DW_AT_external
326 .byte 7 # Abbrev [7] 0x96:0x34 DW_TAG_subprogram
327 .quad .Lfunc_begin1 # DW_AT_low_pc
328 .long .Lfunc_end1-.Lfunc_begin1 # DW_AT_high_pc
329 .byte 1 # DW_AT_frame_base
330 .byte 87
331 # DW_AT_GNU_all_call_sites
332 .long .Linfo_string11 # DW_AT_linkage_name
333 .long .Linfo_string12 # DW_AT_name
334 .byte 1 # DW_AT_decl_file
335 .byte 6 # DW_AT_decl_line
336 # DW_AT_external
337 .byte 8 # Abbrev [8] 0xaf:0xd DW_TAG_formal_parameter
338 .byte 1 # DW_AT_location
339 .byte 85
340 .long .Linfo_string4 # DW_AT_name
341 .byte 1 # DW_AT_decl_file
342 .byte 6 # DW_AT_decl_line
343 .long 114 # DW_AT_type
344 .byte 8 # Abbrev [8] 0xbc:0xd DW_TAG_formal_parameter
345 .byte 1 # DW_AT_location
346 .byte 84
347 .long .Linfo_string6 # DW_AT_name
348 .byte 1 # DW_AT_decl_file
349 .byte 6 # DW_AT_decl_line
350 .long 114 # DW_AT_type
351 .byte 0 # End Of Children Mark
352 .byte 9 # Abbrev [9] 0xca:0x19 DW_TAG_subprogram
353 .quad .Lfunc_begin2 # DW_AT_low_pc
354 .long .Lfunc_end2-.Lfunc_begin2 # DW_AT_high_pc
355 .byte 1 # DW_AT_frame_base
356 .byte 87
357 # DW_AT_GNU_all_call_sites
358 .long .Linfo_string13 # DW_AT_name
359 .byte 1 # DW_AT_decl_file
360 .byte 10 # DW_AT_decl_line
361 .long 114 # DW_AT_type
362 # DW_AT_external
363 .byte 0 # End Of Children Mark
364 .Ldebug_info_end0:
365 .section .debug_ranges,"",@progbits
366 .Ldebug_ranges0:
367 .quad .Lfunc_begin0
368 .quad .Lfunc_end0
369 .quad .Lfunc_begin1
370 .quad .Lfunc_end1
371 .quad .Lfunc_begin2
372 .quad .Lfunc_end2
373 .quad 0
374 .quad 0
375 .section .debug_str,"MS",@progbits,1
376 .Linfo_string0:
377 .asciz "clang version 18.0.0 (git@github.com:llvm/llvm-project.git 37d6c1cc7d4dd3a8a47ba62254bc88521bd50d66)" # string offset=0
378 .Linfo_string1:
379 .asciz "main.cpp" # string offset=101
380 .Linfo_string2:
381 .asciz "/invalidWithin" # string offset=110
382 .Linfo_string3:
383 .asciz "p" # string offset=162
384 .Linfo_string4:
385 .asciz "i" # string offset=164
386 .Linfo_string5:
387 .asciz "int" # string offset=166
388 .Linfo_string6:
389 .asciz "j" # string offset=170
390 .Linfo_string7:
391 .asciz "pair" # string offset=172
392 .Linfo_string8:
393 .asciz "_ZL1p" # string offset=177
394 .Linfo_string9:
395 .asciz "_Z4loadv" # string offset=183
396 .Linfo_string10:
397 .asciz "load" # string offset=192
398 .Linfo_string11:
399 .asciz "_Z5storeii" # string offset=197
400 .Linfo_string12:
401 .asciz "store" # string offset=208
402 .Linfo_string13:
403 .asciz "main" # string offset=214
404 .ident "clang version 18.0.0 (git@github.com:llvm/llvm-project.git 37d6c1cc7d4dd3a8a47ba62254bc88521bd50d66)"
405 .section ".note.GNU-stack","",@progbits
406 .addrsig
407 .section .debug_line,"",@progbits
408 .Lline_table_start0: