Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/libexec/ld.elf_so Support LD_BIND_NOW for alpha.
details: https://anonhg.NetBSD.org/src/rev/1eedf8a83b61
branches: trunk
changeset: 581116:1eedf8a83b61
user: skrll <skrll%NetBSD.org@localhost>
date: Wed May 25 13:39:46 2005 +0000
description:
Support LD_BIND_NOW for alpha.
diffstat:
libexec/ld.elf_so/arch/alpha/alpha_reloc.c | 44 +++++++++++++++++++++++++----
libexec/ld.elf_so/reloc.c | 6 ++--
2 files changed, 40 insertions(+), 10 deletions(-)
diffs (106 lines):
diff -r 5450a0255d19 -r 1eedf8a83b61 libexec/ld.elf_so/arch/alpha/alpha_reloc.c
--- a/libexec/ld.elf_so/arch/alpha/alpha_reloc.c Wed May 25 12:47:24 2005 +0000
+++ b/libexec/ld.elf_so/arch/alpha/alpha_reloc.c Wed May 25 13:39:46 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: alpha_reloc.c,v 1.24 2003/07/24 10:12:27 skrll Exp $ */
+/* $NetBSD: alpha_reloc.c,v 1.25 2005/05/25 13:39:46 skrll Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@@ -77,6 +77,9 @@
void _rtld_bind_start_old(void);
void _rtld_relocate_nonplt_self(Elf_Dyn *, Elf_Addr);
caddr_t _rtld_bind(const Obj_Entry *, Elf_Word);
+static inline int _rtld_relocate_plt_object(const Obj_Entry *,
+ const Elf_Rela *, Elf_Addr *tp);
+
void
_rtld_setup_pltgot(const Obj_Entry *obj)
@@ -304,10 +307,9 @@
return 0;
}
-caddr_t
-_rtld_bind(const Obj_Entry *obj, Elf_Word reloff)
+static inline int
+_rtld_relocate_plt_object(const Obj_Entry *obj, const Elf_Rela *rela, Elf_Addr *tp)
{
- const Elf_Rela *rela = (const Elf_Rela *)((caddr_t)obj->pltrela + reloff);
Elf_Addr *where = (Elf_Addr *)(obj->relocbase + rela->r_offset);
Elf_Addr new_value;
const Elf_Sym *def;
@@ -318,7 +320,7 @@
def = _rtld_find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, true);
if (def == NULL)
- _rtld_die();
+ return -1;
new_value = (Elf_Addr)(defobj->relocbase + def->st_value);
rdbg(("bind now/fixup in %s --> old=%p new=%p",
@@ -471,7 +473,35 @@
* is patched up (bind-now case).
*/
}
+out:
+ if (tp)
+ *tp = new_value;
- out:
- return (caddr_t)new_value;
+ return 0;
}
+
+caddr_t
+_rtld_bind(const Obj_Entry *obj, Elf_Word reloff)
+{
+ const Elf_Rela *rela = (const Elf_Rela *)((caddr_t)obj->pltrela + reloff);
+ Elf_Addr result;
+ int err;
+
+ err = _rtld_relocate_plt_object(obj, rela, &result);
+ if (err)
+ _rtld_die();
+
+ return (caddr_t)result;
+}
+
+int
+_rtld_relocate_plt_objects(const Obj_Entry *obj)
+{
+ const Elf_Rela *rela;
+
+ for (rela = obj->pltrela; rela < obj->pltrelalim; rela++)
+ if (_rtld_relocate_plt_object(obj, rela, NULL) < 0)
+ return -1;
+
+ return 0;
+}
diff -r 5450a0255d19 -r 1eedf8a83b61 libexec/ld.elf_so/reloc.c
--- a/libexec/ld.elf_so/reloc.c Wed May 25 12:47:24 2005 +0000
+++ b/libexec/ld.elf_so/reloc.c Wed May 25 13:39:46 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: reloc.c,v 1.87 2005/01/09 14:58:15 martin Exp $ */
+/* $NetBSD: reloc.c,v 1.88 2005/05/25 13:39:46 skrll Exp $ */
/*
* Copyright 1996 John D. Polstra.
@@ -39,7 +39,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: reloc.c,v 1.87 2005/01/09 14:58:15 martin Exp $");
+__RCSID("$NetBSD: reloc.c,v 1.88 2005/05/25 13:39:46 skrll Exp $");
#endif /* not lint */
#include <err.h>
@@ -191,7 +191,7 @@
bind_now = 1;
#endif
#if defined(__i386__) || defined(__arm__) || defined(__hppa__) \
- || defined(__sparc64__) || defined(__sparc__)
+ || defined(__sparc64__) || defined(__sparc__) || defined(__alpha__)
if (bind_now) {
dbg(("doing immediate PLT binding"));
if (_rtld_relocate_plt_objects(obj) < 0)
Home |
Main Index |
Thread Index |
Old Index