ART: Add pic flag to oat header store
Add the compile-time PIC flag to the oat-header key-value store.
Ignore image offset and patch delta when loading PIC oat files.
Change-Id: Ie1f1ef37125386a968228033d1e2bec565315510
diff --git a/runtime/oat_file.cc b/runtime/oat_file.cc
index 03a398e..0f0e33c 100644
--- a/runtime/oat_file.cc
+++ b/runtime/oat_file.cc
@@ -72,7 +72,7 @@
bool executable,
std::string* error_msg) {
CHECK(!filename.empty()) << location;
- CheckLocation(filename);
+ CheckLocation(location);
std::unique_ptr<OatFile> ret;
if (kUsePortableCompiler && executable) {
// If we are using PORTABLE, use dlopen to deal with relocations.
@@ -592,4 +592,10 @@
method->SetNativeGcMap(GetNativeGcMap()); // Used by native methods in work around JNI mode.
}
+bool OatFile::IsPic() const {
+ const char* pic_string = GetOatHeader().GetStoreValueByKey(OatHeader::kPicKey);
+ return (pic_string != nullptr && strncmp(pic_string, "true", 5) == 0);
+ // TODO: Check against oat_patches. b/18144996
+}
+
} // namespace art