Make system use patchoat to relocate during runtime.
Change dalvik_system_DexFile.cc so that isDexOptNeededInternal will be
able to indicate that a patchoat is required. Change default of relocate
option to be on.
Bug: 15358152
Change-Id: Ibe92d8b55a24bbf718b0416a21b76e5df7a2de26
diff --git a/runtime/gc/space/image_space.cc b/runtime/gc/space/image_space.cc
index fc6d2ef..1d10af2 100644
--- a/runtime/gc/space/image_space.cc
+++ b/runtime/gc/space/image_space.cc
@@ -166,7 +166,8 @@
return true;
}
-bool ImageSpace::RelocateImage(const char* image_location, const char* dest_filename,
+// Relocate the image at image_location to dest_filename and relocate it by a random amount.
+static bool RelocateImage(const char* image_location, const char* dest_filename,
InstructionSet isa, std::string* error_msg) {
std::string patchoat(Runtime::Current()->GetPatchoatExecutable());
diff --git a/runtime/gc/space/image_space.h b/runtime/gc/space/image_space.h
index debca52..6be3b8f 100644
--- a/runtime/gc/space/image_space.h
+++ b/runtime/gc/space/image_space.h
@@ -124,9 +124,6 @@
bool validate_oat_file, std::string* error_msg)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- static bool RelocateImage(const char* image_location, const char* dest_filename,
- InstructionSet isa, std::string* error_msg);
-
OatFile* OpenOatFile(const char* image, std::string* error_msg) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);