1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
| # RUN: yaml2obj %s > %t
# RUN: cp %t %t1
# RUN: llvm-objcopy -R .test2 %t %t2
# RUN: llvm-readobj --file-headers --sections %t2 | FileCheck %s
# Verify that the first run of llvm-objcopy
# has not modified the input binary.
# RUN: cmp %t %t1
# RUN: llvm-objcopy --remove-section=.test2 %t1 %t3
# RUN: cmp %t2 %t3
# RUN: llvm-objcopy --regex --remove-section='.test[0-9]+' %t %t4
# RUN: llvm-readobj --file-headers --sections %t4 | FileCheck %s --check-prefix=REGEX
!ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
Sections:
- Name: .test1
Type: SHT_PROGBITS
Flags: [ ]
- Name: .test2
Type: SHT_PROGBITS
Flags: [ ]
- Name: .test3
Type: SHT_PROGBITS
Flags: [ ]
Symbols: []
# CHECK: SectionHeaderCount: 6
# CHECK: Sections [
# CHECK: Section {
# CHECK: Index: 0
# CHECK: Name: (0)
# CHECK: Type: SHT_NULL (0x0)
# CHECK: Flags [ (0x0)
# CHECK: ]
# CHECK: Address: 0x0
# CHECK: Offset:
# CHECK: Size:
# CHECK: Link: 0
# CHECK: Info: 0
# CHECK: AddressAlignment: 0
# CHECK: EntrySize: 0
# CHECK: }
# CHECK: Section {
# CHECK: Index: 1
# CHECK: Name: .test1
# CHECK: Type: SHT_PROGBITS (0x1)
# CHECK: Flags [ (0x0)
# CHECK: ]
# CHECK: Address: 0x0
# CHECK: Offset:
# CHECK: Size:
# CHECK: Link: 0
# CHECK: Info: 0
# CHECK: AddressAlignment: 0
# CHECK: EntrySize: 0
# CHECK: }
# CHECK: Section {
# CHECK: Index: 2
# CHECK: Name: .test3
# CHECK: Type: SHT_PROGBITS (0x1)
# CHECK: Flags [ (0x0)
# CHECK: ]
# CHECK: Address: 0x0
# CHECK: Offset:
# CHECK: Size:
# CHECK: Link: 0
# CHECK: Info: 0
# CHECK: AddressAlignment: 0
# CHECK: EntrySize: 0
# CHECK: }
# CHECK: Section {
# CHECK: Index: 3
# CHECK: Name: .symtab
# CHECK: Type: SHT_SYMTAB (0x2)
# CHECK: Flags [ (0x0)
# CHECK: ]
# CHECK: Address: 0x0
# CHECK: Offset:
# CHECK: Size:
# CHECK: Link: 4
# CHECK: Info: 1
# CHECK: AddressAlignment: 8
# CHECK: EntrySize: 24
# CHECK: }
# CHECK: Section {
# CHECK: Index: 4
# CHECK: Name: .strtab
# CHECK: Type: SHT_STRTAB (0x3)
# CHECK: Flags [ (0x0)
# CHECK: ]
# CHECK: Address: 0x0
# CHECK: Offset:
# CHECK: Size:
# CHECK: Link: 0
# CHECK: Info: 0
# CHECK: AddressAlignment: 1
# CHECK: EntrySize: 0
# CHECK: }
# CHECK: Section {
# CHECK: Index: 5
# CHECK: Name: .shstrtab
# CHECK: Type: SHT_STRTAB (0x3)
# CHECK: Flags [ (0x0)
# CHECK: ]
# CHECK: Address: 0x0
# CHECK: Offset:
# CHECK: Size:
# CHECK: Link: 0
# CHECK: Info: 0
# CHECK: AddressAlignment: 1
# CHECK: EntrySize: 0
# CHECK: }
# CHECK: ]
# REGEX: SectionHeaderCount: 4
# REGEX: Sections [
# REGEX-NOT: test
|