## Test loading an ELF file with split DWARF.
## First we make the ELF file and dwo file from yaml,
## then we test converting the ELF file with and without a valid dwo

## RUN: yaml2obj %s -o %t
## RUN: llvm-gsymutil --convert=%t -o %t.gsym | FileCheck %s --check-prefix=WARNING
## RUN: llvm-gsymutil --convert=%t -o %t.gsym --quiet | FileCheck %s --check-prefix=WARNING-QUIET

## WARNING: Input file: {{.*\.yaml\.tmp}}
## WARNING: Output file (x86_64): {{.*\.yaml\.tmp\.gsym}}
## WARNING: warning: Unable to retrieve DWO .debug_info section for main_split-main.dwo
## WARNING: Loaded 0 functions from DWARF.
## WARNING: Loaded 10 functions from symbol table.
## WARNING: Pruned 0 functions, ended with 10 total

## WARNING-QUIET: Input file: {{.*\.yaml\.tmp}}
## WARNING-QUIET: Output file (x86_64): {{.*\.yaml\.tmp\.gsym}}
## WARNING-QUIET: Pruned 0 functions, ended with 10 total
## WARNING-QUIET: warning: Unable to retrieve DWO .debug_info section for some object files. (Remove the --quiet flag for full output)



--- !ELF
FileHeader:
  Class:           ELFCLASS64
  Data:            ELFDATA2LSB
  Type:            ET_EXEC
  Machine:         EM_X86_64
  Entry:           0x401020
ProgramHeaders:
  - Type:            PT_PHDR
    Flags:           [ PF_R ]
    VAddr:           0x400040
    Align:           0x8
  - Type:            PT_INTERP
    Flags:           [ PF_R ]
    FirstSec:        .interp
    LastSec:         .interp
    VAddr:           0x400318
  - Type:            PT_LOAD
    Flags:           [ PF_R ]
    FirstSec:        .interp
    LastSec:         .rela.dyn
    VAddr:           0x400000
    Align:           0x1000
  - Type:            PT_LOAD
    Flags:           [ PF_X, PF_R ]
    FirstSec:        .init
    LastSec:         .fini
    VAddr:           0x401000
    Align:           0x1000
  - Type:            PT_LOAD
    Flags:           [ PF_R ]
    FirstSec:        .rodata
    LastSec:         .eh_frame
    VAddr:           0x402000
    Align:           0x1000
  - Type:            PT_LOAD
    Flags:           [ PF_W, PF_R ]
    FirstSec:        .init_array
    LastSec:         .bss
    VAddr:           0x403DF8
    Align:           0x1000
  - Type:            PT_DYNAMIC
    Flags:           [ PF_W, PF_R ]
    FirstSec:        .dynamic
    LastSec:         .dynamic
    VAddr:           0x403E08
    Align:           0x8
  - Type:            PT_NOTE
    Flags:           [ PF_R ]
    FirstSec:        .note.gnu.property
    LastSec:         .note.gnu.property
    VAddr:           0x400338
    Align:           0x8
  - Type:            PT_NOTE
    Flags:           [ PF_R ]
    FirstSec:        .note.gnu.build-id
    LastSec:         .note.ABI-tag
    VAddr:           0x400358
    Align:           0x4
  - Type:            PT_GNU_PROPERTY
    Flags:           [ PF_R ]
    FirstSec:        .note.gnu.property
    LastSec:         .note.gnu.property
    VAddr:           0x400338
    Align:           0x8
  - Type:            PT_GNU_EH_FRAME
    Flags:           [ PF_R ]
    FirstSec:        .eh_frame_hdr
    LastSec:         .eh_frame_hdr
    VAddr:           0x402010
    Align:           0x4
  - Type:            PT_GNU_STACK
    Flags:           [ PF_W, PF_R ]
    Align:           0x10
  - Type:            PT_GNU_RELRO
    Flags:           [ PF_R ]
    FirstSec:        .init_array
    LastSec:         .got.plt
    VAddr:           0x403DF8
