From 710f7bab59b9bb02f1cd46fa2db14e2b4b0a806a Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Mon, 3 Jun 1996 04:46:40 +0000 Subject: Mon Jun 3 00:30:35 1996 Roland McGrath * elf/dl-lookup.c (_dl_lookup_symbol): Take new arg RELOC_ADDR and don't allow a defn resolving to that address. * elf/link.h: Update prototype and comment. * elf/dl-runtime.c (fixup): Define local `resolve' function and pass it to elf_machine_relplt. * elf/dl-reloc.c (_dl_relocate_object: resolve): Take new arg RELOC_ADDR and pass it through to _dl_lookup_symbol. * elf/do-rel.h (elf_dynamic_do_rel): Pass RESOLVE to elf_machine_rel instead of calling it ourselves and passing its results. (elf_dynamic_do_rel): RESOLVE fn takes new arg RELOC_ADDR. * elf/rtld.c (dl_main): Pass 0 for RELOC_ADDR to _dl_lookup_symbol. * sysdeps/i386/dl-machine.h (elf_machine_rel): Remove SYM_LOADADDR arg. Add RESOLVE function ptr arg. Call *RESOLVE as necessary. * sysdeps/m68k/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/stub/dl-machine.h: Likewise. * csu/initfini.c (_fini): Add extern decl for i_am_not_a_leaf. * elf/dlfcn.h (dl_open_mode): Enumerated type removed. (RTLD_LAZY, RTLD_NOW): Define these as macros instead. (RTLD_GLOBAL): New macro. (dlopen): Take arg of type int instead of dl_open_mode. * elf/dlopen.c: Likewise. * math/math.h (_Mldbl): New macro, either produces L suffix or not. (M_*): Use it for these constants. --- elf/dl-runtime.c | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) (limited to 'elf/dl-runtime.c') diff --git a/elf/dl-runtime.c b/elf/dl-runtime.c index 941a306..0beba76 100644 --- a/elf/dl-runtime.c +++ b/elf/dl-runtime.c @@ -67,34 +67,15 @@ fixup ( = (const void *) (l->l_addr + l->l_info[DT_JMPREL]->d_un.d_ptr + reloc_offset); - const Elf32_Sym *definer; - Elf32_Addr loadbase; - struct link_map *scope, *real_next; - - /* Look up the symbol's run-time value. */ - - real_next = l->l_next; - if (l->l_info[DT_SYMBOLIC]) + Elf32_Addr resolve (const Elf32_Sym **ref, + Elf32_Addr reloc_addr, int noplt) { - l->l_next = _dl_loaded; - if (l->l_prev) - l->l_prev->l_next = real_next; - scope = l; + return _dl_lookup_symbol (strtab + (*ref)->st_name, ref, _dl_loaded, + l->l_name, reloc_addr, noplt); } - else - scope = _dl_loaded; - - definer = &symtab[ELF32_R_SYM (reloc->r_info)]; - loadbase = _dl_lookup_symbol (strtab + definer->st_name, &definer, - scope, l->l_name, 1); - - /* Restore list frobnication done above for DT_SYMBOLIC. */ - l->l_next = real_next; - if (l->l_prev) - l->l_prev->l_next = l; - /* Apply the relocation with that value. */ - elf_machine_relplt (l, reloc, loadbase, definer); + /* Perform the specified relocation. */ + elf_machine_relplt (l, reloc, &symtab[ELF32_R_SYM (reloc->r_info)], resolve); return *(Elf32_Addr *) (l->l_addr + reloc->r_offset); } -- cgit v1.1