ART: Better error reporting on broken oat file
Do not blow up when in GetHashBucket if GetHashBucketNum is zero.
Instead back-step to ElfFileOpen, which prints which symbol was
missing from which file.
Bug: 17422404
Change-Id: I3b890dd1c31c08b1ccc0f7f668afcceee95f8d00
diff --git a/runtime/elf_file.cc b/runtime/elf_file.cc
index 6179b5e..f6e8921 100644
--- a/runtime/elf_file.cc
+++ b/runtime/elf_file.cc
@@ -584,6 +584,10 @@
}
const Elf32_Sym* ElfFile::FindDynamicSymbol(const std::string& symbol_name) const {
+ if (GetHashBucketNum() == 0) {
+ // No dynamic symbols at all.
+ return nullptr;
+ }
Elf32_Word hash = elfhash(symbol_name.c_str());
Elf32_Word bucket_index = hash % GetHashBucketNum();
Elf32_Word symbol_and_chain_index = GetHashBucket(bucket_index);