git: 4292b5133586 - stable/14 - rtld: Remove write-only text_end local variable from map_object

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Fri, 09 Oct 2026 00:20:44 UTC
The branch stable/14 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=4292b51335867aff31bda98107574dfc3b0ac0da

commit 4292b51335867aff31bda98107574dfc3b0ac0da
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2026-07-29 18:38:08 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2026-10-08 18:40:38 +0000

    rtld: Remove write-only text_end local variable from map_object
    
    Reviewed by:    kib
    Fixes:          561991144e42 ("Remove Obj_Entry textsize member.")
    Sponsored by:   AFRL, DARPA
    Differential Revision:  https://reviews.freebsd.org/D58522
    (cherry picked from commit ec73badfbc2e08928d917924af491c07e1f39a09)
---
 libexec/rtld-elf/map_object.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/libexec/rtld-elf/map_object.c b/libexec/rtld-elf/map_object.c
index d8583cb67e5a..e021f42681a8 100644
--- a/libexec/rtld-elf/map_object.c
+++ b/libexec/rtld-elf/map_object.c
@@ -99,7 +99,6 @@ map_object(int fd, const char *path, const struct stat *sb, bool ismain)
     Elf_Addr note_end;
     char *note_map;
     size_t note_map_len;
-    Elf_Addr text_end;
 
     hdr = get_elf_header(fd, path, sb, &phdr);
     if (hdr == NULL)
@@ -122,7 +121,6 @@ map_object(int fd, const char *path, const struct stat *sb, bool ismain)
     note_map_len = 0;
     segs = alloca(sizeof(segs[0]) * hdr->e_phnum);
     stack_flags = PF_X | PF_R | PF_W;
-    text_end = 0;
     while (phdr < phlimit) {
 	switch (phdr->p_type) {
 
@@ -137,11 +135,6 @@ map_object(int fd, const char *path, const struct stat *sb, bool ismain)
 		    path, nsegs);
 		goto error;
 	    }
-	    if ((segs[nsegs]->p_flags & PF_X) == PF_X) {
-		text_end = MAX(text_end,
-		    rtld_round_page(segs[nsegs]->p_vaddr +
-		    segs[nsegs]->p_memsz));
-	    }
 	    break;
 
 	case PT_PHDR: