From 483ad20009f058d5c57641899e4fc850635973b7 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 8 Oct 2015 18:06:20 +0000 Subject: Handle Archive::getNumberOfSymbols being called in an archive with no symbols. No change in llvm, but will be tested from lld. llvm-svn: 249709 --- llvm/lib/Object/Archive.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Object/Archive.cpp') diff --git a/llvm/lib/Object/Archive.cpp b/llvm/lib/Object/Archive.cpp index 941f72bb6a6..42fec39851d 100644 --- a/llvm/lib/Object/Archive.cpp +++ b/llvm/lib/Object/Archive.cpp @@ -510,12 +510,12 @@ Archive::symbol_iterator Archive::symbol_begin() const { } Archive::symbol_iterator Archive::symbol_end() const { - if (!hasSymbolTable()) - return symbol_iterator(Symbol(this, 0, 0)); return symbol_iterator(Symbol(this, getNumberOfSymbols(), 0)); } uint32_t Archive::getNumberOfSymbols() const { + if (!hasSymbolTable()) + return 0; const char *buf = getSymbolTable().begin(); if (kind() == K_GNU) return read32be(buf); -- cgit v1.2.3