mirror of
https://github.com/intel/llvm.git
synced 2026-01-16 21:55:39 +08:00
Don't crash on files with no symbol table.
Thanks to Roman Divacky for the test. llvm-svn: 249066
This commit is contained in:
@@ -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;
|
||||
|
||||
BIN
lld/test/elf2/Inputs/no-symtab.o
Normal file
BIN
lld/test/elf2/Inputs/no-symtab.o
Normal file
Binary file not shown.
4
lld/test/elf2/no-symtab.s
Normal file
4
lld/test/elf2/no-symtab.s
Normal 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:
|
||||
Reference in New Issue
Block a user