From 2627f3570d94f35e40cabf7861bb82048fe8395b Mon Sep 17 00:00:00 2001 From: Alexander Kabaev Date: Wed, 25 Feb 2004 17:06:16 +0000 Subject: [PATCH] Do not depend on existence of _end symbol in obj_from_addr, use obj->mapbase and obj->mapsize instead. Prompted by: OpenOffice debugging session at last BSDCon. --- libexec/rtld-elf/rtld.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 73568d6478bd..7981fa904131 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -54,7 +54,6 @@ #include "rtld.h" #include "libmap.h" -#define END_SYM "_end" #define PATH_RTLD "/libexec/ld-elf.so.1" /* Types. */ @@ -1229,18 +1228,12 @@ load_object(char *path) static Obj_Entry * obj_from_addr(const void *addr) { - unsigned long endhash; Obj_Entry *obj; - endhash = elf_hash(END_SYM); for (obj = obj_list; obj != NULL; obj = obj->next) { - const Elf_Sym *endsym; - if (addr < (void *) obj->mapbase) continue; - if ((endsym = symlook_obj(END_SYM, endhash, obj, true)) == NULL) - continue; /* No "end" symbol?! */ - if (addr < (void *) (obj->relocbase + endsym->st_value)) + if (addr < (void *) (obj->mapbase + obj->mapsize)) return obj; } return NULL;