about summary refs log tree commit diff
path: root/elf/dl-load.h
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2023-10-18 14:27:31 +0200
committerFlorian Weimer <fweimer@redhat.com>2023-10-18 14:27:31 +0200
commit512e30fd56a7a6c4dcf36b3e2e6a4f28a7e4b273 (patch)
tree613e6238153f5060842b5622bca872dd703ac7ce /elf/dl-load.h
parentb4e23c75aea756b4bddc4abcf27a1c6dca8b6bd3 (diff)
downloadglibc-512e30fd56a7a6c4dcf36b3e2e6a4f28a7e4b273.tar.gz
glibc-512e30fd56a7a6c4dcf36b3e2e6a4f28a7e4b273.tar.xz
glibc-512e30fd56a7a6c4dcf36b3e2e6a4f28a7e4b273.zip
Revert "elf: Remove unused l_text_end field from struct link_map"
This reverts commit bdb594afa515d0150f8f092c45e04942d20ecb61.

Reason for revert: Preserve ABI after revert of commit a7e34a66758.
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