1# RUN: yaml2obj %s -o %t
2# RUN: cp %t %t1
3# RUN: llvm-objcopy --strip-all --keep-symbol foo %t %t2
4# RUN: llvm-readobj --sections --symbols %t2 | FileCheck %s
5
6# Verify that the first run of llvm-objcopy
7# has not modified the input binary.
8# RUN: cmp %t %t1
9
10# RUN: llvm-strip --keep-symbol=foo %t1
11# RUN: cmp %t1 %t2
12
13# RUN: cp %t %t3
14# RUN: llvm-strip --keep-symbol foo %t3
15# RUN: cmp %t1 %t3
16
17!ELF
18FileHeader:
19  Class:           ELFCLASS64
20  Data:            ELFDATA2LSB
21  Type:            ET_REL
22  Machine:         EM_X86_64
23Sections:
24  - Name:            .text
25    Type:            SHT_PROGBITS
26    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
27    Address:         0x1000
28    AddressAlign:    0x0000000000000010
29    Size:            64
30  - Name:            .gnu.warning.foo
31    Type:            SHT_PROGBITS
32  - Name:            .debug_bar
33    Type:            SHT_PROGBITS
34Symbols:
35  - Name:     foo
36    Type:     STT_FUNC
37    Section:  .text
38    Value:    0x1000
39    Size:     8
40  - Name:     bar
41    Type:     STT_FUNC
42    Section:  .text
43    Value:    0x1008
44    Size:     8
45  - Name:     baz
46    Type:     STT_FUNC
47    Section:  .text
48    Value:    0x1010
49    Size:     8
50
51# CHECK:     Name: .text
52# CHECK:     Name: .gnu.warning.foo
53# CHECK:     Name: .symtab
54# CHECK:     Name: .strtab
55# CHECK:     Name: .shstrtab
56# CHECK-NOT: Name: .debug_bar
57
58#CHECK: Symbols [
59#CHECK-NEXT:  Symbol {
60#CHECK-NEXT:    Name:
61#CHECK-NEXT:    Value: 0x0
62#CHECK-NEXT:    Size: 0
63#CHECK-NEXT:    Binding: Local
64#CHECK-NEXT:    Type: None
65#CHECK-NEXT:    Other: 0
66#CHECK-NEXT:    Section: Undefined
67#CHECK-NEXT:  }
68#CHECK-NEXT:  Symbol {
69#CHECK-NEXT:    Name: foo
70#CHECK-NEXT:    Value: 0x1000
71#CHECK-NEXT:    Size: 8
72#CHECK-NEXT:    Binding: Local
73#CHECK-NEXT:    Type: Function
74#CHECK-NEXT:    Other: 0
75#CHECK-NEXT:    Section: .text
76#CHECK-NEXT:  }
77#CHECK-NEXT:]
78