diff options
| -rw-r--r-- | runtime/elf_file.cc | 6 | ||||
| -rw-r--r-- | runtime/oat_file.cc | 12 |
2 files changed, 14 insertions, 4 deletions
diff --git a/runtime/elf_file.cc b/runtime/elf_file.cc index 0be274c3e3..2140334bf1 100644 --- a/runtime/elf_file.cc +++ b/runtime/elf_file.cc @@ -70,7 +70,10 @@ bool ElfFile::Setup(File* file, bool writable, bool program_header_only) { return false; } if (file_length < sizeof(llvm::ELF::Elf32_Ehdr)) { - LOG(WARNING) << "File not large enough to contain ELF header: " << file_->GetPath(); + if (writable) { + LOG(WARNING) << "File size " << file_length + << " not large enough to contain ELF header: " << file_->GetPath(); + } return false; } @@ -78,7 +81,6 @@ bool ElfFile::Setup(File* file, bool writable, bool program_header_only) { // first just map ELF header to get program header size information size_t elf_header_size = sizeof(llvm::ELF::Elf32_Ehdr); if (!SetMap(MemMap::MapFile(elf_header_size, prot, flags, file_->Fd(), 0))) { - LOG(WARNING) << "Failed to map ELF header: " << file_->GetPath(); return false; } // then remap to cover program header diff --git a/runtime/oat_file.cc b/runtime/oat_file.cc index abd128758b..418af0fe65 100644 --- a/runtime/oat_file.cc +++ b/runtime/oat_file.cc @@ -63,10 +63,16 @@ OatFile* OatFile::Open(const std::string& filename, bool executable) { CHECK(!filename.empty()) << location; CheckLocation(filename); - // If we are trying to execute, we need to use dlopen. +#ifdef ART_USE_PORTABLE_COMPILER + // If we are using PORTABLE, use dlopen to deal with relocations. + // + // We use our own ELF loader for Quick to deal with legacy apps that + // open a generated dex file by name, remove the file, then open + // another generated dex file with the same name. http://b/10614658 if (executable) { return OpenDlopen(filename, location, requested_base); } +#endif // If we aren't trying to execute, we just use our own ElfFile loader for a couple reasons: // // On target, dlopen may fail when compiling due to selinux restrictions on installd. @@ -160,7 +166,9 @@ bool OatFile::Dlopen(const std::string& elf_filename, byte* requested_base) { bool OatFile::ElfFileOpen(File* file, byte* requested_base, bool writable, bool executable) { elf_file_.reset(ElfFile::Open(file, writable, true)); if (elf_file_.get() == NULL) { - PLOG(WARNING) << "Failed to create ELF file for " << file->GetPath(); + if (writable) { + PLOG(WARNING) << "Failed to open ELF file for " << file->GetPath(); + } return false; } bool loaded = elf_file_->Load(executable); |