linker: remove link from external library on unload

When unloading library make sure the soinfo_link to parent
from linked external libraries is removed as well.

Bug: 36104177
Bug: http://b/37433850
Test: manual
Change-Id: I601b54144acecac54744805b38313c46045c54cb
(cherry picked from commit ee398f820700de30941fd82e38bd917e1513cbc6)
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 39aa2ca..a287cf4 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -2239,6 +2239,9 @@
         if (local_unload_list.contains(child)) {
           continue;
         } else if (child->is_linked() && child->get_local_group_root() != root) {
+          child->get_parents().remove_if([&] (const soinfo* parent) {
+            return parent == si;
+          });
           external_unload_list.push_back(child);
         } else {
           unload_list.push_front(child);