summaryrefslogtreecommitdiff
path: root/ldso/libdl
diff options
context:
space:
mode:
Diffstat (limited to 'ldso/libdl')
-rw-r--r--ldso/libdl/libdl.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c
index d36ac6421..213eba49f 100644
--- a/ldso/libdl/libdl.c
+++ b/ldso/libdl/libdl.c
@@ -856,6 +856,8 @@ static int do_dlclose(void *vhandle, int need_fini)
i < tpnt->n_phent; ppnt++, i++) {
if (ppnt->p_type != PT_LOAD)
continue;
+ if (ppnt->p_vaddr < start)
+ start = ppnt->p_vaddr;
if (end < ppnt->p_vaddr + ppnt->p_memsz)
end = ppnt->p_vaddr + ppnt->p_memsz;
}
@@ -962,13 +964,15 @@ static int do_dlclose(void *vhandle, int need_fini)
}
#endif
- start = tpnt->mapaddr;
- _dl_if_debug_print("unmapping before alignment: %s start: '%p' end: '%p'\n", tpnt->libname, start, end);
end = (end + ADDR_ALIGN) & PAGE_ALIGN;
start = start & ~ADDR_ALIGN;
- _dl_if_debug_print("unmapping: %s start: '%p' end: '%p'\n", tpnt->libname, start, end);
- if (end > start)
- DL_LIB_UNMAP (tpnt, end - start);
+ if (end > start) {
+ _dl_if_debug_print("unmapping: %s at %p with length: '%p' until %p\n", tpnt->libname, tpnt->mapaddr, end - start, tpnt->mapaddr + (end - start));
+ DL_LIB_UNMAP (tpnt, end - start);
+ }
+ else {
+ _dl_if_debug_print("NOT unmapping: %s at %p. start<end ('%p'<'%p')", tpnt->libname, tpnt->mapaddr, start, end);
+ }
/* Free elements in RTLD_LOCAL scope list */
for (runp = tpnt->rtld_local; runp; runp = tmp) {
tmp = runp->next;