OSDN Git Service

ART: Support dlopen for a PIC boot image
authorAndreas Gampe <agampe@google.com>
Wed, 2 Dec 2015 18:29:33 +0000 (10:29 -0800)
committerAndreas Gampe <agampe@google.com>
Wed, 2 Dec 2015 18:31:14 +0000 (10:31 -0800)
Add support for the recent dlext extension for PIC support. Pass
the oat_file_begin to dlopen_ext as a reserved_addr using the new
LOAD_AT_FIXED_ADDRESS flag (when it isn't null).

Bug: 24683631
Change-Id: I59c5c82aebfa7cfb815e1fcf47fd72bec6f8239b

runtime/oat_file.cc

index 7a3576a..5fbede5 100644 (file)
@@ -566,6 +566,10 @@ bool DlOpenOatFile::Dlopen(const std::string& elf_filename,
                                                                 //    times).
                     ANDROID_DLEXT_FORCE_FIXED_VADDR;            // Take a non-zero vaddr as absolute
                                                                 //   (non-pic boot image).
+    if (oat_file_begin != nullptr) {                            //
+      extinfo.flags |= ANDROID_DLEXT_LOAD_AT_FIXED_ADDRESS;     // Use the requested addr if
+      extinfo.reserved_addr = oat_file_begin;                   // vaddr = 0.
+    }                                                           //   (pic boot image).
     dlopen_handle_ = android_dlopen_ext(absolute_path.get(), RTLD_NOW, &extinfo);
 #else
     dlopen_handle_ = dlopen(absolute_path.get(), RTLD_NOW);