# RUN: cmp %t %t1
# RUN: llvm-readobj --symbols %t2 | FileCheck %s
+# Verify that --keep-file-symbols works together with --strip-unneeded
+# RUN: llvm-objcopy --keep-file-symbols --strip-unneeded %t %t2b
+# RUN: llvm-readobj --symbols %t2b | FileCheck %s --check-prefix=FILESYM
+
# RUN: llvm-objcopy --strip-unneeded-symbol=bar \
# RUN: %t %t3
# RUN: llvm-readobj --symbols %t3 | FileCheck %s --check-prefixes=STRIP-BAR,REMAIN
# RUN: echo "foobaz" >> %t.list.txt
# RUN: echo " # comment " >> %t.list.txt
# RUN: llvm-objcopy --strip-unneeded-symbols %t.list.txt %t %t5
-# RUN: cmp %t2 %t5
+# RUN: cmp %t2b %t5
# RUN: echo " .* # * - remove all " > %t.list2.txt
# RUN: llvm-objcopy --regex --strip-unneeded-symbols %t.list2.txt %t %t6
#CHECK-NEXT: Section: .text
#CHECK-NEXT: }
#CHECK-NEXT: Symbol {
-#CHECK-NEXT: Name: fileSymbol
-#CHECK-NEXT: Value: 0x0
-#CHECK-NEXT: Size: 0
-#CHECK-NEXT: Binding: Local
-#CHECK-NEXT: Type: File
-#CHECK-NEXT: Other: 0
-#CHECK-NEXT: Section: Undefined
-#CHECK-NEXT: }
-#CHECK-NEXT: Symbol {
#CHECK-NEXT: Name: sectionSymbol
#CHECK-NEXT: Value: 0x0
#CHECK-NEXT: Size: 0
#CHECK-NEXT: }
#CHECK-NEXT:]
+#FILESYM: Name: fileSymbol
+#FILESYM-NEXT: Value: 0x0
+
#STRIP-BAR-NOT: Name: bar ({{.*}})
#REMAIN: Name: foobar
#REMAIN: Name: foobaz
static bool isUnneededSymbol(const Symbol &Sym) {
return !Sym.Referenced &&
(Sym.Binding == STB_LOCAL || Sym.getShndx() == SHN_UNDEF) &&
- Sym.Type != STT_FILE && Sym.Type != STT_SECTION;
+ Sym.Type != STT_SECTION;
}
static Error updateAndRemoveSymbols(const CopyConfig &Config, Object &Obj) {