ART: Fix CFI test wrt/ PIC
PIC boot images can't be loaded with dlopen, as their base is zero,
but we have an expectant address. Turn off in-process unwinding
in 137-cfi by checking the boot image oat file type.
Keep a non-owned referenced to the oat file in image space to simplify
access.
Change-Id: Ia2b525f9b2ecbc80b433f09e04ebece4cb6f2d2b
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index dc8a3d1..c4d978f 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -808,18 +808,11 @@
}
const OatFile* ClassLinker::GetBootOatFile() {
- // To grab the boot oat, look at the dex files in the boot classpath. Any of those is fine, as
- // they were all compiled into the same oat file. So grab the first one, which is guaranteed to
- // exist if the boot class-path isn't empty.
- if (boot_class_path_.empty()) {
+ gc::space::ImageSpace* image_space = Runtime::Current()->GetHeap()->GetImageSpace();
+ if (image_space == nullptr) {
return nullptr;
}
- const DexFile* boot_dex_file = boot_class_path_[0];
- // Is it from an oat file?
- if (boot_dex_file->GetOatDexFile() != nullptr) {
- return boot_dex_file->GetOatDexFile()->GetOatFile();
- }
- return nullptr;
+ return image_space->GetOatFile();
}
const OatFile* ClassLinker::GetPrimaryOatFile() {