Merge "Fix soinfo_unload"
This commit is contained in:
commit
8408d7efac
@ -320,7 +320,7 @@ static void soinfo_free(soinfo* si) {
|
|||||||
|
|
||||||
if (trav == nullptr) {
|
if (trav == nullptr) {
|
||||||
// si was not in solist
|
// si was not in solist
|
||||||
DL_ERR("name \"%s\" is not in solist!", si->name);
|
DL_ERR("name \"%s\"@%p is not in solist!", si->name, si);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1150,20 +1150,29 @@ static void soinfo_unload(soinfo* root) {
|
|||||||
soinfo* si = nullptr;
|
soinfo* si = nullptr;
|
||||||
|
|
||||||
while ((si = depth_first_list.pop_front()) != nullptr) {
|
while ((si = depth_first_list.pop_front()) != nullptr) {
|
||||||
|
if (local_unload_list.contains(si)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
local_unload_list.push_back(si);
|
local_unload_list.push_back(si);
|
||||||
|
|
||||||
if (si->has_min_version(0)) {
|
if (si->has_min_version(0)) {
|
||||||
soinfo* child = nullptr;
|
soinfo* child = nullptr;
|
||||||
while ((child = si->get_children().pop_front()) != nullptr) {
|
while ((child = si->get_children().pop_front()) != nullptr) {
|
||||||
TRACE("%s needs to unload %s", si->name, child->name);
|
TRACE("%s@%p needs to unload %s@%p", si->name, si, child->name, child);
|
||||||
if (local_unload_list.contains(child)) {
|
if (local_unload_list.contains(child)) {
|
||||||
continue;
|
continue;
|
||||||
} else if (child->get_local_group_root() != root) {
|
} else if (child->is_linked() && child->get_local_group_root() != root) {
|
||||||
external_unload_list.push_back(child);
|
external_unload_list.push_back(child);
|
||||||
} else {
|
} else {
|
||||||
depth_first_list.push_front(child);
|
depth_first_list.push_front(child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
#ifdef __LP64__
|
||||||
|
__libc_fatal("soinfo for \"%s\"@%p has no version", si->name, si);
|
||||||
|
#else
|
||||||
|
PRINT("warning: soinfo for \"%s\"@%p has no version", si->name, si);
|
||||||
for_each_dt_needed(si, [&] (const char* library_name) {
|
for_each_dt_needed(si, [&] (const char* library_name) {
|
||||||
TRACE("deprecated (old format of soinfo): %s needs to unload %s", si->name, library_name);
|
TRACE("deprecated (old format of soinfo): %s needs to unload %s", si->name, library_name);
|
||||||
soinfo* needed = find_library(library_name, RTLD_NOLOAD, nullptr);
|
soinfo* needed = find_library(library_name, RTLD_NOLOAD, nullptr);
|
||||||
@ -1175,7 +1184,7 @@ static void soinfo_unload(soinfo* root) {
|
|||||||
} else if (local_unload_list.contains(needed)) {
|
} else if (local_unload_list.contains(needed)) {
|
||||||
// already visited
|
// already visited
|
||||||
return;
|
return;
|
||||||
} else if (needed->get_local_group_root() != root) {
|
} else if (needed->is_linked() && needed->get_local_group_root() != root) {
|
||||||
// external group
|
// external group
|
||||||
external_unload_list.push_back(needed);
|
external_unload_list.push_back(needed);
|
||||||
} else {
|
} else {
|
||||||
@ -1183,6 +1192,7 @@ static void soinfo_unload(soinfo* root) {
|
|||||||
depth_first_list.push_front(needed);
|
depth_first_list.push_front(needed);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user