From 561991144e4291605948bef275045b5f85a5b121 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Sun, 4 Nov 2018 00:32:28 +0000 Subject: [PATCH] Remove Obj_Entry textsize member. It is unused after r340102, and more important, I do not see how to define textsize in both practically useful and correct way, for binaries with more that one executable segments. Sponsored by: The FreeBSD Foundation --- libexec/rtld-elf/map_object.c | 1 - libexec/rtld-elf/rtld.c | 4 ---- libexec/rtld-elf/rtld.h | 1 - 3 files changed, 6 deletions(-) diff --git a/libexec/rtld-elf/map_object.c b/libexec/rtld-elf/map_object.c index 3c625b73dfec..61a18a46315b 100644 --- a/libexec/rtld-elf/map_object.c +++ b/libexec/rtld-elf/map_object.c @@ -287,7 +287,6 @@ map_object(int fd, const char *path, const struct stat *sb) } obj->mapbase = mapbase; obj->mapsize = mapsize; - obj->textsize = text_end - base_vaddr; obj->vaddrbase = base_vaddr; obj->relocbase = mapbase - base_vaddr; obj->dynamic = (const Elf_Dyn *)(obj->relocbase + phdyn->p_vaddr); diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index bae25210cb1b..72d8f07c6b88 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -1415,10 +1415,6 @@ digest_phdr(const Elf_Phdr *phdr, int phnum, caddr_t entry, const char *path) obj->vaddrbase; } nsegs++; - if ((ph->p_flags & PF_X) == PF_X) { - obj->textsize = MAX(obj->textsize, - round_page(ph->p_vaddr + ph->p_memsz) - obj->vaddrbase); - } break; case PT_DYNAMIC: diff --git a/libexec/rtld-elf/rtld.h b/libexec/rtld-elf/rtld.h index 7e5663e8245c..650c6dbb8229 100644 --- a/libexec/rtld-elf/rtld.h +++ b/libexec/rtld-elf/rtld.h @@ -151,7 +151,6 @@ typedef struct Struct_Obj_Entry { /* These items are computed by map_object() or by digest_phdr(). */ caddr_t mapbase; /* Base address of mapped region */ size_t mapsize; /* Size of mapped region in bytes */ - size_t textsize; /* Size of text segment in bytes */ Elf_Addr vaddrbase; /* Base address in shared object file */ caddr_t relocbase; /* Relocation constant = mapbase - vaddrbase */ const Elf_Dyn *dynamic; /* Dynamic section */