Implement boot image extension relocation.

The creation of boot image extensions and other aspects
of loading them shall be implemented in separate CLs.

Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Test: aosp_taimen-userdebug boots.
Change-Id: I1630d6cc44550bc0db72cb5c4a8e08573cf3b92c
diff --git a/runtime/image.cc b/runtime/image.cc
index 0209a29..76efd5f 100644
--- a/runtime/image.cc
+++ b/runtime/image.cc
@@ -72,22 +72,22 @@
   std::copy_n(sections, kSectionCount, sections_);
 }
 
-void ImageHeader::RelocateImage(int64_t delta) {
-  CHECK_ALIGNED(delta, kPageSize) << " patch delta must be page aligned";
+void ImageHeader::RelocateImageReferences(int64_t delta) {
+  CHECK_ALIGNED(delta, kPageSize) << "relocation delta must be page aligned";
   oat_file_begin_ += delta;
   oat_data_begin_ += delta;
   oat_data_end_ += delta;
   oat_file_end_ += delta;
-  RelocateImageObjects(delta);
-  RelocateImageMethods(delta);
-}
-
-void ImageHeader::RelocateImageObjects(int64_t delta) {
   image_begin_ += delta;
   image_roots_ += delta;
 }
 
-void ImageHeader::RelocateImageMethods(int64_t delta) {
+void ImageHeader::RelocateBootImageReferences(int64_t delta) {
+  CHECK_ALIGNED(delta, kPageSize) << "relocation delta must be page aligned";
+  DCHECK_EQ(boot_image_begin_ != 0u, boot_image_size_ != 0u);
+  if (boot_image_begin_ != 0u) {
+    boot_image_begin_ += delta;
+  }
   for (size_t i = 0; i < kImageMethodsCount; ++i) {
     image_methods_[i] += delta;
   }