Don't crash on files with no symbol table.

Thanks to Roman Divacky for the test.

llvm-svn: 249066
This commit is contained in:
Rafael Espindola 2015-10-01 20:26:37 +00:00
parent a602a153de
commit 3e60379fd9
3 changed files with 6 additions and 0 deletions

View File

@ -78,6 +78,8 @@ ELFData<ELFT>::getSymbolsHelper(bool Local) {
}
template <class ELFT> void ELFData<ELFT>::initStringTable() {
if (!Symtab)
return;
ErrorOr<StringRef> StringTableOrErr = ELFObj.getStringTableForSymtab(*Symtab);
error(StringTableOrErr.getError());
StringTable = *StringTableOrErr;

Binary file not shown.

View File

@ -0,0 +1,4 @@
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
// RUN: lld -flavor gnu2 %t.o %p/Inputs/no-symtab.o -o %t
.global _start
_start: