diff options
Diffstat (limited to 'dex2oat')
-rw-r--r-- | dex2oat/dex2oat.cc | 16 |
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; } |