1## Verifies that running with --strip-unneeded removes debugging sections but
2## retains the .gnu_debuglink section.
3
4# RUN: yaml2obj %s -o %t.o
5# RUN: touch %t.debug
6# RUN: llvm-objcopy --add-gnu-debuglink=%t.debug %t.o %t.2.o
7# RUN: llvm-strip --strip-unneeded %t.2.o -o %t.3.o
8# RUN: llvm-readelf --sections %t.3.o | FileCheck %s
9
10!ELF
11FileHeader:
12  Class:           ELFCLASS64
13  Data:            ELFDATA2LSB
14  Type:            ET_REL
15  Machine:         EM_X86_64
16Sections:
17  - Name:            .text
18    Type:            SHT_PROGBITS
19    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
20  - Name:            .debugfoo
21    Type:            SHT_PROGBITS
22
23# CHECK: There are 5 section headers
24
25# CHECK:        [ 0]
26# CHECK-NEXT:   [ 1] .text
27# CHECK-NEXT:   [ 2] .strtab
28# CHECK-NEXT:   [ 3] .shstrtab
29# CHECK-NEXT:   [ 4] .gnu_debuglink
30