1# RUN: yaml2obj %s -o %t
2# RUN: cp %t %t1
3
4# RUN: llvm-strip --strip-debug --remove-section=.text.bar %t
5# RUN: llvm-readobj --file-headers --sections --symbols %t | FileCheck %s
6
7# RUN: llvm-objcopy --strip-debug --remove-section=.text.bar %t1 %t1
8# RUN: cmp %t %t1
9
10!ELF
11FileHeader:
12  Class:           ELFCLASS64
13  Data:            ELFDATA2LSB
14  Type:            ET_REL
15  Machine:         EM_X86_64
16Sections:
17  - Name:            .debug_foo
18    Type:            SHT_PROGBITS
19    Content:         "00000000"
20  - Name:            .text
21    Type:            SHT_PROGBITS
22    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
23    AddressAlign:    0x0000000000000010
24    Content:         "00000000"
25  - Name:            .text.bar
26    Type:            SHT_PROGBITS
27    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
28    AddressAlign:    0x0000000000000010
29    Content:         "00000000"
30Symbols:
31  - Name:    debugfoo
32    Section: .debug_foo
33    Binding:  STB_GLOBAL
34  - Name:    foo
35    Section: .text
36    Binding:  STB_GLOBAL
37  - Name:    bar
38    Section: .text.bar
39    Binding:  STB_GLOBAL
40
41# CHECK: SectionHeaderCount: 5
42
43# CHECK:     Name: .text
44# CHECK:     Name: .symtab
45# CHECK:     Name: .strtab
46# CHECK:     Name: .shstrtab
47# CHECK-NOT: Name: .text.bar
48# CHECK-NOT: Name: .debug_foo
49
50# Check that *only* foo is copied and no debugfoo or textbar
51# CHECK:      Symbols [
52# CHECK-NEXT:   Symbol {
53# CHECK-NEXT:     Name:
54# CHECK-NEXT:     Value:
55# CHECK-NEXT:     Size:
56# CHECK-NEXT:     Binding:
57# CHECK-NEXT:     Type:
58# CHECK-NEXT:     Other:
59# CHECK-NEXT:     Section: Undefined
60# CHECK-NEXT:   }
61# CHECK-NEXT:   Symbol {
62# CHECK-NEXT:     Name: foo
63# CHECK-NEXT:     Value:
64# CHECK-NEXT:     Size:
65# CHECK-NEXT:     Binding: Global
66# CHECK-NEXT:     Type:
67# CHECK-NEXT:     Other:
68# CHECK-NEXT:     Section: .text
69# CHECK-NEXT:   }
70# CHECK-NEXT: ]
71