about summary refs log tree commit diff
path: root/elf/dl-load.h
diff options
context:
space:
mode:
Diffstat (limited to 'elf/dl-load.h')
-rw-r--r--elf/dl-load.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/elf/dl-load.h b/elf/dl-load.h
index 1d5207694b..ecf6910c68 100644
--- a/elf/dl-load.h
+++ b/elf/dl-load.h
@@ -83,11 +83,14 @@ struct loadcmd
 
 /* This is a subroutine of _dl_map_segments.  It should be called for each
    load command, some time after L->l_addr has been set correctly.  It is
-   responsible for setting the l_phdr fields  */
+   responsible for setting up the l_text_end and l_phdr fields.  */
 static __always_inline void
 _dl_postprocess_loadcmd (struct link_map *l, const ElfW(Ehdr) *header,
                          const struct loadcmd *c)
 {
+  if (c->prot & PROT_EXEC)
+    l->l_text_end = l->l_addr + c->mapend;
+
   if (l->l_phdr == 0
       && c->mapoff <= header->e_phoff
       && ((size_t) (c->mapend - c->mapstart + c->mapoff)
@@ -100,7 +103,7 @@ _dl_postprocess_loadcmd (struct link_map *l, const ElfW(Ehdr) *header,
 
 /* This is a subroutine of _dl_map_object_from_fd.  It is responsible
    for filling in several fields in *L: l_map_start, l_map_end, l_addr,
-   l_contiguous, l_phdr.  On successful return, all the
+   l_contiguous, l_text_end, l_phdr.  On successful return, all the
    segments are mapped (or copied, or whatever) from the file into their
    final places in the address space, with the correct page permissions,
    and any bss-like regions already zeroed.  It returns a null pointer