ART: Make boot image compilation always PIC.

The non-PIC boot image config should be used only for
gtests, so we should not rely on --compile-pic being
passed to dex2oat.

Test: m
Bug: 111149076
Change-Id: I4abf6ed0d85dfd9ddfe61517b16e36bbcfe58c39
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index 8dca889..cbc6424 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -290,7 +290,7 @@
   UsageError("      Default: default");
   UsageError("");
   UsageError("  --compile-pic: Force indirect use of code, methods, and classes");
-  UsageError("      Default: disabled");
+  UsageError("      Default: disabled for apps (ignored for boot image which is always PIC)");
   UsageError("");
   UsageError("  --compiler-backend=(Quick|Optimizing): select compiler backend");
   UsageError("      set.");
@@ -725,6 +725,9 @@
 
   void ProcessOptions(ParserOptions* parser_options) {
     compiler_options_->boot_image_ = !image_filenames_.empty();
+    if (compiler_options_->boot_image_) {
+      compiler_options_->compile_pic_ = true;
+    }
     compiler_options_->app_image_ = app_image_fd_ != -1 || !app_image_file_name_.empty();
 
     if (IsBootImage() && image_filenames_.size() == 1) {