From 2be78ea16b1b57cbbbb05a25df4da4e456886b1e Mon Sep 17 00:00:00 2001 From: jdp Date: Fri, 25 Jun 1999 02:53:59 +0000 Subject: Fix a serious performance bug for large programs on the Alpha, discovered by Hidetoshi Shimokawa. Large programs need multiple GOTs. The lazy binding stub in the PLT can be reached from any of these GOTs, but the dynamic linker only has enough information to fix up the first GOT entry. Thus calls through the other GOTs went through the time-consuming lazy binding process on every call. This fix rewrites the PLT entries themselves to bypass the lazy binding. Tested by Hidetoshi Shimokawa and Steve Price. Reviewed by: Doug Rabson --- libexec/rtld-elf/rtld.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'libexec/rtld-elf/rtld.c') diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 0261c3f..fd46c29 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -1,5 +1,5 @@ /*- - * Copyright 1996-1998 John D. Polstra. + * Copyright 1996, 1997, 1998, 1999 John D. Polstra. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: rtld.c,v 1.22 1999/04/21 04:06:57 jdp Exp $ + * $Id: rtld.c,v 1.23 1999/04/22 01:54:38 jdp Exp $ */ /* @@ -302,14 +302,14 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp) return (func_ptr_type) obj_main->entry; } -caddr_t +Elf_Addr _rtld_bind(const Obj_Entry *obj, Elf_Word reloff) { const Elf_Rel *rel; const Elf_Sym *def; const Obj_Entry *defobj; Elf_Addr *where; - caddr_t target; + Elf_Addr target; if (obj->pltrel) rel = (const Elf_Rel *) ((caddr_t) obj->pltrel + reloff); @@ -321,13 +321,13 @@ _rtld_bind(const Obj_Entry *obj, Elf_Word reloff) if (def == NULL) die(); - target = (caddr_t) (defobj->relocbase + def->st_value); + target = (Elf_Addr)(defobj->relocbase + def->st_value); dbg("\"%s\" in \"%s\" ==> %p in \"%s\"", defobj->strtab + def->st_name, basename(obj->path), - target, basename(defobj->path)); + (void *)target, basename(defobj->path)); - *where = (Elf_Addr) target; + reloc_jmpslot(where, target); return target; } -- cgit v1.1