OSDN Git Service

ART: Sync oat file to disk before patching
authorAndreas Gampe <agampe@google.com>
Tue, 16 Sep 2014 23:40:09 +0000 (16:40 -0700)
committerAndreas Gampe <agampe@google.com>
Tue, 16 Sep 2014 23:40:09 +0000 (16:40 -0700)
Bug: 15567083174399611751048917478752
Change-Id: I828dc6775044b5050c2520eb097abe6a920fd3ee

dex2oat/dex2oat.cc

index f0d3455..e55e358 100644 (file)
@@ -426,6 +426,11 @@ class Dex2Oat {
       return nullptr;
     }
 
+    // Flush result to disk. Patching code will re-open the file (mmap), so ensure that our view
+    // of the file already made it there and won't be re-ordered with writes from PatchOat or
+    // image patching.
+    oat_file->Flush();
+
     if (!driver->IsImage() && driver->GetCompilerOptions().GetIncludePatchInformation()) {
       t2.NewTiming("Patching ELF");
       std::string error_msg;