From 919f5536182890d2e03f59b961acf8f7c836ff61 Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Wed, 20 Jan 2016 19:13:01 +0000 Subject: Revert "Write dex files to oat file early." This reverts commit 625a64aad13905d8a2454bf3cc0e874487b110d5. Breaks the Mac build: Undefined symbols for architecture i386: "_CloseArchive", referenced from: ... in oat_writer.o ld: symbol(s) not found for architecture i386 Change-Id: I21608bc51437834e1e6abde9bcbe5e7d9998197e --- compiler/image_test.cc | 43 ++++++++++++++----------------------------- 1 file changed, 14 insertions(+), 29 deletions(-) (limited to 'compiler/image_test.cc') diff --git a/compiler/image_test.cc b/compiler/image_test.cc index 12132c0cd0..6859605095 100644 --- a/compiler/image_test.cc +++ b/compiler/image_test.cc @@ -95,37 +95,25 @@ void ImageTest::TestWriteRead(ImageHeader::StorageMode storage_mode) { t.NewTiming("WriteElf"); SafeMap key_value_store; - const std::vector& dex_files = class_linker->GetBootClassPath(); + OatWriter oat_writer(class_linker->GetBootClassPath(), + 0, + 0, + 0, + compiler_driver_.get(), + writer.get(), + /*compiling_boot_image*/true, + &timings, + &key_value_store); std::unique_ptr elf_writer = CreateElfWriterQuick( compiler_driver_->GetInstructionSet(), &compiler_driver_->GetCompilerOptions(), oat_file.GetFile()); + bool success = writer->PrepareImageAddressSpace(); + ASSERT_TRUE(success); + elf_writer->Start(); - OatWriter oat_writer(/*compiling_boot_image*/true, &timings); - OutputStream* rodata = elf_writer->StartRoData(); - for (const DexFile* dex_file : dex_files) { - ArrayRef raw_dex_file( - reinterpret_cast(&dex_file->GetHeader()), - dex_file->GetHeader().file_size_); - oat_writer.AddRawDexFileSource(raw_dex_file, - dex_file->GetLocation().c_str(), - dex_file->GetLocationChecksum()); - } - std::unique_ptr opened_dex_files_map; - std::vector> opened_dex_files; - bool dex_files_ok = oat_writer.WriteAndOpenDexFiles( - rodata, - oat_file.GetFile(), - compiler_driver_->GetInstructionSet(), - compiler_driver_->GetInstructionSetFeatures(), - &key_value_store, - &opened_dex_files_map, - &opened_dex_files); - ASSERT_TRUE(dex_files_ok); - oat_writer.PrepareLayout(compiler_driver_.get(), writer.get(), dex_files); - bool image_space_ok = writer->PrepareImageAddressSpace(); - ASSERT_TRUE(image_space_ok); + OutputStream* rodata = elf_writer->StartRoData(); bool rodata_ok = oat_writer.WriteRodata(rodata); ASSERT_TRUE(rodata_ok); elf_writer->EndRoData(rodata); @@ -135,15 +123,12 @@ void ImageTest::TestWriteRead(ImageHeader::StorageMode storage_mode) { ASSERT_TRUE(text_ok); elf_writer->EndText(text); - bool header_ok = oat_writer.WriteHeader(elf_writer->GetStream(), 0u, 0u, 0u); - ASSERT_TRUE(header_ok); - elf_writer->SetBssSize(oat_writer.GetBssSize()); elf_writer->WriteDynamicSection(); elf_writer->WriteDebugInfo(oat_writer.GetMethodDebugInfo()); elf_writer->WritePatchLocations(oat_writer.GetAbsolutePatchLocations()); - bool success = elf_writer->End(); + success = elf_writer->End(); ASSERT_TRUE(success); } -- cgit v1.2.3-59-g8ed1b