summaryrefslogtreecommitdiffstats
path: root/dex2oat
diff options
context:
space:
mode:
authorIgor Murashkin <iam@google.com>2014-10-22 11:37:02 -0700
committerIgor Murashkin <iam@google.com>2014-10-27 20:19:37 -0700
commit46774767fcf7780d1455e755729198648d08742e (patch)
tree09a5d87ff0acbc7eb1fa94ec901ba10009178f03 /dex2oat
parent11bd683f6dbebe2f3d02fa383fc9dbc69a83ace8 (diff)
downloadart-46774767fcf7780d1455e755729198648d08742e.tar.gz
art-46774767fcf7780d1455e755729198648d08742e.tar.bz2
art-46774767fcf7780d1455e755729198648d08742e.zip
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/<isa>. Bug: 18035729 Change-Id: Ie1acad81a0fd8b2f24e1f3f07a06e6fdb548be62
Diffstat (limited to 'dex2oat')
-rw-r--r--dex2oat/dex2oat.cc16
1 files changed, 12 insertions, 4 deletions
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index 1eb5718d69..bdb2b513b0 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -157,6 +157,9 @@ static void UsageError(const char* fmt, ...) {
UsageError(" Example: --instruction-set-features=div");
UsageError(" Default: default");
UsageError("");
+ UsageError(" --compile-pic: Force indirect use of code, methods, and classes");
+ UsageError(" Default: disabled");
+ UsageError("");
UsageError(" --compiler-backend=(Quick|Optimizing|Portable): select compiler backend");
UsageError(" set.");
UsageError(" Example: --compiler-backend=Portable");
@@ -401,7 +404,7 @@ class Dex2Oat {
}
void PrepareImageWriter(uintptr_t image_base) {
- image_writer_.reset(new ImageWriter(*driver_, image_base));
+ image_writer_.reset(new ImageWriter(*driver_, image_base, compiler_options_->GetCompilePic()));
}
bool CreateOatFile(const std::vector<const DexFile*>& dex_files,
@@ -485,10 +488,15 @@ class Dex2Oat {
PLOG(ERROR) << "Failed to open ELF file: " << oat_filename;
return false;
}
- if (!ElfWriter::Fixup(oat_file.get(), oat_data_begin)) {
- LOG(ERROR) << "Failed to fixup ELF file " << oat_file->GetPath();
- return false;
+
+ // Do not fix up the ELF file if we are --compile-pic
+ if (!compiler_options_->GetCompilePic()) {
+ if (!ElfWriter::Fixup(oat_file.get(), oat_data_begin)) {
+ LOG(ERROR) << "Failed to fixup ELF file " << oat_file->GetPath();
+ return false;
+ }
}
+
return true;
}