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/compiler/elf_writer.h b/compiler/elf_writer.h
index 033c1f8..8e13b51 100644
--- a/compiler/elf_writer.h
+++ b/compiler/elf_writer.h
@@ -38,8 +38,8 @@
   // Looks up information about location of oat file in elf file container.
   // Used for ImageWriter to perform memory layout.
   static void GetOatElfInformation(File* file,
-                                   size_t& oat_loaded_size,
-                                   size_t& oat_data_offset);
+                                   size_t* oat_loaded_size,
+                                   size_t* oat_data_offset);
 
   // Returns runtime oat_data runtime address for an opened ElfFile.
   static uintptr_t GetOatDataAddress(ElfFile* elf_file);