Add oat file generation and tests to build

- Currently builds boot.oat for host and target
  and target oat files for art tests.
- Added cross compilation support via --strip-prefix option to dex2oat
- Reduced output to prevent build log spam (Compiler::verbose_)
- Added image roots for recovering important pointers on image load
- Redid JNI stub creation and made the stub array an image root
- Fixed JNI stub test by making JNI stub array executable
- Fixed JNI UnregisterNative to having it reinstall the JNI stub
- Fixed ARM JNI stub to generate PIC code (with irogers)
- Fixed JniCompiler to generate PIC code (with irogers)
- Fixed FindNativeMethod to handle recursive calls
- Finished checkFieldType to use Object::InstanceOf
- Fixed thread unsafe access to ClassLinker::{dex_files_,dex_caches_}
- Added ResolvedMethod variant for use with Method* for context
- Fixed ImageWriter to call FixupMethod
- Fixed ImageWriter to rewrite JNI stub references
- Improved error reporting on lack of ANDROID_DATA dir or art-cache dir
- Fixed Runtime::Start to InitLibraries before creating thread peer
- Implemented Space::IsCondemned to skip spaces loaded from images
- Implemented artFindInterfaceMethodInCache,
  allowing interface invocation from managed code

Change-Id: I603e97fa0ac44508ae05a2e47c1cdb4481678d7b
diff --git a/src/image.h b/src/image.h
index 02d15de..0694630 100644
--- a/src/image.h
+++ b/src/image.h
@@ -15,7 +15,8 @@
  public:
   ImageHeader() {}
 
-  ImageHeader(uint32_t base_addr) : base_addr_(base_addr) {
+  ImageHeader(uint32_t base_addr, uint32_t image_roots)
+      : base_addr_(base_addr), image_roots_(image_roots) {
     memcpy(magic_, kImageMagic, sizeof(kImageMagic));
     memcpy(version_, kImageVersion, sizeof(kImageVersion));
   }
@@ -34,6 +35,15 @@
     return reinterpret_cast<byte*>(base_addr_);
   }
 
+  enum ImageRoot {
+    kJniStubArray,
+    kImageRootsMax,
+  };
+
+  Object* GetImageRoot(ImageRoot image_root) const {
+    return reinterpret_cast<ObjectArray<Object>*>(image_roots_)->Get(image_root);
+  }
+
  private:
   static const byte kImageMagic[4];
   static const byte kImageVersion[4];
@@ -43,6 +53,11 @@
 
   // required base address for mapping the image.
   uint32_t base_addr_;
+
+  // absolute address of an Object[] of objects needed to reinitialize from an image
+  uint32_t image_roots_;
+
+  friend class ImageWriter;
 };
 
 }  // namespace art