diff options
author | jdp <jdp@FreeBSD.org> | 1999-06-25 02:53:59 +0000 |
---|---|---|
committer | jdp <jdp@FreeBSD.org> | 1999-06-25 02:53:59 +0000 |
commit | 2be78ea16b1b57cbbbb05a25df4da4e456886b1e (patch) | |
tree | 83d8009aa5e1c5ab9099cc0f005d362f28775078 /libexec/rtld-elf/rtld.c | |
parent | 5ebdb91f86b4fa1cd4c6463fe611646aaccb77e3 (diff) | |
download | FreeBSD-src-2be78ea16b1b57cbbbb05a25df4da4e456886b1e.zip FreeBSD-src-2be78ea16b1b57cbbbb05a25df4da4e456886b1e.tar.gz |
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 <dfr@freebsd.org>
Diffstat (limited to 'libexec/rtld-elf/rtld.c')
-rw-r--r-- | libexec/rtld-elf/rtld.c | 14 |
1 files changed, 7 insertions, 7 deletions
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; } |