From 852fc4b91e0c657e02c7d15bc24fbbae066ccae3 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Tue, 11 Jun 1996 21:07:00 +0000 Subject: * elf/Makefile ($(objpfx)$(rtld-installed-name)): New target to make link to ld.so if that is not the installed name. (lib-noranlib): Depend on the installed name in the build directory instead of on ld.so. * Makeconfig (link-libc): Include $(elfobjdir)/$(rtld-installed-name) between libc.so and libc.a, because with libc.so's DT_NEEDED for ld.so ld searches libc.a before ld.so (is that an ld bug?). Add $(elfobjdir) to -rpath-link. * Makerules (elfobjdir): Define as . when $(subdir) is elf. * sysdeps/i386/dl-machine.h (elf_machine_rel): In R_386_32 case when relocating _dl_rtld_map, subtract SYM's value from final reloc value, but don't change *RELOC_ADDR before calling *RESOLVE, because it might call the function we are relocating! --- sysdeps/i386/dl-machine.h | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'sysdeps') diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h index bcd388fd20..a718792e0a 100644 --- a/sysdeps/i386/dl-machine.h +++ b/sysdeps/i386/dl-machine.h @@ -79,7 +79,7 @@ elf_machine_rel (struct link_map *map, int noplt)) { Elf32_Addr *const reloc_addr = (void *) (map->l_addr + reloc->r_offset); - Elf32_Addr loadbase; + Elf32_Addr loadbase, undo; switch (ELF32_R_TYPE (reloc->r_info)) { @@ -101,20 +101,17 @@ elf_machine_rel (struct link_map *map, break; case R_386_32: if (resolve && map == &_dl_rtld_map) - { - /* Undo the relocation done here during bootstrapping. Now we will - relocate it anew, possibly using a binding found in the user - program or a loaded library rather than the dynamic linker's - built-in definitions used while loading those libraries. */ - const Elf32_Sym *const dlsymtab - = (void *) (map->l_addr + map->l_info[DT_SYMTAB]->d_un.d_ptr); - *reloc_addr -= (map->l_addr + - dlsymtab[ELF32_R_SYM (reloc->r_info)].st_value); - } + /* Undo the relocation done here during bootstrapping. Now we will + relocate it anew, possibly using a binding found in the user + program or a loaded library rather than the dynamic linker's + built-in definitions used while loading those libraries. */ + undo = map->l_addr + sym->st_value; + else + undo = 0; loadbase = (resolve ? (*resolve) (&sym, (Elf32_Addr) reloc_addr, 0) : /* RESOLVE is null during bootstrap relocation. */ map->l_addr); - *reloc_addr += sym ? (loadbase + sym->st_value) : 0; + *reloc_addr += (sym ? (loadbase + sym->st_value) : 0) - undo; break; case R_386_RELATIVE: if (!resolve || map != &_dl_rtld_map) /* Already done in rtld itself. */ -- cgit 1.4.1