[PATCH] D29482: Object: Handle files without a dynamic symbol table.
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 2 18:21:54 PST 2017
pcc created this revision.
https://reviews.llvm.org/D29482
Files:
llvm/include/llvm/Object/ELFObjectFile.h
llvm/test/Object/nm-shared-object.test
Index: llvm/test/Object/nm-shared-object.test
===================================================================
--- llvm/test/Object/nm-shared-object.test
+++ llvm/test/Object/nm-shared-object.test
@@ -29,3 +29,5 @@
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
Index: llvm/include/llvm/Object/ELFObjectFile.h
===================================================================
--- llvm/include/llvm/Object/ELFObjectFile.h
+++ llvm/include/llvm/Object/ELFObjectFile.h
@@ -895,6 +895,8 @@
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));
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29482.86930.patch
Type: text/x-patch
Size: 929 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170203/10d87950/attachment.bin>
More information about the llvm-commits
mailing list