diff options
author | Dimitry Ivanov <dimitry@google.com> | 2017-02-10 11:04:20 -0800 |
---|---|---|
committer | Dimitry Ivanov <dimitry@google.com> | 2017-02-10 16:11:51 -0800 |
commit | ec90e24d33837e107b45e7c98b2f5fb4bc115a5e (patch) | |
tree | da59fda3b0eac92d43fe86dc457506a11382953c /linker/linker.cpp | |
parent | 132768084e24119c337e56fd110b97a23e5593c2 (diff) |
loader: fix d-tor call order
In the case when there are multiple dependencies on
the same library in the local_group the unload may
in some situations (covered now by tests) result
calling d-tors for some libraries prematurely.
In order to have correct call order loader checks if this
is last dependency in local group before adding it to BFS
queue.
Bug: http://b/35201832
Test: bionic-unit-tests --gtest_filter=dl*:Dl*
Test: bionic-unit-tests-glibc --gtest_filter=dl*
Change-Id: I4c6955b9032acc7147a51d9f09b61d9e0818700c
Diffstat (limited to 'linker/linker.cpp')
-rw-r--r-- | linker/linker.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/linker/linker.cpp b/linker/linker.cpp index 522d5dc1a..ece61873a 100644 --- a/linker/linker.cpp +++ b/linker/linker.cpp @@ -1661,12 +1661,14 @@ static void soinfo_unload(soinfo* soinfos[], size_t count) { TRACE("%s@%p needs to unload %s@%p", si->get_realpath(), si, child->get_realpath(), child); + child->get_parents().remove(si); + if (local_unload_list.contains(child)) { continue; } else if (child->is_linked() && child->get_local_group_root() != root) { external_unload_list.push_back(child); - } else { - unload_list.push_front(child); + } else if (child->get_parents().empty()) { + unload_list.push_back(child); } } } else { |