about summary refs log tree commit diff
path: root/sysdeps/i386
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-06-11 21:07:00 +0000
committerRoland McGrath <roland@gnu.org>1996-06-11 21:07:00 +0000
commit852fc4b91e0c657e02c7d15bc24fbbae066ccae3 (patch)
tree16e0d249a0b7b0f6d47a410cdfdfe890d7a898cb /sysdeps/i386
parent6ba35316626b0aec32d29b7307965de4f4bb59fb (diff)
downloadglibc-852fc4b91e0c657e02c7d15bc24fbbae066ccae3.tar.gz
glibc-852fc4b91e0c657e02c7d15bc24fbbae066ccae3.tar.xz
glibc-852fc4b91e0c657e02c7d15bc24fbbae066ccae3.zip
* 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!
Diffstat (limited to 'sysdeps/i386')
-rw-r--r--sysdeps/i386/dl-machine.h21
1 files changed, 9 insertions, 12 deletions
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.  */