Move .oat files to ELF format

Generates .oat in ELF file format using MCLinker
- Uses MCLinker IRBuilder to create a synthetic .o from OatWriter output.
- Uses new ElfFile for prelinking to support art image optimizations.

Adapted OatFile to load using dlopen, ElfFile, or memory, removing raw MemMap mechanism.

Changed image code to not assume oat data will be immediately after
image to allow space for ELF headers.

Passes test-art and works with installd.

Change-Id: Idc026eddb5de93f4b97490c405f3ed7b39589749
diff --git a/src/common_test.h b/src/common_test.h
index 2836706..5a5479a 100644
--- a/src/common_test.h
+++ b/src/common_test.h
@@ -526,6 +526,18 @@
     CompileMethod(method);
   }
 
+  void ReserveImageSpace() {
+    // Reserve where the image will be loaded up front so that other parts of test set up don't
+    // accidentally end up colliding with the fixed memory address when we need to load the image.
+    image_reservation_.reset(MemMap::MapAnonymous("Image reservation", (byte*)ART_BASE_ADDRESS,
+                                                  (size_t)100 * 1024 * 1024,  // 100MB
+                                                  PROT_NONE));
+  }
+
+  void UnreserveImageSpace() {
+    image_reservation_.reset();
+  }
+
   std::string android_data_;
   std::string art_cache_;
   const DexFile* java_lang_dex_file_;  // owned by runtime_
@@ -538,6 +550,7 @@
 
  private:
   std::vector<const DexFile*> opened_dex_files_;
+  UniquePtr<MemMap> image_reservation_;
 };
 
 // Sets a CheckJni abort hook to catch failures. Note that this will cause CheckJNI to carry on