diff options
author | Dmitriy Ivanov <dimitry@google.com> | 2015-06-02 13:28:06 -0700 |
---|---|---|
committer | Dmitriy Ivanov <dimitry@google.com> | 2015-06-02 14:02:22 -0700 |
commit | 75108f4f830b533aced792d35e52841bf597f960 (patch) | |
tree | 2e2d522c2ef4ee1112c903f594e30320ceef8bb3 /linker/linker.cpp | |
parent | d70891687d742414d457e41a998726e5eb0a09bd (diff) |
Work around for libraries without dt_soname
Applies only for apps targeting sdk version <= 22
Bug: http://b/21565766
Change-Id: If0bf2229dc1341e9ca09f9a05d0890515273d5a2
(cherry picked from commit 38c37d6705f420ecac4146c11d79bee6e0ca8a03)
Diffstat (limited to 'linker/linker.cpp')
-rw-r--r-- | linker/linker.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/linker/linker.cpp b/linker/linker.cpp index 531cd1908..2771f6817 100644 --- a/linker/linker.cpp +++ b/linker/linker.cpp @@ -2849,6 +2849,19 @@ bool soinfo::prelink_image() { DL_ERR("empty/missing DT_SYMTAB in \"%s\"", get_realpath()); return false; } + + // Before M release linker was using basename in place of soname. + // In the case when dt_soname is absent some apps stop working: + // because they can't find dt_needed library by soname. + // This workaround should keep them working. (applies only + // for apps targeting sdk version <=22). Make an exception for main + // executable which does not need dt_soname. + uint32_t target_sdk_version = get_application_target_sdk_version(); + if (soname_ == nullptr && this != somain && target_sdk_version != 0 && target_sdk_version <= 22) { + soname_ = basename(realpath_.c_str()); + DL_WARN("%s: is missing DT_SONAME will use basename as a replacement: \"%s\"", + get_realpath(), soname_); + } return true; } |