Sections:
  - Name:            .interp
    Type:            SHT_PROGBITS
    Flags:           [ SHF_ALLOC ]
    Address:         0x400318
    AddressAlign:    0x1
    Content:         2F6C696236342F6C642D6C696E75782D7838362D36342E736F2E3200
  - Name:            .note.gnu.property
    Type:            SHT_NOTE
    Flags:           [ SHF_ALLOC ]
    Address:         0x400338
    AddressAlign:    0x8
    Notes:
      - Name:            GNU
        Desc:            028000C0040000000300000000000000
        Type:            NT_GNU_PROPERTY_TYPE_0
  - Name:            .note.gnu.build-id
    Type:            SHT_NOTE
    Flags:           [ SHF_ALLOC ]
    Address:         0x400358
    AddressAlign:    0x4
    Notes:
      - Name:            GNU
        Desc:            250FD8246225C95E81C87BE2EEB38DD068A42DEE
        Type:            NT_PRPSINFO
  - Name:            .note.ABI-tag
    Type:            SHT_NOTE
    Flags:           [ SHF_ALLOC ]
    Address:         0x40037C
    AddressAlign:    0x4
    Notes:
      - Name:            GNU
        Desc:            '00000000030000000200000000000000'
        Type:            NT_VERSION
  - Name:            .gnu.hash
    Type:            SHT_GNU_HASH
    Flags:           [ SHF_ALLOC ]
    Address:         0x4003A0
    Link:            .dynsym
    AddressAlign:    0x8
    Header:
      SymNdx:          0x1
      Shift2:          0x0
    BloomFilter:     [ 0x0 ]
    HashBuckets:     [ 0x0 ]
    HashValues:      [  ]
  - Name:            .dynsym
    Type:            SHT_DYNSYM
    Flags:           [ SHF_ALLOC ]
    Address:         0x4003C0
    Link:            .dynstr
    AddressAlign:    0x8
  - Name:            .dynstr
    Type:            SHT_STRTAB
    Flags:           [ SHF_ALLOC ]
    Address:         0x400438
    AddressAlign:    0x1
  - Name:            .gnu.version
    Type:            SHT_GNU_versym
    Flags:           [ SHF_ALLOC ]
    Address:         0x4004CC
    Link:            .dynsym
    AddressAlign:    0x2
    Entries:         [ 0, 2, 1, 1, 1 ]
  - Name:            .gnu.version_r
    Type:            SHT_GNU_verneed
    Flags:           [ SHF_ALLOC ]
    Address:         0x4004D8
    Link:            .dynstr
    AddressAlign:    0x8
    Dependencies:
      - Version:         1
        File:            libc.so.6
        Entries:
          - Name:            GLIBC_2.34
            Hash:            110530996
            Flags:           0
            Other:           2
  - Name:            .rela.dyn
    Type:            SHT_RELA
    Flags:           [ SHF_ALLOC ]
    Address:         0x4004F8
    Link:            .dynsym
    AddressAlign:    0x8
    Relocations:
      - Offset:          0x403FC8
        Symbol:          __libc_start_main
        Type:            R_X86_64_GLOB_DAT
      - Offset:          0x403FD0
        Symbol:          _ITM_deregisterTMCloneTable
        Type:            R_X86_64_GLOB_DAT
      - Offset:          0x403FD8
        Symbol:          __gmon_start__
        Type:            R_X86_64_GLOB_DAT
      - Offset:          0x403FE0
        Symbol:          _ITM_registerTMCloneTable
        Type:            R_X86_64_GLOB_DAT
  - Name:            .init
    Type:            SHT_PROGBITS
    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
    Address:         0x401000
    AddressAlign:    0x4
    Offset:          0x1000
    Content:         F30F1EFA4883EC08488B05C92F00004885C07402FFD04883C408C3
  - Name:            .text
    Type:            SHT_PROGBITS
    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
    Address:         0x401020
    AddressAlign:    0x10
    Content:         F30F1EFA31ED4989D15E4889E24883E4F050544531C031C948C7C720114000FF15832F0000F4662E0F1F840000000000F30F1EFAC3662E0F1F84000000000090488D3DA12F0000488D059A2F00004839F87415488B05562F00004885C07409FFE00F1F8000000000C30F1F8000000000488D3D712F0000488D356A2F00004829FE4889F048C1EE3F48C1F8034801C648D1FE7414488B05252F00004885C07408FFE0660F1F440000C30F1F8000000000F30F1EFA803D292F0000007513554889E5E87AFFFFFFC605172F0000015DC390C366662E0F1F8400000000000F1F4000F30F1EFAEB8A662E0F1F840000000000554889E55DC3662E0F1F840000000000554889E54883EC10C745FC00000000E8DCFFFFFF31C04883C4105DC3
  - Name:            .fini
    Type:            SHT_PROGBITS
    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
    Address:         0x40113C
    AddressAlign:    0x4
    Content:         F30F1EFA4883EC084883C408C3
  - Name:            .rodata
    Type:            SHT_PROGBITS
    Flags:           [ SHF_ALLOC ]
    Address:         0x402000
    AddressAlign:    0x8
    Offset:          0x2000
    Content:         '01000200000000000000000000000000'
  - Name:            .eh_frame_hdr
    Type:            SHT_PROGBITS
    Flags:           [ SHF_ALLOC ]
    Address:         0x402010
    AddressAlign:    0x4
    Content:         011B033B2C0000000400000010F0FFFF4800000040F0FFFF5C00000000F1FFFF7000000010F1FFFF90000000
  - Name:            .eh_frame
    Type:            SHT_PROGBITS
    Flags:           [ SHF_ALLOC ]
    Address:         0x402040
    AddressAlign:    0x8
    Content:         1400000000000000017A5200017810011B0C070890010000100000001C000000C0EFFFFF26000000004407101000000030000000DCEFFFFF05000000000000001C0000004400000088F0FFFF0600000000410E108602430D06410C07080000001C0000006400000078F0FFFF1C00000000410E108602430D06570C070800000000000000
  - Name:            .init_array
    Type:            SHT_INIT_ARRAY
    Flags:           [ SHF_WRITE, SHF_ALLOC ]
    Address:         0x403DF8
    AddressAlign:    0x8
    EntSize:         0x8
    Offset:          0x2DF8
    Content:         '0011400000000000'
  - Name:            .fini_array
    Type:            SHT_FINI_ARRAY
    Flags:           [ SHF_WRITE, SHF_ALLOC ]
    Address:         0x403E00
    AddressAlign:    0x8
    EntSize:         0x8
    Content:         D010400000000000
  - Name:            .dynamic
    Type:            SHT_DYNAMIC
    Flags:           [ SHF_WRITE, SHF_ALLOC ]
    Address:         0x403E08
    Link:            .dynstr
    AddressAlign:    0x8
    Entries:
      - Tag:             DT_NEEDED
        Value:           0x58
      - Tag:             DT_NEEDED
        Value:           0x67
      - Tag:             DT_NEEDED
        Value:           0x71
      - Tag:             DT_NEEDED
        Value:           0x7F
      - Tag:             DT_INIT
        Value:           0x401000
      - Tag:             DT_FINI
        Value:           0x40113C
      - Tag:             DT_INIT_ARRAY
        Value:           0x403DF8
      - Tag:             DT_INIT_ARRAYSZ
        Value:           0x8
      - Tag:             DT_FINI_ARRAY
        Value:           0x403E00
      - Tag:             DT_FINI_ARRAYSZ
        Value:           0x8
      - Tag:             DT_GNU_HASH
        Value:           0x4003A0
      - Tag:             DT_STRTAB
        Value:           0x400438
      - Tag:             DT_SYMTAB
        Value:           0x4003C0
      - Tag:             DT_STRSZ
        Value:           0x94
      - Tag:             DT_SYMENT
        Value:           0x18
      - Tag:             DT_DEBUG
        Value:           0x0
      - Tag:             DT_RELA
        Value:           0x4004F8
      - Tag:             DT_RELASZ
        Value:           0x60
      - Tag:             DT_RELAENT
        Value:           0x18
      - Tag:             DT_VERNEED
        Value:           0x4004D8
      - Tag:             DT_VERNEEDNUM
        Value:           0x1
      - Tag:             DT_VERSYM
        Value:           0x4004CC
      - Tag:             DT_NULL
        Value:           0x0
      - Tag:             DT_NULL
        Value:           0x0
      - Tag:             DT_NULL
        Value:           0x0
      - Tag:             DT_NULL
        Value:           0x0
      - Tag:             DT_NULL
        Value:           0x0
      - Tag:             DT_NULL
        Value:           0x0
  - Name:            .got
    Type:            SHT_PROGBITS
    Flags:           [ SHF_WRITE, SHF_ALLOC ]
    Address:         0x403FC8
    AddressAlign:    0x8
    EntSize:         0x8
    Content:         '0000000000000000000000000000000000000000000000000000000000000000'
  - Name:            .got.plt
    Type:            SHT_PROGBITS
    Flags:           [ SHF_WRITE, SHF_ALLOC ]
    Address:         0x403FE8
    AddressAlign:    0x8
    EntSize:         0x8
    Content:         '083E40000000000000000000000000000000000000000000'
  - Name:            .data
    Type:            SHT_PROGBITS
    Flags:           [ SHF_WRITE, SHF_ALLOC ]
    Address:         0x404000
    AddressAlign:    0x1
    Content:         '00000000'
  - Name:            .bss
    Type:            SHT_NOBITS
    Flags:           [ SHF_WRITE, SHF_ALLOC ]
    Address:         0x404004
    AddressAlign:    0x1
    Size:            0x4
  - Name:            .comment
    Type:            SHT_PROGBITS
    Flags:           [ SHF_MERGE, SHF_STRINGS ]
    AddressAlign:    0x1
    EntSize:         0x1
    Content:         4743433A2028474E55292031312E342E312032303233303630352028526564204861742031312E342E312D3229004743433A2028474E55292031332E322E312032303233313131302028526564204861742031332E322E312D352900636C616E672076657273696F6E2031372E302E31202843656E744F532031372E302E312D322E656C392900
  - Name:            .gnu.build.attributes
    Type:            SHT_NOTE
    Address:         0x406008
    AddressAlign:    0x4
    Notes:
      - Name:            "GA$\x013a1"
        Desc:            '20104000000000004610400000000000'
        Type:            NT_GNU_BUILD_ATTRIBUTE_OPEN
      - Name:            "GA$\x013a1"
        Desc:            '55104000000000005510400000000000'
        Type:            NT_GNU_BUILD_ATTRIBUTE_OPEN
      - Name:            "GA$\x013a1"
        Desc:            '00104000000000001610400000000000'
        Type:            NT_GNU_BUILD_ATTRIBUTE_OPEN
      - Name:            "GA$\x013a1"
        Desc:            3C114000000000004411400000000000
        Type:            NT_GNU_BUILD_ATTRIBUTE_OPEN
      - Name:            "GA$\x013a1"
        Desc:            '60104000000000000611400000000000'
        Type:            NT_GNU_BUILD_ATTRIBUTE_OPEN
      - Name:            "GA$\x013a1"
        Desc:            3C114000000000003C11400000000000
        Type:            NT_GNU_BUILD_ATTRIBUTE_OPEN
      - Name:            "GA$\x013a1"
        Desc:            3C114000000000003C11400000000000
        Type:            NT_GNU_BUILD_ATTRIBUTE_OPEN
      - Name:            "GA$\x013a1"
        Desc:            16104000000000001B10400000000000
        Type:            NT_GNU_BUILD_ATTRIBUTE_OPEN
      - Name:            "GA$\x013a1"
        Desc:            '44114000000000004911400000000000'
        Type:            NT_GNU_BUILD_ATTRIBUTE_OPEN
  - Name:            .debug_info
    Type:            SHT_PROGBITS
    AddressAlign:    0x1
    Content:         2C000000040000000000080100000000000000000E000000939F5FCB7816797B10114000000000002C00000000000000
  - Name:            .debug_abbrev
    Type:            SHT_PROGBITS
    AddressAlign:    0x1
    Content:         01110010171B0EB44219B0420EB1420711011206B34217000000
  - Name:            .debug_line
    Type:            SHT_PROGBITS
    AddressAlign:    0x1
    Content:         47000000040020000000010101FB0E0D000101010100000001000001006D61696E2E637070000000000000090210114000000000000105050A0B4B0500BD05050AE559060B2E0206000101
  - Name:            .debug_addr
    Type:            SHT_PROGBITS
    AddressAlign:    0x1
    Content:         '10114000000000002011400000000000'
  - Name:            .debug_gnu_pubnames
    Type:            SHT_PROGBITS
    AddressAlign:    0x1
    Content:         21000000020000000000300000001900000030666F6F0025000000306D61696E0000000000
  - Name:            .debug_gnu_pubtypes
    Type:            SHT_PROGBITS
    AddressAlign:    0x1
    Content:         '17000000020000000000300000003400000090696E740000000000'
