From 33cb94e5e5b50330fb9fbafe90d1a2a6bd026e2f Mon Sep 17 00:00:00 2001 From: Andreas Gampe Date: Tue, 16 Sep 2014 16:40:09 -0700 Subject: ART: Sync oat file to disk before patching Bug: 15567083, 17439961, 17510489, 17478752 (cherry picked from commit 035592c51fee2995a3d90a9043f91a7a3128df2b) Change-Id: I828dc6775044b5050c2520eb097abe6a920fd3ee --- dex2oat/dex2oat.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc index be6f097..d97144e 100644 --- a/dex2oat/dex2oat.cc +++ b/dex2oat/dex2oat.cc @@ -435,6 +435,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; -- cgit v1.1