Debian Codegraph @

llvm/test/tools/llvm-objcopy/ELF/strip-multiple-files.test

raw
1 # RUN: yaml2obj %s -o %t.o
2
3 # Run llvm-strip normally. This will create a stripped object file for later
4 # tests so we only have to run FileCheck on it once.
5 # RUN: cp %t.o %t.1.o
6 # RUN: llvm-strip --keep-symbol=foo %t.1.o -o %t.stripped.o
7 # RUN: llvm-readobj --symbols %t.stripped.o | FileCheck %s
8
9 # llvm-strip on two files:
10 # RUN: cp %t.o %t.1.o
11 # RUN: cp %t.o %t.2.o
12 # RUN: llvm-strip --keep-symbol=foo %t.1.o %t.2.o
13 # RUN: cmp %t.1.o %t.stripped.o
14 # RUN: cmp %t.2.o %t.stripped.o
15
16 # llvm-strip on three files:
17 # RUN: cp %t.o %t.1.o
18 # RUN: cp %t.o %t.2.o
19 # RUN: cp %t.o %t.3.o
20 # RUN: llvm-strip --keep-symbol=foo %t.1.o %t.2.o %t.3.o
21 # RUN: cmp %t.1.o %t.stripped.o
22 # RUN: cmp %t.2.o %t.stripped.o
23 # RUN: cmp %t.3.o %t.stripped.o
24
25 # -o cannot be used with multiple input files
26 # RUN: cp %t.o %t.1.o
27 # RUN: cp %t.o %t.2.o
28 # RUN: not llvm-strip --keep-symbol=foo -o %t.stripped.o %t.1.o %t.2.o 2>&1 \
29 # RUN: | FileCheck %s --check-prefix=BAD-O-FLAG
30
31 !ELF
32 FileHeader:
33 Class: ELFCLASS64
34 Data: ELFDATA2LSB
35 Type: ET_REL
36 Machine: EM_X86_64
37 Sections:
38 - Name: .text
39 Type: SHT_PROGBITS
40 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
41 Symbols:
42 - Name: foo
43 Type: STT_FUNC
44 Section: .text
45 Value: 0x1234
46 Size: 8
47 - Name: bar
48 Type: STT_FUNC
49 Section: .text
50 Value: 0x5678
51 Size: 8
52
53 # CHECK: Symbols [
54 # CHECK-NEXT: Symbol {
55 # CHECK-NEXT: Name:
56 # CHECK-NEXT: Value: 0x0
57 # CHECK-NEXT: Size: 0
58 # CHECK-NEXT: Binding: Local
59 # CHECK-NEXT: Type: None
60 # CHECK-NEXT: Other: 0
61 # CHECK-NEXT: Section: Undefined
62 # CHECK-NEXT: }
63 # CHECK-NEXT: Symbol {
64 # CHECK-NEXT: Name: foo
65 # CHECK-NEXT: Value: 0x1234
66 # CHECK-NEXT: Size: 8
67 # CHECK-NEXT: Binding: Local
68 # CHECK-NEXT: Type: Function
69 # CHECK-NEXT: Other: 0
70 # CHECK-NEXT: Section: .text
71 # CHECK-NEXT: }
72 # CHECK-NEXT: ]
73
74 # BAD-O-FLAG: multiple input files cannot be used in combination with -o