[llvm] r294013 - Object: Handle files without a dynamic symbol table.
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 3 08:53:55 PST 2017
Author: pcc
Date: Fri Feb 3 10:53:55 2017
New Revision: 294013
URL: http://llvm.org/viewvc/llvm-project?rev=294013&view=rev
Log:
Object: Handle files without a dynamic symbol table.
Differential Revision: https://reviews.llvm.org/D29482
Modified:
llvm/trunk/include/llvm/Object/ELFObjectFile.h
llvm/trunk/test/Object/nm-shared-object.test
Modified: llvm/trunk/include/llvm/Object/ELFObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ELFObjectFile.h?rev=294013&r1=294012&r2=294013&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/ELFObjectFile.h (original)
+++ llvm/trunk/include/llvm/Object/ELFObjectFile.h Fri Feb 3 10:53:55 2017
@@ -895,6 +895,8 @@ elf_symbol_iterator ELFObjectFile<ELFT>:
template <class ELFT>
elf_symbol_iterator ELFObjectFile<ELFT>::dynamic_symbol_end() const {
const Elf_Shdr *SymTab = DotDynSymSec;
+ if (!SymTab)
+ return dynamic_symbol_begin();
DataRefImpl Sym = toDRI(SymTab, SymTab->sh_size / sizeof(Elf_Sym));
return basic_symbol_iterator(SymbolRef(Sym, this));
}
Modified: llvm/trunk/test/Object/nm-shared-object.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/nm-shared-object.test?rev=294013&r1=294012&r2=294013&view=diff
==============================================================================
--- llvm/trunk/test/Object/nm-shared-object.test (original)
+++ llvm/trunk/test/Object/nm-shared-object.test Fri Feb 3 10:53:55 2017
@@ -29,3 +29,5 @@ RUN: not llvm-nm -D %p/Inputs/trivial-ob
RUN: | FileCheck %s -check-prefix ERROR
ERROR: File format has no dynamic symbol table.
+
+RUN: llvm-nm -D %p/Inputs/trivial-object-test.elf-i386 | count 0
More information about the llvm-commits
mailing list