ART: Prepare for ELF64.
Only expose necessary interface in ElfFile, and move all details into template class ElfFileImpl.
Change-Id: I9df2bbc55f32ba0ba91f4f3d5d0009e84a2ddf74
diff --git a/runtime/oat_file.cc b/runtime/oat_file.cc
index a896f3e..a8a8307 100644
--- a/runtime/oat_file.cc
+++ b/runtime/oat_file.cc
@@ -47,9 +47,11 @@
std::string* error_msg) {
std::unique_ptr<OatFile> oat_file(new OatFile(location, false));
oat_file->elf_file_.reset(elf_file);
- Elf32_Shdr* hdr = elf_file->FindSectionByName(".rodata");
- oat_file->begin_ = elf_file->Begin() + hdr->sh_offset;
- oat_file->end_ = elf_file->Begin() + hdr->sh_size + hdr->sh_offset;
+ uint64_t offset, size;
+ bool has_section = elf_file->GetSectionOffsetAndSize(".rodata", &offset, &size);
+ CHECK(has_section);
+ oat_file->begin_ = elf_file->Begin() + offset;
+ oat_file->end_ = elf_file->Begin() + size + offset;
return oat_file->Setup(error_msg) ? oat_file.release() : nullptr;
}