art: Fix classlinker and nopatchoat test for PIC case
ClassLinker should not be checking oat data begin and the patch delta
as part of the checksum verification (when PIC is enabled).
Also update nopatchoat test since it needs to be parametric on whether
PIC is used.
Bug: 18035729
Change-Id: I4eb184d22616230a7b8f0dd514d3416d0976b07e
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index e2514ec..2716326 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -1161,9 +1161,13 @@
image_patch_delta = image_header->GetPatchDelta();
}
const OatHeader& oat_header = oat_file->GetOatHeader();
- bool ret = ((oat_header.GetImageFileLocationOatChecksum() == image_oat_checksum)
- && (oat_header.GetImagePatchDelta() == image_patch_delta)
- && (oat_header.GetImageFileLocationOatDataBegin() == image_oat_data_begin));
+ bool ret = (oat_header.GetImageFileLocationOatChecksum() == image_oat_checksum);
+
+ // If the oat file is PIC, it doesn't care if/how image was relocated. Ignore these checks.
+ if (!oat_file->IsPic()) {
+ ret = ret && (oat_header.GetImagePatchDelta() == image_patch_delta)
+ && (oat_header.GetImageFileLocationOatDataBegin() == image_oat_data_begin);
+ }
if (!ret) {
*error_msg = StringPrintf("oat file '%s' mismatch (0x%x, %d, %d) with (0x%x, %" PRIdPTR ", %d)",
oat_file->GetLocation().c_str(),