diff options
Diffstat (limited to 'patchoat/patchoat.cc')
| -rw-r--r-- | patchoat/patchoat.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/patchoat/patchoat.cc b/patchoat/patchoat.cc index 3d9f7dc2d5..723bb1762d 100644 --- a/patchoat/patchoat.cc +++ b/patchoat/patchoat.cc @@ -526,6 +526,20 @@ void PatchOat::PatchInternedStrings(const ImageHeader* image_header) { temp_table.VisitRoots(&visitor, kVisitRootFlagAllRoots); } +void PatchOat::PatchClassTable(const ImageHeader* image_header) { + const auto& section = image_header->GetImageSection(ImageHeader::kSectionClassTable); + // Note that we require that ReadFromMemory does not make an internal copy of the elements. + // This also relies on visit roots not doing any verification which could fail after we update + // the roots to be the image addresses. + WriterMutexLock mu(Thread::Current(), *Locks::classlinker_classes_lock_); + ClassTable temp_table; + temp_table.ReadFromMemory(image_->Begin() + section.Offset()); + FixupRootVisitor visitor(this); + BufferedRootVisitor<kDefaultBufferedRootCount> buffered_visitor(&visitor, RootInfo(kRootUnknown)); + temp_table.VisitRoots(buffered_visitor); +} + + class RelocatedPointerVisitor { public: explicit RelocatedPointerVisitor(PatchOat* patch_oat) : patch_oat_(patch_oat) {} @@ -606,6 +620,7 @@ bool PatchOat::PatchImage() { PatchArtFields(image_header); PatchArtMethods(image_header); PatchInternedStrings(image_header); + PatchClassTable(image_header); // Patch dex file int/long arrays which point to ArtFields. PatchDexFileArrays(img_roots); |