From 46774767fcf7780d1455e755729198648d08742e Mon Sep 17 00:00:00 2001 From: Igor Murashkin Date: Wed, 22 Oct 2014 11:37:02 -0700 Subject: ART: Add support for patching and loading OAT files compiled with PIC * Images (.art) compiled with pic now have a new field added. * isDexOptNeeded will now skip patch-ing for apps compiled PIC * First-boot patching now only copies boot.art, boot.oat is linked As a result, all system preopted dex files (with --compile-pic) no longer take up any space in /data/dalvik-cache/. Bug: 18035729 Change-Id: Ie1acad81a0fd8b2f24e1f3f07a06e6fdb548be62 --- runtime/image.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'runtime/image.h') diff --git a/runtime/image.h b/runtime/image.h index 03de509..7e2b847 100644 --- a/runtime/image.h +++ b/runtime/image.h @@ -28,7 +28,7 @@ namespace art { // header of image files written by ImageWriter, read and validated by Space. class PACKED(4) ImageHeader { public: - ImageHeader() {} + ImageHeader() : compile_pic_(0) {} ImageHeader(uint32_t image_begin, uint32_t image_size_, @@ -39,7 +39,8 @@ class PACKED(4) ImageHeader { uint32_t oat_file_begin, uint32_t oat_data_begin, uint32_t oat_data_end, - uint32_t oat_file_end); + uint32_t oat_file_end, + bool compile_pic_); bool IsValid() const; const char* GetMagic() const; @@ -121,6 +122,10 @@ class PACKED(4) ImageHeader { void RelocateImage(off_t delta); + bool CompilePic() const { + return compile_pic_ != 0; + } + private: static const uint8_t kImageMagic[4]; static const uint8_t kImageVersion[4]; @@ -162,6 +167,9 @@ class PACKED(4) ImageHeader { // Absolute address of an Object[] of objects needed to reinitialize from an image. uint32_t image_roots_; + // Boolean (0 or 1) to denote if the image was compiled with --compile-pic option + const uint32_t compile_pic_; + friend class ImageWriter; }; -- cgit v1.1