ART: Do not relocate app program headers in patchoat.
Change the check whether to relocate program headers in
patchoat to simply look whether there is a PT_LOAD section
with p_vaddr == 0. If there is, don't relocate the headers,
it should be an app. Otherwise, it's a boot image and needs
to be relocated.
Add overflow checking to ElfFileImpl<>::GetLoadedSize().
Bug: 21047854
Change-Id: Ie6737f338687296b6dbf4bb3b36358501dfb1587
diff --git a/runtime/elf_file_impl.h b/runtime/elf_file_impl.h
index 80950c6..3ad096f 100644
--- a/runtime/elf_file_impl.h
+++ b/runtime/elf_file_impl.h
@@ -106,8 +106,8 @@
Elf_Word GetRelaNum(Elf_Shdr&) const;
Elf_Rela& GetRela(Elf_Shdr&, Elf_Word) const;
- // Returns the expected size when the file is loaded at runtime
- size_t GetLoadedSize() const;
+ // Retrieves the expected size when the file is loaded at runtime. Returns true if successful.
+ bool GetLoadedSize(size_t* size, std::string* error_msg) const;
// Load segments into memory based on PT_LOAD program headers.
// executable is true at run time, false at compile time.