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/gc/space/image_space.cc b/runtime/gc/space/image_space.cc
index f7ceb84..1923d24 100644
--- a/runtime/gc/space/image_space.cc
+++ b/runtime/gc/space/image_space.cc
@@ -755,6 +755,7 @@
DCHECK(!error_msg->empty());
return nullptr;
}
+ space->oat_file_non_owned_ = space->oat_file_.get();
if (validate_oat_file && !space->ValidateOatFile(error_msg)) {
DCHECK(!error_msg->empty());
@@ -838,10 +839,12 @@
return true;
}
+
const OatFile* ImageSpace::GetOatFile() const {
- return oat_file_.get();
+ return oat_file_non_owned_;
}
+
OatFile* ImageSpace::ReleaseOatFile() {
CHECK(oat_file_.get() != nullptr);
return oat_file_.release();