summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jing Ji <a5705c@motorola.com> 2016-08-31 21:21:37 -0500
committer David Sehr <sehr@google.com> 2016-09-20 12:56:21 -0700
commit96e640c1909d21081a2c342d160ed65ba536dae0 (patch)
tree714ab83dcc06fde5cf660a6c82769537b0fd29f2
parent48d10ee126838f060aa6dcd304fc161b57bc14af (diff)
Fix the target art method address within a method object
The target offset of art method within a method object should take account of the offset of the image which is declaring this method. Bug: 31311504 Change-Id: Id6670dd3436b4bf5fb943d8d6234851fb336a4dc (cherry picked from commit 1717159b07abefcf59d099bc81158644f0a0bffb) Test: test-art-{host,target}
-rw-r--r--compiler/image_writer.cc6
1 files changed, 1 insertions, 5 deletions
diff --git a/compiler/image_writer.cc b/compiler/image_writer.cc
index 6d86f7d9d8..3e6658ee40 100644
--- a/compiler/image_writer.cc
+++ b/compiler/image_writer.cc
@@ -1992,11 +1992,7 @@ void ImageWriter::FixupObject(Object* orig, Object* copy) {
auto* dest = down_cast<mirror::AbstractMethod*>(copy);
auto* src = down_cast<mirror::AbstractMethod*>(orig);
ArtMethod* src_method = src->GetArtMethod();
- auto it = native_object_relocations_.find(src_method);
- CHECK(it != native_object_relocations_.end())
- << "Missing relocation for AbstractMethod.artMethod " << PrettyMethod(src_method);
- dest->SetArtMethod(
- reinterpret_cast<ArtMethod*>(global_image_begin_ + it->second.offset));
+ dest->SetArtMethod(GetImageMethodAddress(src_method));
} else if (!klass->IsArrayClass()) {
ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
if (klass == class_linker->GetClassRoot(ClassLinker::kJavaLangDexCache)) {