aboutsummaryrefslogtreecommitdiff
path: root/elf
diff options
context:
space:
mode:
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-close.c10
-rw-r--r--elf/dl-deps.c4
2 files changed, 10 insertions, 4 deletions
diff --git a/elf/dl-close.c b/elf/dl-close.c
index 285457323d..253b073367 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -80,6 +80,7 @@ _dl_close (struct link_map *map)
/* That was the last reference, and this was a dlopen-loaded
object. We can unmap it. */
const ElfW(Phdr) *ph;
+ const ElfW(Phdr) *eph;
if (imap->l_info[DT_FINI])
/* Call its termination function. */
@@ -99,9 +100,14 @@ _dl_close (struct link_map *map)
_dl_global_scope_end[1] = NULL;
}
+ /* Find the first entry specifying a load command. We have
+ to determine this now since the table itself is also loaded. */
+ for (eph = imap->l_phdr; eph < imap->l_phdr + imap->l_phnum; ++eph)
+ if (eph->p_type == PT_LOAD)
+ break;
+
/* Unmap the segments. */
- for (ph = imap->l_phdr + (imap->l_phnum - 1);
- ph >= imap->l_phdr; --ph)
+ for (ph = imap->l_phdr + (imap->l_phnum - 1); ph >= eph; --ph)
if (ph->p_type == PT_LOAD)
{
ElfW(Addr) mapstart = ph->p_vaddr & ~(ph->p_align - 1);
diff --git a/elf/dl-deps.c b/elf/dl-deps.c
index 6327098736..5dbef6cabf 100644
--- a/elf/dl-deps.c
+++ b/elf/dl-deps.c
@@ -203,7 +203,7 @@ _dl_map_object_deps (struct link_map *map,
/* Say that we are about to load an auxiliary library. */
if (_dl_debug_libs)
- _dl_debug_message ("load auxiliary object=",
+ _dl_debug_message (1, "load auxiliary object=",
strtab + d->d_un.d_val,
" requested by file=",
l->l_name[0]
@@ -226,7 +226,7 @@ _dl_map_object_deps (struct link_map *map,
{
/* Say that we are about to load an auxiliary library. */
if (_dl_debug_libs)
- _dl_debug_message ("load filtered object=",
+ _dl_debug_message (1, "load filtered object=",
strtab + d->d_un.d_val,
" requested by file=",
l->l_name[0]