[ELF] Make SyntheticSection parameter order match InputSection
[llvm-project.git] / lld / test / ELF / ppc32-debug-names.s
blob3fc93ec86693f433892c678f66d84e7c6ed36588
1 # ppc32-debug-names.s was generated with:
3 # clang++ --target=powerpc -g -gpubnames \
4 # -fdebug-compilation-dir='/self/proc/cwd' -S a.cpp -o a.s
6 # a.cpp contents:
8 # struct t1 { };
9 # void f1(t1) { }
11 # REQUIRES: ppc
12 # RUN: rm -rf %t && split-file %s %t && cd %t
13 # RUN: llvm-mc -filetype=obj -triple=powerpc a.s -o a.o
14 # RUN: llvm-mc -filetype=obj -triple=powerpc b.s -o b.o
16 # RUN: ld.lld --debug-names --no-debug-names a.o b.o -o out0
17 # RUN: llvm-readelf -SW out0 | FileCheck %s --check-prefix=NO_MERGE
19 # NO_MERGE: Name Type Address Off Size ES Flg Lk Inf Al
20 # NO_MERGE: .debug_names PROGBITS 00000000 [[#%x,]] 000110 00 0 0 4
22 # RUN: ld.lld --debug-names a.o b.o -o out
24 # RUN: llvm-dwarfdump -debug-names out | FileCheck %s --check-prefix=DWARF
25 # RUN: llvm-readelf -SW out | FileCheck %s --check-prefix=READELF
27 # READELF: Name Type Address Off Size ES Flg Lk Inf Al
28 # READELF: .debug_names PROGBITS 00000000 [[#%x,]] 0000cc 00 0 0 4
30 # DWARF: file format elf32-powerpc
31 # DWARF: .debug_names contents:
32 # DWARF: Name Index @ 0x0 {
33 # DWARF-NEXT: Header {
34 # DWARF-NEXT: Length: 0xC8
35 # DWARF-NEXT: Format: DWARF32
36 # DWARF-NEXT: Version: 5
37 # DWARF-NEXT: CU count: 2
38 # DWARF-NEXT: Local TU count: 0
39 # DWARF-NEXT: Foreign TU count: 0
40 # DWARF-NEXT: Bucket count: 5
41 # DWARF-NEXT: Name count: 5
42 # DWARF-NEXT: Abbreviations table size: 0x1F
43 # DWARF-NEXT: Augmentation: 'LLVM0700'
44 # DWARF: Compilation Unit offsets [
45 # DWARF-NEXT: CU[0]: 0x00000000
46 # DWARF-NEXT: CU[1]: 0x0000000c
47 # DWARF: Abbreviations [
48 # DWARF-NEXT: Abbreviation 0x1 {
49 # DWARF: Tag: DW_TAG_structure_type
50 # DWARF-NEXT: DW_IDX_die_offset: DW_FORM_ref4
51 # DWARF-NEXT: DW_IDX_parent: DW_FORM_flag_present
52 # DWARF-NEXT: DW_IDX_compile_unit: DW_FORM_data1
53 # DWARF: Abbreviation 0x2 {
54 # DWARF-NEXT: Tag: DW_TAG_subprogram
55 # DWARF-NEXT: DW_IDX_die_offset: DW_FORM_ref4
56 # DWARF-NEXT: DW_IDX_parent: DW_FORM_flag_present
57 # DWARF-NEXT: DW_IDX_compile_unit: DW_FORM_data1
58 # DWARF: Abbreviation 0x3 {
59 # DWARF-NEXT: Tag: DW_TAG_base_type
60 # DWARF-NEXT: DW_IDX_die_offset: DW_FORM_ref4
61 # DWARF-NEXT: DW_IDX_parent: DW_FORM_flag_present
62 # DWARF-NEXT: DW_IDX_compile_unit: DW_FORM_data1
63 # DWARF: Bucket 0 [
64 # DWARF-NEXT: EMPTY
65 # DWARF-NEXT: ]
66 # DWARF-NEXT: Bucket 1 [
67 # DWARF-NEXT: Name 1 {
68 # DWARF-NEXT: Hash: 0x59796A
69 # DWARF-NEXT: String: 0x00000089 "t1"
70 # DWARF-NEXT: Entry @ 0xaa {
71 # DWARF-NEXT: Abbrev: 0x1
72 # DWARF-NEXT: Tag: DW_TAG_structure_type
73 # DWARF-NEXT: DW_IDX_die_offset: 0x0000003a
74 # DWARF-NEXT: DW_IDX_parent: <parent not indexed>
75 # DWARF-NEXT: DW_IDX_compile_unit: 0x00
76 # DWARF-NEXT: }
77 # DWARF-NEXT: Entry @ 0xb0 {
78 # DWARF-NEXT: Abbrev: 0x1
79 # DWARF-NEXT: Tag: DW_TAG_structure_type
80 # DWARF-NEXT: DW_IDX_die_offset: 0x00000042
81 # DWARF-NEXT: DW_IDX_parent: <parent not indexed>
82 # DWARF-NEXT: DW_IDX_compile_unit: 0x01
83 # DWARF-NEXT: }
84 # DWARF-NEXT: }
85 # DWARF-NEXT: Name 2 {
86 # DWARF-NEXT: Hash: 0x5355B2BE
87 # DWARF-NEXT: String: 0x00000080 "_Z2f12t1"
88 # DWARF-NEXT: Entry @ 0xbe {
89 # DWARF-NEXT: Abbrev: 0x2
90 # DWARF-NEXT: Tag: DW_TAG_subprogram
91 # DWARF-NEXT: DW_IDX_die_offset: 0x00000023
92 # DWARF-NEXT: DW_IDX_parent: <parent not indexed>
93 # DWARF-NEXT: DW_IDX_compile_unit: 0x00
94 # DWARF-NEXT: }
95 # DWARF-NEXT: }
96 # DWARF-NEXT: Name 3 {
97 # DWARF-NEXT: Hash: 0x7C9A7F6A
98 # DWARF-NEXT: String: 0x0000010d "main"
99 # DWARF-NEXT: Entry @ 0xc5 {
100 # DWARF-NEXT: Abbrev: 0x2
101 # DWARF-NEXT: Tag: DW_TAG_subprogram
102 # DWARF-NEXT: DW_IDX_die_offset: 0x00000023
103 # DWARF-NEXT: DW_IDX_parent: <parent not indexed>
104 # DWARF-NEXT: DW_IDX_compile_unit: 0x01
105 # DWARF-NEXT: }
106 # DWARF-NEXT: }
107 # DWARF-NEXT: ]
108 # DWARF-NEXT: Bucket 2 [
109 # DWARF-NEXT: EMPTY
110 # DWARF-NEXT: ]
111 # DWARF-NEXT: Bucket 3 [
112 # DWARF-NEXT: Name 4 {
113 # DWARF-NEXT: Hash: 0xB888030
114 # DWARF-NEXT: String: 0x00000112 "int"
115 # DWARF-NEXT: Entry @ 0xb7 {
116 # DWARF-NEXT: Abbrev: 0x3
117 # DWARF-NEXT: Tag: DW_TAG_base_type
118 # DWARF-NEXT: DW_IDX_die_offset: 0x0000003e
119 # DWARF-NEXT: DW_IDX_parent: <parent not indexed>
120 # DWARF-NEXT: DW_IDX_compile_unit: 0x01
121 # DWARF-NEXT: }
122 # DWARF-NEXT: }
123 # DWARF-NEXT: ]
124 # DWARF-NEXT: Bucket 4 [
125 # DWARF-NEXT: Name 5 {
126 # DWARF-NEXT: Hash: 0x59779C
127 # DWARF-NEXT: String: 0x0000007d "f1"
128 # DWARF-NEXT: Entry @ 0xa3 {
129 # DWARF-NEXT: Abbrev: 0x2
130 # DWARF-NEXT: Tag: DW_TAG_subprogram
131 # DWARF-NEXT: DW_IDX_die_offset: 0x00000023
132 # DWARF-NEXT: DW_IDX_parent: <parent not indexed>
133 # DWARF-NEXT: DW_IDX_compile_unit: 0x00
134 # DWARF-NEXT: }
135 # DWARF-NEXT: }
136 # DWARF-NEXT: ]
138 #--- a.s
139 .text
140 .globl _Z2f12t1 # -- Begin function _Z2f12t1
141 .p2align 2
142 .type _Z2f12t1,@function
143 _Z2f12t1: # @_Z2f12t1
144 .Lfunc_begin0:
145 .cfi_startproc
146 # %bb.0: # %entry
147 #DEBUG_VALUE: f1: <- [$r3+0]
148 stwu 1, -16(1)
149 stw 31, 12(1)
150 .cfi_def_cfa_offset 16
151 .cfi_offset r31, -4
152 mr 31, 1
153 .cfi_def_cfa_register r31
154 .Ltmp0:
155 lwz 31, 12(1)
156 addi 1, 1, 16
158 .Ltmp1:
159 .Lfunc_end0:
160 .size _Z2f12t1, .Lfunc_end0-.Lfunc_begin0
161 .cfi_endproc
162 # -- End function
163 .section .debug_abbrev,"",@progbits
164 .byte 0 # EOM(1)
165 .byte 0 # EOM(2)
166 .byte 0 # EOM(3)
167 .section .debug_info,"",@progbits
168 .Lcu_begin0:
169 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
170 .Ldebug_info_start0:
171 .short 5 # DWARF version number
172 .byte 1 # DWARF Unit Type
173 .byte 4 # Address Size (in bytes)
174 .long .debug_abbrev # Offset Into Abbrev. Section
175 .Ldebug_info_end0:
176 .section .debug_str_offsets,"",@progbits
177 .long 28 # Length of String Offsets Set
178 .short 5
179 .short 0
180 .Lstr_offsets_base0:
181 .section .debug_str,"MS",@progbits,1
182 .Linfo_string0:
183 .asciz "clang version 19.0.0git (git@github.com:llvm/llvm-project.git 53b14cd9ce2b57da73d173fc876d2e9e199f5640)" # string offset=0
184 .Linfo_string1:
185 .asciz "a.cpp" # string offset=104
186 .Linfo_string2:
187 .asciz "/proc/self/cwd" # string offset=110
188 .Linfo_string3:
189 .asciz "f1" # string offset=125
190 .Linfo_string4:
191 .asciz "_Z2f12t1" # string offset=128
192 .Linfo_string5:
193 .asciz "t1" # string offset=137
194 .Laddr_table_base0:
195 .long .Lfunc_begin0
196 .Ldebug_addr_end0:
197 .section .debug_names,"",@progbits
198 .long .Lnames_end0-.Lnames_start0 # Header: unit length
199 .Lnames_start0:
200 .short 5 # Header: version
201 .short 0 # Header: padding
202 .long 1 # Header: compilation unit count
203 .long 0 # Header: local type unit count
204 .long 0 # Header: foreign type unit count
205 .long 3 # Header: bucket count
206 .long 3 # Header: name count
207 .long .Lnames_abbrev_end0-.Lnames_abbrev_start0 # Header: abbreviation table size
208 .long 8 # Header: augmentation string size
209 .ascii "LLVM0700" # Header: augmentation string
210 .long .Lcu_begin0 # Compilation unit 0
211 .long 0 # Bucket 0
212 .long 1 # Bucket 1
213 .long 3 # Bucket 2
214 .long 5863324 # Hash in Bucket 1
215 .long 5863786 # Hash in Bucket 1
216 .long 1398125246 # Hash in Bucket 2
217 .long .Linfo_string3 # String in Bucket 1: f1
218 .long .Linfo_string5 # String in Bucket 1: t1
219 .long .Linfo_string4 # String in Bucket 2: _Z2f12t1
220 .long .Lnames0-.Lnames_entries0 # Offset in Bucket 1
221 .long .Lnames2-.Lnames_entries0 # Offset in Bucket 1
222 .long .Lnames1-.Lnames_entries0 # Offset in Bucket 2
223 .Lnames_abbrev_start0:
224 .byte 1 # Abbrev code
225 .byte 46 # DW_TAG_subprogram
226 .byte 3 # DW_IDX_die_offset
227 .byte 19 # DW_FORM_ref4
228 .byte 4 # DW_IDX_parent
229 .byte 25 # DW_FORM_flag_present
230 .byte 0 # End of abbrev
231 .byte 0 # End of abbrev
232 .byte 2 # Abbrev code
233 .byte 19 # DW_TAG_structure_type
234 .byte 3 # DW_IDX_die_offset
235 .byte 19 # DW_FORM_ref4
236 .byte 4 # DW_IDX_parent
237 .byte 25 # DW_FORM_flag_present
238 .byte 0 # End of abbrev
239 .byte 0 # End of abbrev
240 .byte 0 # End of abbrev list
241 .Lnames_abbrev_end0:
242 .Lnames_entries0:
243 .Lnames0:
244 .L1:
245 .byte 1 # Abbreviation code
246 .long 35 # DW_IDX_die_offset
247 .byte 0 # DW_IDX_parent
248 # End of list: f1
249 .Lnames2:
250 .L0:
251 .byte 2 # Abbreviation code
252 .long 58 # DW_IDX_die_offset
253 .byte 0 # DW_IDX_parent
254 # End of list: t1
255 .Lnames1:
256 .byte 1 # Abbreviation code
257 .long 35 # DW_IDX_die_offset
258 .byte 0 # DW_IDX_parent
259 # End of list: _Z2f12t1
260 .p2align 2, 0x0
261 .Lnames_end0:
262 .ident "clang version 19.0.0git (git@github.com:llvm/llvm-project.git 53b14cd9ce2b57da73d173fc876d2e9e199f5640)"
263 .section ".note.GNU-stack","",@progbits
264 .addrsig
265 .section .debug_line,"",@progbits
266 .Lline_table_start0:
268 #--- b.s
269 # Generated with:
270 # - clang++ --target=powerpc -g -O0 -gpubnames \
271 # -fdebug-compilation-dir='/self/proc/cwd' -S b.cpp -o b.s
273 # b.cpp contents:
275 # struct t1 { };
276 # int main() {
277 # t1 v1;
280 .text
281 .globl main # -- Begin function main
282 .p2align 2
283 .type main,@function
284 main: # @main
285 .Lfunc_begin0:
286 .cfi_startproc
287 # %bb.0: # %entry
288 stwu 1, -16(1)
289 stw 31, 12(1)
290 .cfi_def_cfa_offset 16
291 .cfi_offset r31, -4
292 mr 31, 1
293 .cfi_def_cfa_register r31
294 li 3, 0
295 .Ltmp0:
296 lwz 31, 12(1)
297 addi 1, 1, 16
299 .Ltmp1:
300 .Lfunc_end0:
301 .size main, .Lfunc_end0-.Lfunc_begin0
302 .cfi_endproc
303 # -- End function
304 .section .debug_abbrev,"",@progbits
305 .byte 0 # EOM(1)
306 .byte 0 # EOM(2)
307 .byte 0 # EOM(3)
308 .section .debug_info,"",@progbits
309 .Lcu_begin0:
310 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
311 .Ldebug_info_start0:
312 .short 5 # DWARF version number
313 .byte 1 # DWARF Unit Type
314 .byte 4 # Address Size (in bytes)
315 .long .debug_abbrev # Offset Into Abbrev. Section
316 .Ldebug_info_end0:
317 .section .debug_str_offsets,"",@progbits
318 .long 32 # Length of String Offsets Set
319 .short 5
320 .short 0
321 .Lstr_offsets_base0:
322 .section .debug_str,"MS",@progbits,1
323 .Linfo_string0:
324 .asciz "clang version 19.0.0git (git@github.com:llvm/llvm-project.git 53b14cd9ce2b57da73d173fc876d2e9e199f5640)" # string offset=0
325 .Linfo_string1:
326 .asciz "b.cpp" # string offset=104
327 .Linfo_string2:
328 .asciz "/proc/self/cwd" # string offset=110
329 .Linfo_string3:
330 .asciz "main" # string offset=125
331 .Linfo_string4:
332 .asciz "int" # string offset=130
333 .Linfo_string5:
334 .asciz "v1" # string offset=134
335 .Linfo_string6:
336 .asciz "t1" # string offset=137
337 .Laddr_table_base0:
338 .long .Lfunc_begin0
339 .Ldebug_addr_end0:
340 .section .debug_names,"",@progbits
341 .long .Lnames_end0-.Lnames_start0 # Header: unit length
342 .Lnames_start0:
343 .short 5 # Header: version
344 .short 0 # Header: padding
345 .long 1 # Header: compilation unit count
346 .long 0 # Header: local type unit count
347 .long 0 # Header: foreign type unit count
348 .long 3 # Header: bucket count
349 .long 3 # Header: name count
350 .long .Lnames_abbrev_end0-.Lnames_abbrev_start0 # Header: abbreviation table size
351 .long 8 # Header: augmentation string size
352 .ascii "LLVM0700" # Header: augmentation string
353 .long .Lcu_begin0 # Compilation unit 0
354 .long 0 # Bucket 0
355 .long 1 # Bucket 1
356 .long 3 # Bucket 2
357 .long 5863786 # Hash in Bucket 1
358 .long 2090499946 # Hash in Bucket 1
359 .long 193495088 # Hash in Bucket 2
360 .long .Linfo_string6 # String in Bucket 1: t1
361 .long .Linfo_string3 # String in Bucket 1: main
362 .long .Linfo_string4 # String in Bucket 2: int
363 .long .Lnames2-.Lnames_entries0 # Offset in Bucket 1
364 .long .Lnames0-.Lnames_entries0 # Offset in Bucket 1
365 .long .Lnames1-.Lnames_entries0 # Offset in Bucket 2
366 .Lnames_abbrev_start0:
367 .byte 1 # Abbrev code
368 .byte 19 # DW_TAG_structure_type
369 .byte 3 # DW_IDX_die_offset
370 .byte 19 # DW_FORM_ref4
371 .byte 4 # DW_IDX_parent
372 .byte 25 # DW_FORM_flag_present
373 .byte 0 # End of abbrev
374 .byte 0 # End of abbrev
375 .byte 2 # Abbrev code
376 .byte 46 # DW_TAG_subprogram
377 .byte 3 # DW_IDX_die_offset
378 .byte 19 # DW_FORM_ref4
379 .byte 4 # DW_IDX_parent
380 .byte 25 # DW_FORM_flag_present
381 .byte 0 # End of abbrev
382 .byte 0 # End of abbrev
383 .byte 3 # Abbrev code
384 .byte 36 # DW_TAG_base_type
385 .byte 3 # DW_IDX_die_offset
386 .byte 19 # DW_FORM_ref4
387 .byte 4 # DW_IDX_parent
388 .byte 25 # DW_FORM_flag_present
389 .byte 0 # End of abbrev
390 .byte 0 # End of abbrev
391 .byte 0 # End of abbrev list
392 .Lnames_abbrev_end0:
393 .Lnames_entries0:
394 .Lnames2:
395 .L1:
396 .byte 1 # Abbreviation code
397 .long 66 # DW_IDX_die_offset
398 .byte 0 # DW_IDX_parent
399 # End of list: t1
400 .Lnames0:
401 .L2:
402 .byte 2 # Abbreviation code
403 .long 35 # DW_IDX_die_offset
404 .byte 0 # DW_IDX_parent
405 # End of list: main
406 .Lnames1:
407 .L0:
408 .byte 3 # Abbreviation code
409 .long 62 # DW_IDX_die_offset
410 .byte 0 # DW_IDX_parent
411 # End of list: int
412 .p2align 2, 0x0
413 .Lnames_end0:
414 .ident "clang version 19.0.0git (git@github.com:llvm/llvm-project.git 53b14cd9ce2b57da73d173fc876d2e9e199f5640)"
415 .section ".note.GNU-stack","",@progbits
416 .addrsig
417 .section .debug_line,"",@progbits
418 .Lline_table_start0: