forked from OSchip/llvm-project
Object: Handle files without a dynamic symbol table.
Differential Revision: https://reviews.llvm.org/D29482 llvm-svn: 294013
This commit is contained in:
parent
68e9d94055
commit
cce2d8028f
|
@ -895,6 +895,8 @@ elf_symbol_iterator ELFObjectFile<ELFT>::dynamic_symbol_begin() const {
|
||||||
template <class ELFT>
|
template <class ELFT>
|
||||||
elf_symbol_iterator ELFObjectFile<ELFT>::dynamic_symbol_end() const {
|
elf_symbol_iterator ELFObjectFile<ELFT>::dynamic_symbol_end() const {
|
||||||
const Elf_Shdr *SymTab = DotDynSymSec;
|
const Elf_Shdr *SymTab = DotDynSymSec;
|
||||||
|
if (!SymTab)
|
||||||
|
return dynamic_symbol_begin();
|
||||||
DataRefImpl Sym = toDRI(SymTab, SymTab->sh_size / sizeof(Elf_Sym));
|
DataRefImpl Sym = toDRI(SymTab, SymTab->sh_size / sizeof(Elf_Sym));
|
||||||
return basic_symbol_iterator(SymbolRef(Sym, this));
|
return basic_symbol_iterator(SymbolRef(Sym, this));
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,3 +29,5 @@ RUN: not llvm-nm -D %p/Inputs/trivial-object-test.coff-i386 2>&1 \
|
||||||
RUN: | FileCheck %s -check-prefix ERROR
|
RUN: | FileCheck %s -check-prefix ERROR
|
||||||
|
|
||||||
ERROR: File format has no dynamic symbol table.
|
ERROR: File format has no dynamic symbol table.
|
||||||
|
|
||||||
|
RUN: llvm-nm -D %p/Inputs/trivial-object-test.elf-i386 | count 0
|
||||||
|
|
Loading…
Reference in New Issue