Fix handling of files without a symbol table.

This fixes a recent regression (r183338). Stripped elf files (like installed
crtn.o for example), are not required to have a symbol table. Handle that
correctly.

llvm-svn: 183573
This commit is contained in:
Rafael Espindola 2013-06-07 21:08:19 +00:00
parent 999dacc55b
commit a0af48fc93
3 changed files with 8 additions and 1 deletions

View File

@ -279,7 +279,11 @@ public:
llvm::object::symbol_iterator it(_objFile->begin_symbols());
llvm::object::symbol_iterator ie(_objFile->end_symbols());
for (it.increment(EC); it != ie; it.increment(EC)) {
// Skip ELF's first dummy symbol if we have one.
if (it != ie)
it.increment(EC);
for (; it != ie; it.increment(EC)) {
if (EC)
return true;

Binary file not shown.

View File

@ -0,0 +1,3 @@
RUN: lld -flavor gnu -shared -o test.so %p/Inputs/stripped-empty.x86_64
test that we handle files without a symbol table.