1 # RUN: yaml2obj %s -o %t
3 # RUN: llvm-objcopy --strip-unneeded %t %t2
4 ## Verify that llvm-objcopy has not modified the input.
6 # RUN: llvm-readobj --symbols %t2 | FileCheck %s
8 ## Verify that --keep-file-symbols works together with --strip-unneeded
9 # RUN: llvm-objcopy --keep-file-symbols --strip-unneeded %t %t2b
10 # RUN: llvm-readobj --symbols %t2b | FileCheck %s --check-prefixes=CHECK,FILESYM
12 # RUN: llvm-objcopy --strip-unneeded-symbol=bar \
14 # RUN: llvm-readobj --symbols %t3 | FileCheck %s --check-prefixes=STRIP-BAR,REMAIN
16 # RUN: llvm-objcopy --regex --strip-unneeded-symbol='.*' %t %t4
19 ## Verify that --strip-unneeded-symbols removes all unneeded symbols listed in
20 ## the file, but not those that aren't.
21 ## In this case, fileSymbol isn't mentioned (so isn't removed), barbaz is
22 ## mentioned, but isn't removed (because it is needed) and bar, foobar and
23 ## foobaz are mentioned and removed.
24 # RUN: echo " bar # bar " > %t.list.txt
25 # RUN: echo "foobar" >> %t.list.txt
26 # RUN: echo "foobaz" >> %t.list.txt
27 # RUN: echo " # comment " >> %t.list.txt
28 # RUN: echo "barbaz" >> %t.list.txt
29 # RUN: llvm-objcopy --strip-unneeded-symbols %t.list.txt %t %t5
32 # RUN: echo " .* # * - remove all " > %t.list2.txt
33 # RUN: llvm-objcopy --regex --strip-unneeded-symbols %t.list2.txt %t %t6
36 ## Verify that llvm-strip modifies the symbol table the same way.
37 # RUN: llvm-strip --strip-unneeded %t
49 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
51 AddressAlign: 0x0000000000000010
56 AddressAlign: 0x0000000000000004
59 - SectionOrType: GRP_COMDAT
60 - SectionOrType: .text
110 #CHECK-NEXT: Symbol {
112 #CHECK-NEXT: Value: 0x0
114 #CHECK-NEXT: Binding: Local
115 #CHECK-NEXT: Type: None
116 #CHECK-NEXT: Other: 0
117 #CHECK-NEXT: Section: Undefined
119 #CHECK-NEXT: Symbol {
120 #CHECK-NEXT: Name: foo
121 #CHECK-NEXT: Value: 0x1000
123 #CHECK-NEXT: Binding: Local
124 #CHECK-NEXT: Type: Function
125 #CHECK-NEXT: Other: 0
126 #CHECK-NEXT: Section: .text
128 #CHECK-NEXT: Symbol {
129 #CHECK-NEXT: Name: barfoo
130 #CHECK-NEXT: Value: 0x1010
132 #CHECK-NEXT: Binding: Local
133 #CHECK-NEXT: Type: Function
134 #CHECK-NEXT: Other: 0
135 #CHECK-NEXT: Section: .text
137 #FILESYM-NEXT:Symbol {
138 #FILESYM-NEXT: Name: fileSymbol
139 #FILESYM-NEXT: Value: 0x0
140 #FILESYM-NEXT: Size: 0
141 #FILESYM-NEXT: Binding: Local
142 #FILESYM-NEXT: Type: File
143 #FILESYM-NEXT: Other: 0
144 #FILESYM-NEXT: Section: Absolute
146 #CHECK-NEXT: Symbol {
147 #CHECK-NEXT: Name: sectionSymbol
148 #CHECK-NEXT: Value: 0x0
150 #CHECK-NEXT: Binding: Local
151 #CHECK-NEXT: Type: Section
152 #CHECK-NEXT: Other: 0
153 #CHECK-NEXT: Section: Undefined
155 #CHECK-NEXT: Symbol {
156 #CHECK-NEXT: Name: barbaz
157 #CHECK-NEXT: Value: 0x1020
159 #CHECK-NEXT: Binding: Global
160 #CHECK-NEXT: Type: Function
161 #CHECK-NEXT: Other: 0
162 #CHECK-NEXT: Section: .text
164 #CHECK-NEXT: Symbol {
165 #CHECK-NEXT: Name: baz
166 #CHECK-NEXT: Value: 0x1018
168 #CHECK-NEXT: Binding: Weak
169 #CHECK-NEXT: Type: Function
170 #CHECK-NEXT: Other: 0
171 #CHECK-NEXT: Section: .text
176 #STRIP-BAR-NOT: Name: bar ({{.*}})
177 #REMAIN: Name: foobar
178 #REMAIN: Name: foobaz