OSDN Git Service

Ensure that ClassTable has correct alignment in image.
authorAlex Light <allight@google.com>
Wed, 16 Dec 2015 23:52:51 +0000 (15:52 -0800)
committerAlex Light <allight@google.com>
Wed, 16 Dec 2015 23:52:51 +0000 (15:52 -0800)
Change-Id: I645b44fae1ec129364449af552c745bf32486b1a

compiler/image_writer.cc

index fce08ea..afa4904 100644 (file)
@@ -1275,6 +1275,8 @@ void ImageWriter::CreateHeader(size_t oat_loaded_size, size_t oat_data_offset) {
   auto* interned_strings_section = &sections[ImageHeader::kSectionInternedStrings];
   *interned_strings_section = ImageSection(cur_pos, intern_table_bytes_);
   cur_pos = interned_strings_section->End();
+  // Round up to the alignment the class table expects. See HashSet::WriteToMemory.
+  cur_pos = RoundUp(cur_pos, sizeof(uint64_t));
   // Calculate the size of the class table section.
   auto* class_table_section = &sections[ImageHeader::kSectionClassTable];
   *class_table_section = ImageSection(cur_pos, class_table_bytes_);