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
(cherry picked from commit 3fc9903407c6e89ffbbc92ded9e272d9de58e9b6)
Change-Id: Ib3e1295fc06993bcfbaadd8f253ee4f5498f52e9
diff --git a/compiler/image_writer.cc b/compiler/image_writer.cc
index 4dc7509..195949b 100644
--- a/compiler/image_writer.cc
+++ b/compiler/image_writer.cc
@@ -166,7 +166,7 @@
size_t oat_loaded_size = 0;
size_t oat_data_offset = 0;
- ElfWriter::GetOatElfInformation(oat_file.get(), oat_loaded_size, oat_data_offset);
+ ElfWriter::GetOatElfInformation(oat_file.get(), &oat_loaded_size, &oat_data_offset);
Thread::Current()->TransitionFromSuspendedToRunnable();
CreateHeader(oat_loaded_size, oat_data_offset);