# REQUIRES: asserts
# RUN: yaml2obj -o %t.o %s
# RUN: llvm-jitlink -debug-only=jitlink -noexec %t.o 2>&1 | FileCheck %s
#
# Check that debug sections get NoAlloc lifetimes.
#
# CHECK: ".debug_str" is not a SHF_ALLOC section. Using NoAlloc lifetime.
# CHECK: ".debug_abbrev" is not a SHF_ALLOC section. Using NoAlloc lifetime.
# CHECK: ".debug_info" is not a SHF_ALLOC section. Using NoAlloc lifetime.
# CHECK: ".debug_line" is not a SHF_ALLOC section. Using NoAlloc lifetime.


--- !ELF
FileHeader:
  Class:           ELFCLASS64
  Data:            ELFDATA2LSB
  Type:            ET_REL
  Machine:         EM_X86_64
  SectionHeaderStringTable: .strtab
Sections:
  - Name:            .text
    Type:            SHT_PROGBITS
    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
    AddressAlign:    0x10
    Content:         B82A000000C3662E0F1F840000000000B82A000000C3
  - Name:            .debug_abbrev
    Type:            SHT_PROGBITS
    AddressAlign:    0x1
    Content:         011101250E1305030E10171B0E110112060000022E00110112064018974219030E3A0B3B0B271949133F190000032E01110112064018974219030E3A0B3B0B271949133F1900000405000218030E3A0B3B0B49130000052400030E3E0B0B0B0000060F004913000000
  - Name:            .debug_info
    Type:            SHT_PROGBITS
    AddressAlign:    0x1
    Content:         8C0000000400000000000801000000000C000000000000000000000000000000000000000000160000000200000000000000000600000001570000000001017700000003000000000000000006000000015700000000010577000000040155000000000105770000000401540000000001057E0000000005000000000504068300000006880000000500000000060100
  - Name:            .comment
    Type:            SHT_PROGBITS
    Flags:           [ SHF_MERGE, SHF_STRINGS ]
    AddressAlign:    0x1
    EntSize:         0x1
    Content:         00636C616E672076657273696F6E2031302E302E302D347562756E7475312000
  - Name:            .note.GNU-stack
    Type:            SHT_PROGBITS
    AddressAlign:    0x1
  - Name:            .debug_line
    Type:            SHT_PROGBITS
    AddressAlign:    0x1
    Content:         58000000040036000000010101FB0E0D0001010101000000010000012F746D700000454C465F736B69705F64656275675F73656374696F6E732E63000100000000090200000000000000000105030A130500F505030A130206000101
  - Name:            .eh_frame
    Type:            SHT_X86_64_UNWIND
    Flags:           [ SHF_ALLOC ]
    AddressAlign:    0x8
    Content:         1400000000000000017A5200017810011B0C070890010000100000001C0000000000000006000000000000001000000030000000000000000600000000000000
  - Name:            .rela.debug_info
    Type:            SHT_RELA
    Flags:           [ SHF_INFO_LINK ]
    Link:            .symtab
    AddressAlign:    0x8
    Info:            .debug_info
    Relocations:
      - Offset:          0x6
        Symbol:          .debug_abbrev
        Type:            R_X86_64_32
      - Offset:          0xC
        Symbol:          .debug_str
        Type:            R_X86_64_32
      - Offset:          0x12
        Symbol:          .debug_str
        Type:            R_X86_64_32
        Addend:          31
      - Offset:          0x16
        Symbol:          .debug_line
        Type:            R_X86_64_32
      - Offset:          0x1A
        Symbol:          .debug_str
        Type:            R_X86_64_32
        Addend:          57
      - Offset:          0x1E
        Symbol:          .text
        Type:            R_X86_64_64
      - Offset:          0x2B
        Symbol:          .text
        Type:            R_X86_64_64
      - Offset:          0x39
        Symbol:          .debug_str
        Type:            R_X86_64_32
        Addend:          62
      - Offset:          0x44
        Symbol:          .text
        Type:            R_X86_64_64
        Addend:          16
      - Offset:          0x52
        Symbol:          .debug_str
        Type:            R_X86_64_32
        Addend:          70
      - Offset:          0x5F
        Symbol:          .debug_str
        Type:            R_X86_64_32
        Addend:          75
      - Offset:          0x6C
        Symbol:          .debug_str
        Type:            R_X86_64_32
        Addend:          80
      - Offset:          0x78
        Symbol:          .debug_str
        Type:            R_X86_64_32
        Addend:          66
      - Offset:          0x89
        Symbol:          .debug_str
        Type:            R_X86_64_32
        Addend:          85
  - Name:            .rela.debug_line
    Type:            SHT_RELA
    Flags:           [ SHF_INFO_LINK ]
    Link:            .symtab
    AddressAlign:    0x8
    Info:            .debug_line
    Relocations:
      - Offset:          0x43
        Symbol:          .text
        Type:            R_X86_64_64
  - Name:            .rela.eh_frame
    Type:            SHT_RELA
    Flags:           [ SHF_INFO_LINK ]
    Link:            .symtab
    AddressAlign:    0x8
    Info:            .eh_frame
    Relocations:
      - Offset:          0x20
        Symbol:          .text
        Type:            R_X86_64_PC32
      - Offset:          0x34
        Symbol:          .text
        Type:            R_X86_64_PC32
        Addend:          16
  - Name:            .llvm_addrsig
    Type:            SHT_LLVM_ADDRSIG
    Flags:           [ SHF_EXCLUDE ]
    Link:            .symtab
    AddressAlign:    0x1
    Offset:          0x4C0
    Symbols:         [  ]
  - Type:            SectionHeaderTable
    Sections:
      - Name:            .strtab
      - Name:            .text
      - Name:            .debug_str
      - Name:            .debug_abbrev
      - Name:            .debug_info
      - Name:            .rela.debug_info
      - Name:            .comment
      - Name:            .note.GNU-stack
      - Name:            .debug_line
      - Name:            .rela.debug_line
      - Name:            .eh_frame
      - Name:            .rela.eh_frame
      - Name:            .llvm_addrsig
      - Name:            .symtab
Symbols:
  - Name:            ELF_skip_debug_sections.c
    Type:            STT_FILE
    Index:           SHN_ABS
  - Name:            .text
    Type:            STT_SECTION
    Section:         .text
  - Name:            .debug_str
    Type:            STT_SECTION
    Section:         .debug_str
  - Name:            .debug_abbrev
    Type:            STT_SECTION
    Section:         .debug_abbrev
  - Name:            .debug_line
    Type:            STT_SECTION
    Section:         .debug_line
  - Name:            foo
    Type:            STT_FUNC
    Section:         .text
    Binding:         STB_GLOBAL
    Size:            0x6
  - Name:            main
    Type:            STT_FUNC
    Section:         .text
    Binding:         STB_GLOBAL
    Value:           0x10
    Size:            0x6
DWARF:
  debug_str:
    - 'clang version 10.0.0-4ubuntu1 '
    - ELF_skip_debug_sections.c
    - '/tmp'
    - foo
    - int
    - main
    - argc
    - argv
    - char
...
