diff options
author | Florian Weimer <fweimer@redhat.com> | 2023-10-18 14:27:31 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2023-10-18 14:27:31 +0200 |
commit | 512e30fd56a7a6c4dcf36b3e2e6a4f28a7e4b273 (patch) | |
tree | 613e6238153f5060842b5622bca872dd703ac7ce /elf/rtld.c | |
parent | b4e23c75aea756b4bddc4abcf27a1c6dca8b6bd3 (diff) | |
download | glibc-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/rtld.c')
-rw-r--r-- | elf/rtld.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/elf/rtld.c b/elf/rtld.c index 2658d47cc4..b8467f37cf 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -480,6 +480,7 @@ _dl_start_final (void *arg, struct dl_start_final_info *info) GL(dl_rtld_map).l_real = &GL(dl_rtld_map); GL(dl_rtld_map).l_map_start = (ElfW(Addr)) &__ehdr_start; GL(dl_rtld_map).l_map_end = (ElfW(Addr)) _end; + GL(dl_rtld_map).l_text_end = (ElfW(Addr)) _etext; /* Copy the TLS related data if necessary. */ #ifndef DONT_USE_BOOTSTRAP_MAP # if NO_TLS_OFFSET != 0 @@ -1121,6 +1122,7 @@ rtld_setup_main_map (struct link_map *main_map) bool has_interp = false; main_map->l_map_end = 0; + main_map->l_text_end = 0; /* Perhaps the executable has no PT_LOAD header entries at all. */ main_map->l_map_start = ~0; /* And it was opened directly. */ @@ -1212,6 +1214,8 @@ rtld_setup_main_map (struct link_map *main_map) allocend = main_map->l_addr + ph->p_vaddr + ph->p_memsz; if (main_map->l_map_end < allocend) main_map->l_map_end = allocend; + if ((ph->p_flags & PF_X) && allocend > main_map->l_text_end) + main_map->l_text_end = allocend; /* The next expected address is the page following this load segment. */ @@ -1271,6 +1275,8 @@ rtld_setup_main_map (struct link_map *main_map) = (char *) main_map->l_tls_initimage + main_map->l_addr; if (! main_map->l_map_end) main_map->l_map_end = ~0; + if (! main_map->l_text_end) + main_map->l_text_end = ~0; if (! GL(dl_rtld_map).l_libname && GL(dl_rtld_map).l_name) { /* We were invoked directly, so the program might not have a |