Log dlopen failures caused by text relocations

Some apps will fail to load native libraries with
text relocations when switching target sdk version to M.
It could be hard to diagnose because some of them
suppress dlerror and/or UnsatisfiedLinkError.

This change unconditionally logs the error message making
the cause of the failure more visible to developers.

Bug: http://b/24876001
Change-Id: I0477a0d1307d0879000f3a3a43b974b4cf34bdb2
This commit is contained in:
Dmitriy Ivanov 2015-10-13 11:07:56 -07:00
parent a828a2f8e6
commit f32b689d3d

View file

@ -2937,6 +2937,7 @@ bool soinfo::link_image(const soinfo_list_t& global_group, const soinfo_list_t&
// TODO (dimitry): remove != __ANDROID_API__ check once http://b/20020312 is fixed // TODO (dimitry): remove != __ANDROID_API__ check once http://b/20020312 is fixed
if (get_application_target_sdk_version() != __ANDROID_API__ if (get_application_target_sdk_version() != __ANDROID_API__
&& get_application_target_sdk_version() > 22) { && get_application_target_sdk_version() > 22) {
PRINT("%s: has text relocations", get_realpath());
DL_ERR("%s: has text relocations", get_realpath()); DL_ERR("%s: has text relocations", get_realpath());
return false; return false;
} }