# RUN: llvm-strip --strip-all %t8
# RUN: cmp %t2 %t8
+# Verify that a non-existent symbol table (after first call to llvm-strip)
+# can be handled correctly.
+# RUN: cp %t %t9
+# RUN: llvm-strip --strip-all -keep=unavailable_symbol %t9
+# RUN: llvm-strip --strip-all -keep=unavailable_symbol %t9
+# RUN: cmp %t2 %t9
+
!ELF
FileHeader:
Class: ELFCLASS64
// Keep special sections.
if (Obj.SectionNames == &Sec)
return false;
- if (Obj.SymbolTable == &Sec || Obj.SymbolTable->getStrTab() == &Sec)
+ if (Obj.SymbolTable == &Sec ||
+ (Obj.SymbolTable && Obj.SymbolTable->getStrTab() == &Sec))
return false;
// Remove everything else.
// (equivalently, the updated symbol table is not empty)
// the symbol table and the string table should not be removed.
if ((!Config.SymbolsToKeep.empty() || Config.KeepFileSymbols) &&
- !Obj.SymbolTable->empty()) {
+ Obj.SymbolTable && !Obj.SymbolTable->empty()) {
RemovePred = [&Obj, RemovePred](const SectionBase &Sec) {
if (&Sec == Obj.SymbolTable || &Sec == Obj.SymbolTable->getStrTab())
return false;