xref: /llvm-project/llvm/test/tools/llvm-gsymutil/X86/elf-dwo.yaml (revision 3bdc4c702dfdd1f2fb513943f034d49bb79ded29)
1## Test loading an ELF file with split DWARF.
2## First we make the ELF file and dwo file from yaml,
3## then we test converting the ELF file with and without a valid dwo
4
5## RUN: yaml2obj %s -o %t
6## RUN: llvm-gsymutil --convert=%t -o %t.gsym | FileCheck %s --check-prefix=WARNING
7## RUN: llvm-gsymutil --convert=%t -o %t.gsym --quiet | FileCheck %s --check-prefix=WARNING-QUIET
8
9## WARNING: Input file: {{.*\.yaml\.tmp}}
10## WARNING: Output file (x86_64): {{.*\.yaml\.tmp\.gsym}}
11## WARNING: warning: Unable to retrieve DWO .debug_info section for main_split-main.dwo
12## WARNING: Loaded 0 functions from DWARF.
13## WARNING: Loaded 10 functions from symbol table.
14## WARNING: Pruned 0 functions, ended with 10 total
15
16## WARNING-QUIET: Input file: {{.*\.yaml\.tmp}}
17## WARNING-QUIET: Output file (x86_64): {{.*\.yaml\.tmp\.gsym}}
18## WARNING-QUIET: Pruned 0 functions, ended with 10 total
19## WARNING-QUIET: warning: Unable to retrieve DWO .debug_info section for some object files. (Remove the --quiet flag for full output)
20
21
22
23--- !ELF
24FileHeader:
25  Class:           ELFCLASS64
26  Data:            ELFDATA2LSB
27  Type:            ET_EXEC
28  Machine:         EM_X86_64
29  Entry:           0x401020
30ProgramHeaders:
31  - Type:            PT_PHDR
32    Flags:           [ PF_R ]
33    VAddr:           0x400040
34    Align:           0x8
35  - Type:            PT_INTERP
36    Flags:           [ PF_R ]
37    FirstSec:        .interp
38    LastSec:         .interp
39    VAddr:           0x400318
40  - Type:            PT_LOAD
41    Flags:           [ PF_R ]
42    FirstSec:        .interp
43    LastSec:         .rela.dyn
44    VAddr:           0x400000
45    Align:           0x1000
46  - Type:            PT_LOAD
47    Flags:           [ PF_X, PF_R ]
48    FirstSec:        .init
49    LastSec:         .fini
50    VAddr:           0x401000
51    Align:           0x1000
52  - Type:            PT_LOAD
53    Flags:           [ PF_R ]
54    FirstSec:        .rodata
55    LastSec:         .eh_frame
56    VAddr:           0x402000
57    Align:           0x1000
58  - Type:            PT_LOAD
59    Flags:           [ PF_W, PF_R ]
60    FirstSec:        .init_array
61    LastSec:         .bss
62    VAddr:           0x403DF8
63    Align:           0x1000
64  - Type:            PT_DYNAMIC
65    Flags:           [ PF_W, PF_R ]
66    FirstSec:        .dynamic
67    LastSec:         .dynamic
68    VAddr:           0x403E08
69    Align:           0x8
70  - Type:            PT_NOTE
71    Flags:           [ PF_R ]
72    FirstSec:        .note.gnu.property
73    LastSec:         .note.gnu.property
74    VAddr:           0x400338
75    Align:           0x8
76  - Type:            PT_NOTE
77    Flags:           [ PF_R ]
78    FirstSec:        .note.gnu.build-id
79    LastSec:         .note.ABI-tag
80    VAddr:           0x400358
81    Align:           0x4
82  - Type:            PT_GNU_PROPERTY
83    Flags:           [ PF_R ]
84    FirstSec:        .note.gnu.property
85    LastSec:         .note.gnu.property
86    VAddr:           0x400338
87    Align:           0x8
88  - Type:            PT_GNU_EH_FRAME
89    Flags:           [ PF_R ]
90    FirstSec:        .eh_frame_hdr
91    LastSec:         .eh_frame_hdr
92    VAddr:           0x402010
93    Align:           0x4
94  - Type:            PT_GNU_STACK
95    Flags:           [ PF_W, PF_R ]
96    Align:           0x10
97  - Type:            PT_GNU_RELRO
98    Flags:           [ PF_R ]
99    FirstSec:        .init_array
100    LastSec:         .got.plt
101    VAddr:           0x403DF8
102Sections:
103  - Name:            .interp
104    Type:            SHT_PROGBITS
105    Flags:           [ SHF_ALLOC ]
106    Address:         0x400318
107    AddressAlign:    0x1
108    Content:         2F6C696236342F6C642D6C696E75782D7838362D36342E736F2E3200
109  - Name:            .note.gnu.property
110    Type:            SHT_NOTE
111    Flags:           [ SHF_ALLOC ]
112    Address:         0x400338
113    AddressAlign:    0x8
114    Notes:
115      - Name:            GNU
116        Desc:            028000C0040000000300000000000000
117        Type:            NT_GNU_PROPERTY_TYPE_0
118  - Name:            .note.gnu.build-id
119    Type:            SHT_NOTE
120    Flags:           [ SHF_ALLOC ]
121    Address:         0x400358
122    AddressAlign:    0x4
123    Notes:
124      - Name:            GNU
125        Desc:            250FD8246225C95E81C87BE2EEB38DD068A42DEE
126        Type:            NT_PRPSINFO
127  - Name:            .note.ABI-tag
128    Type:            SHT_NOTE
129    Flags:           [ SHF_ALLOC ]
130    Address:         0x40037C
131    AddressAlign:    0x4
132    Notes:
133      - Name:            GNU
134        Desc:            '00000000030000000200000000000000'
135        Type:            NT_VERSION
136  - Name:            .gnu.hash
137    Type:            SHT_GNU_HASH
138    Flags:           [ SHF_ALLOC ]
139    Address:         0x4003A0
140    Link:            .dynsym
141    AddressAlign:    0x8
142    Header:
143      SymNdx:          0x1
144      Shift2:          0x0
145    BloomFilter:     [ 0x0 ]
146    HashBuckets:     [ 0x0 ]
147    HashValues:      [  ]
148  - Name:            .dynsym
149    Type:            SHT_DYNSYM
150    Flags:           [ SHF_ALLOC ]
151    Address:         0x4003C0
152    Link:            .dynstr
153    AddressAlign:    0x8
154  - Name:            .dynstr
155    Type:            SHT_STRTAB
156    Flags:           [ SHF_ALLOC ]
157    Address:         0x400438
158    AddressAlign:    0x1
159  - Name:            .gnu.version
160    Type:            SHT_GNU_versym
161    Flags:           [ SHF_ALLOC ]
162    Address:         0x4004CC
163    Link:            .dynsym
164    AddressAlign:    0x2
165    Entries:         [ 0, 2, 1, 1, 1 ]
166  - Name:            .gnu.version_r
167    Type:            SHT_GNU_verneed
168    Flags:           [ SHF_ALLOC ]
169    Address:         0x4004D8
170    Link:            .dynstr
171    AddressAlign:    0x8
172    Dependencies:
173      - Version:         1
174        File:            libc.so.6
175        Entries:
176          - Name:            GLIBC_2.34
177            Hash:            110530996
178            Flags:           0
179            Other:           2
180  - Name:            .rela.dyn
181    Type:            SHT_RELA
182    Flags:           [ SHF_ALLOC ]
183    Address:         0x4004F8
184    Link:            .dynsym
185    AddressAlign:    0x8
186    Relocations:
187      - Offset:          0x403FC8
188        Symbol:          __libc_start_main
189        Type:            R_X86_64_GLOB_DAT
190      - Offset:          0x403FD0
191        Symbol:          _ITM_deregisterTMCloneTable
192        Type:            R_X86_64_GLOB_DAT
193      - Offset:          0x403FD8
194        Symbol:          __gmon_start__
195        Type:            R_X86_64_GLOB_DAT
196      - Offset:          0x403FE0
197        Symbol:          _ITM_registerTMCloneTable
198        Type:            R_X86_64_GLOB_DAT
199  - Name:            .init
200    Type:            SHT_PROGBITS
201    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
202    Address:         0x401000
203    AddressAlign:    0x4
204    Offset:          0x1000
205    Content:         F30F1EFA4883EC08488B05C92F00004885C07402FFD04883C408C3
206  - Name:            .text
207    Type:            SHT_PROGBITS
208    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
209    Address:         0x401020
210    AddressAlign:    0x10
211    Content:         F30F1EFA31ED4989D15E4889E24883E4F050544531C031C948C7C720114000FF15832F0000F4662E0F1F840000000000F30F1EFAC3662E0F1F84000000000090488D3DA12F0000488D059A2F00004839F87415488B05562F00004885C07409FFE00F1F8000000000C30F1F8000000000488D3D712F0000488D356A2F00004829FE4889F048C1EE3F48C1F8034801C648D1FE7414488B05252F00004885C07408FFE0660F1F440000C30F1F8000000000F30F1EFA803D292F0000007513554889E5E87AFFFFFFC605172F0000015DC390C366662E0F1F8400000000000F1F4000F30F1EFAEB8A662E0F1F840000000000554889E55DC3662E0F1F840000000000554889E54883EC10C745FC00000000E8DCFFFFFF31C04883C4105DC3
212  - Name:            .fini
213    Type:            SHT_PROGBITS
214    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
215    Address:         0x40113C
216    AddressAlign:    0x4
217    Content:         F30F1EFA4883EC084883C408C3
218  - Name:            .rodata
219    Type:            SHT_PROGBITS
220    Flags:           [ SHF_ALLOC ]
221    Address:         0x402000
222    AddressAlign:    0x8
223    Offset:          0x2000
224    Content:         '01000200000000000000000000000000'
225  - Name:            .eh_frame_hdr
226    Type:            SHT_PROGBITS
227    Flags:           [ SHF_ALLOC ]
228    Address:         0x402010
229    AddressAlign:    0x4
230    Content:         011B033B2C0000000400000010F0FFFF4800000040F0FFFF5C00000000F1FFFF7000000010F1FFFF90000000
231  - Name:            .eh_frame
232    Type:            SHT_PROGBITS
233    Flags:           [ SHF_ALLOC ]
234    Address:         0x402040
235    AddressAlign:    0x8
236    Content:         1400000000000000017A5200017810011B0C070890010000100000001C000000C0EFFFFF26000000004407101000000030000000DCEFFFFF05000000000000001C0000004400000088F0FFFF0600000000410E108602430D06410C07080000001C0000006400000078F0FFFF1C00000000410E108602430D06570C070800000000000000
237  - Name:            .init_array
238    Type:            SHT_INIT_ARRAY
239    Flags:           [ SHF_WRITE, SHF_ALLOC ]
240    Address:         0x403DF8
241    AddressAlign:    0x8
242    EntSize:         0x8
243    Offset:          0x2DF8
244    Content:         '0011400000000000'
245  - Name:            .fini_array
246    Type:            SHT_FINI_ARRAY
247    Flags:           [ SHF_WRITE, SHF_ALLOC ]
248    Address:         0x403E00
249    AddressAlign:    0x8
250    EntSize:         0x8
251    Content:         D010400000000000
252  - Name:            .dynamic
253    Type:            SHT_DYNAMIC
254    Flags:           [ SHF_WRITE, SHF_ALLOC ]
255    Address:         0x403E08
256    Link:            .dynstr
257    AddressAlign:    0x8
258    Entries:
259      - Tag:             DT_NEEDED
260        Value:           0x58
261      - Tag:             DT_NEEDED
262        Value:           0x67
263      - Tag:             DT_NEEDED
264        Value:           0x71
265      - Tag:             DT_NEEDED
266        Value:           0x7F
267      - Tag:             DT_INIT
268        Value:           0x401000
269      - Tag:             DT_FINI
270        Value:           0x40113C
271      - Tag:             DT_INIT_ARRAY
272        Value:           0x403DF8
273      - Tag:             DT_INIT_ARRAYSZ
274        Value:           0x8
275      - Tag:             DT_FINI_ARRAY
276        Value:           0x403E00
277      - Tag:             DT_FINI_ARRAYSZ
278        Value:           0x8
279      - Tag:             DT_GNU_HASH
280        Value:           0x4003A0
281      - Tag:             DT_STRTAB
282        Value:           0x400438
283      - Tag:             DT_SYMTAB
284        Value:           0x4003C0
285      - Tag:             DT_STRSZ
286        Value:           0x94
287      - Tag:             DT_SYMENT
288        Value:           0x18
289      - Tag:             DT_DEBUG
290        Value:           0x0
291      - Tag:             DT_RELA
292        Value:           0x4004F8
293      - Tag:             DT_RELASZ
294        Value:           0x60
295      - Tag:             DT_RELAENT
296        Value:           0x18
297      - Tag:             DT_VERNEED
298        Value:           0x4004D8
299      - Tag:             DT_VERNEEDNUM
300        Value:           0x1
301      - Tag:             DT_VERSYM
302        Value:           0x4004CC
303      - Tag:             DT_NULL
304        Value:           0x0
305      - Tag:             DT_NULL
306        Value:           0x0
307      - Tag:             DT_NULL
308        Value:           0x0
309      - Tag:             DT_NULL
310        Value:           0x0
311      - Tag:             DT_NULL
312        Value:           0x0
313      - Tag:             DT_NULL
314        Value:           0x0
315  - Name:            .got
316    Type:            SHT_PROGBITS
317    Flags:           [ SHF_WRITE, SHF_ALLOC ]
318    Address:         0x403FC8
319    AddressAlign:    0x8
320    EntSize:         0x8
321    Content:         '0000000000000000000000000000000000000000000000000000000000000000'
322  - Name:            .got.plt
323    Type:            SHT_PROGBITS
324    Flags:           [ SHF_WRITE, SHF_ALLOC ]
325    Address:         0x403FE8
326    AddressAlign:    0x8
327    EntSize:         0x8
328    Content:         '083E40000000000000000000000000000000000000000000'
329  - Name:            .data
330    Type:            SHT_PROGBITS
331    Flags:           [ SHF_WRITE, SHF_ALLOC ]
332    Address:         0x404000
333    AddressAlign:    0x1
334    Content:         '00000000'
335  - Name:            .bss
336    Type:            SHT_NOBITS
337    Flags:           [ SHF_WRITE, SHF_ALLOC ]
338    Address:         0x404004
339    AddressAlign:    0x1
340    Size:            0x4
341  - Name:            .comment
342    Type:            SHT_PROGBITS
343    Flags:           [ SHF_MERGE, SHF_STRINGS ]
344    AddressAlign:    0x1
345    EntSize:         0x1
346    Content:         4743433A2028474E55292031312E342E312032303233303630352028526564204861742031312E342E312D3229004743433A2028474E55292031332E322E312032303233313131302028526564204861742031332E322E312D352900636C616E672076657273696F6E2031372E302E31202843656E744F532031372E302E312D322E656C392900
347  - Name:            .gnu.build.attributes
348    Type:            SHT_NOTE
349    Address:         0x406008
350    AddressAlign:    0x4
351    Notes:
352      - Name:            "GA$\x013a1"
353        Desc:            '20104000000000004610400000000000'
354        Type:            NT_GNU_BUILD_ATTRIBUTE_OPEN
355      - Name:            "GA$\x013a1"
356        Desc:            '55104000000000005510400000000000'
357        Type:            NT_GNU_BUILD_ATTRIBUTE_OPEN
358      - Name:            "GA$\x013a1"
359        Desc:            '00104000000000001610400000000000'
360        Type:            NT_GNU_BUILD_ATTRIBUTE_OPEN
361      - Name:            "GA$\x013a1"
362        Desc:            3C114000000000004411400000000000
363        Type:            NT_GNU_BUILD_ATTRIBUTE_OPEN
364      - Name:            "GA$\x013a1"
365        Desc:            '60104000000000000611400000000000'
366        Type:            NT_GNU_BUILD_ATTRIBUTE_OPEN
367      - Name:            "GA$\x013a1"
368        Desc:            3C114000000000003C11400000000000
369        Type:            NT_GNU_BUILD_ATTRIBUTE_OPEN
370      - Name:            "GA$\x013a1"
371        Desc:            3C114000000000003C11400000000000
372        Type:            NT_GNU_BUILD_ATTRIBUTE_OPEN
373      - Name:            "GA$\x013a1"
374        Desc:            16104000000000001B10400000000000
375        Type:            NT_GNU_BUILD_ATTRIBUTE_OPEN
376      - Name:            "GA$\x013a1"
377        Desc:            '44114000000000004911400000000000'
378        Type:            NT_GNU_BUILD_ATTRIBUTE_OPEN
379  - Name:            .debug_info
380    Type:            SHT_PROGBITS
381    AddressAlign:    0x1
382    Content:         2C000000040000000000080100000000000000000E000000939F5FCB7816797B10114000000000002C00000000000000
383  - Name:            .debug_abbrev
384    Type:            SHT_PROGBITS
385    AddressAlign:    0x1
386    Content:         01110010171B0EB44219B0420EB1420711011206B34217000000
387  - Name:            .debug_line
388    Type:            SHT_PROGBITS
389    AddressAlign:    0x1
390    Content:         47000000040020000000010101FB0E0D000101010100000001000001006D61696E2E637070000000000000090210114000000000000105050A0B4B0500BD05050AE559060B2E0206000101
391  - Name:            .debug_addr
392    Type:            SHT_PROGBITS
393    AddressAlign:    0x1
394    Content:         '10114000000000002011400000000000'
395  - Name:            .debug_gnu_pubnames
396    Type:            SHT_PROGBITS
397    AddressAlign:    0x1
398    Content:         21000000020000000000300000001900000030666F6F0025000000306D61696E0000000000
399  - Name:            .debug_gnu_pubtypes
400    Type:            SHT_PROGBITS
401    AddressAlign:    0x1
402    Content:         '17000000020000000000300000003400000090696E740000000000'
403Symbols:
404  - Name:            crt1.o
405    Type:            STT_FILE
406    Index:           SHN_ABS
407  - Name:            __abi_tag
408    Type:            STT_OBJECT
409    Section:         .note.ABI-tag
410    Value:           0x40037C
411    Size:            0x20
412  - Name:            crtstuff.c
413    Type:            STT_FILE
414    Index:           SHN_ABS
415  - Name:            deregister_tm_clones
416    Type:            STT_FUNC
417    Section:         .text
418    Value:           0x401060
419  - Name:            register_tm_clones
420    Type:            STT_FUNC
421    Section:         .text
422    Value:           0x401090
423  - Name:            __do_global_dtors_aux
424    Type:            STT_FUNC
425    Section:         .text
426    Value:           0x4010D0
427  - Name:            completed.0
428    Type:            STT_OBJECT
429    Section:         .bss
430    Value:           0x404004
431    Size:            0x1
432  - Name:            __do_global_dtors_aux_fini_array_entry
433    Type:            STT_OBJECT
434    Section:         .fini_array
435    Value:           0x403E00
436  - Name:            frame_dummy
437    Type:            STT_FUNC
438    Section:         .text
439    Value:           0x401100
440  - Name:            __frame_dummy_init_array_entry
441    Type:            STT_OBJECT
442    Section:         .init_array
443    Value:           0x403DF8
444  - Name:            main.cpp
445    Type:            STT_FILE
446    Index:           SHN_ABS
447  - Name:            'crtstuff.c (1)'
448    Type:            STT_FILE
449    Index:           SHN_ABS
450  - Name:            __FRAME_END__
451    Type:            STT_OBJECT
452    Section:         .eh_frame
453    Value:           0x4020C0
454  - Type:            STT_FILE
455    Index:           SHN_ABS
456  - Name:            __GNU_EH_FRAME_HDR
457    Section:         .eh_frame_hdr
458    Value:           0x402010
459  - Name:            _DYNAMIC
460    Type:            STT_OBJECT
461    Section:         .dynamic
462    Value:           0x403E08
463  - Name:            _GLOBAL_OFFSET_TABLE_
464    Type:            STT_OBJECT
465    Section:         .got.plt
466    Value:           0x403FE8
467  - Name:            _edata
468    Section:         .data
469    Binding:         STB_GLOBAL
470    Value:           0x404004
471  - Name:            data_start
472    Section:         .data
473    Binding:         STB_WEAK
474    Value:           0x404000
475  - Name:            _IO_stdin_used
476    Type:            STT_OBJECT
477    Section:         .rodata
478    Binding:         STB_GLOBAL
479    Value:           0x402000
480    Size:            0x4
481  - Name:            main
482    Type:            STT_FUNC
483    Section:         .text
484    Binding:         STB_GLOBAL
485    Value:           0x401120
486    Size:            0x1C
487  - Name:            __dso_handle
488    Type:            STT_OBJECT
489    Section:         .rodata
490    Binding:         STB_GLOBAL
491    Value:           0x402008
492    Other:           [ STV_HIDDEN ]
493  - Name:            _fini
494    Type:            STT_FUNC
495    Section:         .fini
496    Binding:         STB_GLOBAL
497    Value:           0x40113C
498    Other:           [ STV_HIDDEN ]
499  - Name:            '__libc_start_main@GLIBC_2.34'
500    Type:            STT_FUNC
501    Binding:         STB_GLOBAL
502  - Name:            _dl_relocate_static_pie
503    Type:            STT_FUNC
504    Section:         .text
505    Binding:         STB_GLOBAL
506    Value:           0x401050
507    Size:            0x5
508    Other:           [ STV_HIDDEN ]
509  - Name:            _start
510    Type:            STT_FUNC
511    Section:         .text
512    Binding:         STB_GLOBAL
513    Value:           0x401020
514    Size:            0x26
515  - Name:            _init
516    Type:            STT_FUNC
517    Section:         .init
518    Binding:         STB_GLOBAL
519    Value:           0x401000
520    Other:           [ STV_HIDDEN ]
521  - Name:            __TMC_END__
522    Type:            STT_OBJECT
523    Section:         .data
524    Binding:         STB_GLOBAL
525    Value:           0x404008
526    Other:           [ STV_HIDDEN ]
527  - Name:            __data_start
528    Section:         .data
529    Binding:         STB_GLOBAL
530    Value:           0x404000
531  - Name:            _end
532    Section:         .bss
533    Binding:         STB_GLOBAL
534    Value:           0x404008
535  - Name:            __bss_start
536    Section:         .bss
537    Binding:         STB_GLOBAL
538    Value:           0x404004
539  - Name:            _Z3foov
540    Type:            STT_FUNC
541    Section:         .text
542    Binding:         STB_GLOBAL
543    Value:           0x401110
544    Size:            0x6
545  - Name:            _ITM_deregisterTMCloneTable
546    Binding:         STB_WEAK
547  - Name:            __gmon_start__
548    Binding:         STB_WEAK
549  - Name:            _ITM_registerTMCloneTable
550    Binding:         STB_WEAK
551DynamicSymbols:
552  - Name:            __libc_start_main
553    Type:            STT_FUNC
554    Binding:         STB_GLOBAL
555  - Name:            _ITM_deregisterTMCloneTable
556    Binding:         STB_WEAK
557  - Name:            __gmon_start__
558    Binding:         STB_WEAK
559  - Name:            _ITM_registerTMCloneTable
560    Binding:         STB_WEAK
561DWARF:
562  debug_str:
563    - '/tmp/test_dwo'
564    - main_split-main.dwo
565...
566