Symbols:
  - Name:            crt1.o
    Type:            STT_FILE
    Index:           SHN_ABS
  - Name:            __abi_tag
    Type:            STT_OBJECT
    Section:         .note.ABI-tag
    Value:           0x40037C
    Size:            0x20
  - Name:            crtstuff.c
    Type:            STT_FILE
    Index:           SHN_ABS
  - Name:            deregister_tm_clones
    Type:            STT_FUNC
    Section:         .text
    Value:           0x401060
  - Name:            register_tm_clones
    Type:            STT_FUNC
    Section:         .text
    Value:           0x401090
  - Name:            __do_global_dtors_aux
    Type:            STT_FUNC
    Section:         .text
    Value:           0x4010D0
  - Name:            completed.0
    Type:            STT_OBJECT
    Section:         .bss
    Value:           0x404004
    Size:            0x1
  - Name:            __do_global_dtors_aux_fini_array_entry
    Type:            STT_OBJECT
    Section:         .fini_array
    Value:           0x403E00
  - Name:            frame_dummy
    Type:            STT_FUNC
    Section:         .text
    Value:           0x401100
  - Name:            __frame_dummy_init_array_entry
    Type:            STT_OBJECT
    Section:         .init_array
    Value:           0x403DF8
  - Name:            main.cpp
    Type:            STT_FILE
    Index:           SHN_ABS
  - Name:            'crtstuff.c (1)'
    Type:            STT_FILE
    Index:           SHN_ABS
  - Name:            __FRAME_END__
    Type:            STT_OBJECT
    Section:         .eh_frame
    Value:           0x4020C0
  - Type:            STT_FILE
    Index:           SHN_ABS
  - Name:            __GNU_EH_FRAME_HDR
    Section:         .eh_frame_hdr
    Value:           0x402010
  - Name:            _DYNAMIC
    Type:            STT_OBJECT
    Section:         .dynamic
    Value:           0x403E08
  - Name:            _GLOBAL_OFFSET_TABLE_
    Type:            STT_OBJECT
    Section:         .got.plt
    Value:           0x403FE8
  - Name:            _edata
    Section:         .data
    Binding:         STB_GLOBAL
    Value:           0x404004
  - Name:            data_start
    Section:         .data
    Binding:         STB_WEAK
    Value:           0x404000
  - Name:            _IO_stdin_used
    Type:            STT_OBJECT
    Section:         .rodata
    Binding:         STB_GLOBAL
    Value:           0x402000
    Size:            0x4
  - Name:            main
    Type:            STT_FUNC
    Section:         .text
    Binding:         STB_GLOBAL
    Value:           0x401120
    Size:            0x1C
  - Name:            __dso_handle
    Type:            STT_OBJECT
    Section:         .rodata
    Binding:         STB_GLOBAL
    Value:           0x402008
    Other:           [ STV_HIDDEN ]
  - Name:            _fini
    Type:            STT_FUNC
    Section:         .fini
    Binding:         STB_GLOBAL
    Value:           0x40113C
    Other:           [ STV_HIDDEN ]
  - Name:            '__libc_start_main@GLIBC_2.34'
    Type:            STT_FUNC
    Binding:         STB_GLOBAL
  - Name:            _dl_relocate_static_pie
    Type:            STT_FUNC
    Section:         .text
    Binding:         STB_GLOBAL
    Value:           0x401050
    Size:            0x5
    Other:           [ STV_HIDDEN ]
  - Name:            _start
    Type:            STT_FUNC
    Section:         .text
    Binding:         STB_GLOBAL
    Value:           0x401020
    Size:            0x26
  - Name:            _init
    Type:            STT_FUNC
    Section:         .init
    Binding:         STB_GLOBAL
    Value:           0x401000
    Other:           [ STV_HIDDEN ]
  - Name:            __TMC_END__
    Type:            STT_OBJECT
    Section:         .data
    Binding:         STB_GLOBAL
    Value:           0x404008
    Other:           [ STV_HIDDEN ]
  - Name:            __data_start
    Section:         .data
    Binding:         STB_GLOBAL
    Value:           0x404000
  - Name:            _end
    Section:         .bss
    Binding:         STB_GLOBAL
    Value:           0x404008
  - Name:            __bss_start
    Section:         .bss
    Binding:         STB_GLOBAL
    Value:           0x404004
  - Name:            _Z3foov
    Type:            STT_FUNC
    Section:         .text
    Binding:         STB_GLOBAL
    Value:           0x401110
    Size:            0x6
  - Name:            _ITM_deregisterTMCloneTable
    Binding:         STB_WEAK
  - Name:            __gmon_start__
    Binding:         STB_WEAK
  - Name:            _ITM_registerTMCloneTable
    Binding:         STB_WEAK
DynamicSymbols:
  - Name:            __libc_start_main
    Type:            STT_FUNC
    Binding:         STB_GLOBAL
  - Name:            _ITM_deregisterTMCloneTable
    Binding:         STB_WEAK
  - Name:            __gmon_start__
    Binding:         STB_WEAK
  - Name:            _ITM_registerTMCloneTable
    Binding:         STB_WEAK
DWARF:
  debug_str:
    - '/tmp/test_dwo'
    - main_split-main.dwo
...
